* Problems cloning the git repostories
@ 2011-09-25 12:33 Patrick Dickey
2011-09-25 13:55 ` Devin Heitmueller
` (2 more replies)
0 siblings, 3 replies; 91+ messages in thread
From: Patrick Dickey @ 2011-09-25 12:33 UTC (permalink / raw)
To: LMML
Hello there,
I tried to follow the steps for cloning both the "media_tree.git" and
"media_build.git" repositories, and received errors for both. The
media_tree repository failed on the first line
> git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git v4l-dvb
which I'm assuming is because kernel.org is down.
The media_build.git repository fails on the first line also
> git clone git://linuxtv.org/media_build.git
with a fatal: read error: Connection reset by peer.
Is it possible to clone either (or both) repositories at this time, or
are they down? And in the absence of cloning the kernel for the
media_tree.git repository, is it possible to simply clone the
git://linuxtv.org/media_tree.git repository and work from that?
My interest in this is to install some patches created by Devin
Heitmueller for the Pinnacle PCTV 80e USB tuner (at least the ATSC
portion of the tuner). Once I'm able to determine exactly what changes
are made, I would like to either submit the patches to the repository,
or send them to someone who has more experience in patching the files
for submission.
One other question (totally unrelated to this post though): When I send
emails, normally they are GPG signed. Should I disable that for this
list, or is it acceptable?
Thank you for any information, and have a great day:)
Patrick.
^ permalink raw reply [flat|nested] 91+ messages in thread* Re: Problems cloning the git repostories 2011-09-25 12:33 Problems cloning the git repostories Patrick Dickey @ 2011-09-25 13:55 ` Devin Heitmueller 2011-09-26 3:25 ` Mauro Carvalho Chehab 2011-10-30 21:09 ` Problems cloning the git repostories Marek Vasut 2011-09-25 14:53 ` Anca Emanuel 2011-09-25 18:03 ` Johannes Stezenbach 2 siblings, 2 replies; 91+ messages in thread From: Devin Heitmueller @ 2011-09-25 13:55 UTC (permalink / raw) To: Patrick Dickey; +Cc: LMML On Sun, Sep 25, 2011 at 8:33 AM, Patrick Dickey <pdickeybeta@gmail.com> wrote: > Hello there, > > I tried to follow the steps for cloning both the "media_tree.git" and > "media_build.git" repositories, and received errors for both. The > media_tree repository failed on the first line > >> git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git v4l-dvb > > which I'm assuming is because kernel.org is down. > > The media_build.git repository fails on the first line also > >> git clone git://linuxtv.org/media_build.git > > with a fatal: read error: Connection reset by peer. > > Is it possible to clone either (or both) repositories at this time, or > are they down? And in the absence of cloning the kernel for the > media_tree.git repository, is it possible to simply clone the > git://linuxtv.org/media_tree.git repository and work from that? > > My interest in this is to install some patches created by Devin > Heitmueller for the Pinnacle PCTV 80e USB tuner (at least the ATSC > portion of the tuner). Once I'm able to determine exactly what changes > are made, I would like to either submit the patches to the repository, > or send them to someone who has more experience in patching the files > for submission. > > One other question (totally unrelated to this post though): When I send > emails, normally they are GPG signed. Should I disable that for this > list, or is it acceptable? > > Thank you for any information, and have a great day:) > Patrick. Hi Patrick, As I said on the blog, the issue isn't getting the driver to work against current kernels. Merging the driver against the current tree is a trivial exercise (the patch series should apply trivially against the current code, with only a few minor conflicts related to board numbers, etc). The bigger issue though is once you do that and have the driver running, you now have a body of code > 10,000 lines which doesn't meet the "coding standards". Doing such a refactoring is a relatively straightforward exercise but very time consuming (you already have a working driver, so you just have to make sure you don't break anything). The more I think about this, the more it annoys me. I did all the hard parts: * I worked with the product vendor to get the details for the design * I got Hauppauge/PCTV to compel the chipset vendor to release the reference code under a GPL compatible license * I worked out redistribution terms on the firmware * I ported the driver to Linux * I integrated the driver and debugged it to achieve signal lock And why is it not in the mainline? Because none of the above matters if I didn't waste a bunch of my time removing a bunch of "#ifdef WINDOWS" lines and converting whitespace from tabs to spaces. It's crap like this that's the reason why some of the best LinuxTV driver authors still have a bunch of stuff that isn't merged upstream. We just don't have time for this sort of bullshit that any monkey could do if he/she was willing to invest the effort. We're just too busy doing *actual* driver work. Five years ago the hard part was finding competent developers, getting access to datasheets, getting access to reference driver code, and getting access to the details for a hardware design. Now most of those problems are not the issue - we have access to all the data but we want to waste the time of the few competent developers out there making them do "coding style cleanup" before perfectly good code gets merged upstream. There has been more than one case where I've considered doing a driver for a new board and decided against it because the barrier to getting it upstream is not worth my time. Want to see more device support upstream? Optimize the process to make it easy for the people who know the hardware and how to write the drivers to get code upstream, and leave it to the "janitors" to work out the codingstyle issues. Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Problems cloning the git repostories 2011-09-25 13:55 ` Devin Heitmueller @ 2011-09-26 3:25 ` Mauro Carvalho Chehab 2011-09-27 2:20 ` Devin Heitmueller 2011-10-30 21:09 ` Problems cloning the git repostories Marek Vasut 1 sibling, 1 reply; 91+ messages in thread From: Mauro Carvalho Chehab @ 2011-09-26 3:25 UTC (permalink / raw) To: Devin Heitmueller; +Cc: Patrick Dickey, LMML Em 25-09-2011 10:55, Devin Heitmueller escreveu: > On Sun, Sep 25, 2011 at 8:33 AM, Patrick Dickey <pdickeybeta@gmail.com> wrote: >> Hello there, >> >> I tried to follow the steps for cloning both the "media_tree.git" and >> "media_build.git" repositories, and received errors for both. The >> media_tree repository failed on the first line >> >>> git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git v4l-dvb >> >> which I'm assuming is because kernel.org is down. >> >> The media_build.git repository fails on the first line also >> >>> git clone git://linuxtv.org/media_build.git >> >> with a fatal: read error: Connection reset by peer. >> >> Is it possible to clone either (or both) repositories at this time, or >> are they down? And in the absence of cloning the kernel for the >> media_tree.git repository, is it possible to simply clone the >> git://linuxtv.org/media_tree.git repository and work from that? >> >> My interest in this is to install some patches created by Devin >> Heitmueller for the Pinnacle PCTV 80e USB tuner (at least the ATSC >> portion of the tuner). Once I'm able to determine exactly what changes >> are made, I would like to either submit the patches to the repository, >> or send them to someone who has more experience in patching the files >> for submission. >> >> One other question (totally unrelated to this post though): When I send >> emails, normally they are GPG signed. Should I disable that for this >> list, or is it acceptable? >> >> Thank you for any information, and have a great day:) >> Patrick. > > Hi Patrick, > > As I said on the blog, the issue isn't getting the driver to work > against current kernels. Merging the driver against the current tree > is a trivial exercise (the patch series should apply trivially against > the current code, with only a few minor conflicts related to board > numbers, etc). > > The bigger issue though is once you do that and have the driver > running, you now have a body of code > 10,000 lines which doesn't meet > the "coding standards". Doing such a refactoring is a relatively > straightforward exercise but very time consuming (you already have a > working driver, so you just have to make sure you don't break > anything). > > The more I think about this, the more it annoys me. I did all the hard parts: > > * I worked with the product vendor to get the details for the design > * I got Hauppauge/PCTV to compel the chipset vendor to release the > reference code under a GPL compatible license > * I worked out redistribution terms on the firmware > * I ported the driver to Linux > * I integrated the driver and debugged it to achieve signal lock > > And why is it not in the mainline? Because none of the above matters > if I didn't waste a bunch of my time removing a bunch of "#ifdef > WINDOWS" lines and converting whitespace from tabs to spaces. > It's crap like this that's the reason why some of the best LinuxTV > driver authors still have a bunch of stuff that isn't merged upstream. > We just don't have time for this sort of bullshit that any monkey > could do if he/she was willing to invest the effort. We're just too > busy doing *actual* driver work. > > Five years ago the hard part was finding competent developers, getting > access to datasheets, getting access to reference driver code, and > getting access to the details for a hardware design. Now most of > those problems are not the issue - we have access to all the data but > we want to waste the time of the few competent developers out there > making them do "coding style cleanup" before perfectly good code gets > merged upstream. There has been more than one case where I've > considered doing a driver for a new board and decided against it > because the barrier to getting it upstream is not worth my time. > I fail to see any trial from your side to send the patches upstream: no pull requests and no patches for this driver were _ever_ sent to the ML. I can only guess that maybe submitting it upstream were not part of your contract with the vendor. Coding Style fixes are generally trivial, and they can be done very quickly with some scripting. I took only a few hours to convert drx-d and drx-k to the Linux Coding Style, on my spare time. The scripts I wrote for that are together with the commits (they're generally a few lines perl scripting doing some replacements). I usually do this with other drivers, when people submit me them with those troubles and I have some time, and never asked or earned a single penny for doing that. Also, as I've told you several times before, code with broken coding styles can be submitted as-is, without any changes to drivers/staging, where they're fixed by kernel newbies with more time to work on that. So, please don't use weak arguments like that as an excuse for you to not submit your drivers. > Want to see more device support upstream? Optimize the process to > make it easy for the people who know the hardware and how to write the > drivers to get code upstream, and leave it to the "janitors" to work > out the codingstyle issues. The process you've just described exists already since Sept, 2008. It is called: /drivers/staging In summary, if you don't have a couple hours to make your driver to match Kernel Coding Style, just send it as is to /drivers/staging, c/c me and Greg KH, and that's it. Regards, Mauro ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Problems cloning the git repostories 2011-09-26 3:25 ` Mauro Carvalho Chehab @ 2011-09-27 2:20 ` Devin Heitmueller 2011-09-27 7:44 ` Staging submission: PCTV 80e and PCTV 74e drivers (was Re: Problems cloning the git repostories) Stefan Richter 0 siblings, 1 reply; 91+ messages in thread From: Devin Heitmueller @ 2011-09-27 2:20 UTC (permalink / raw) To: Mauro Carvalho Chehab; +Cc: Patrick Dickey, LMML On Sun, Sep 25, 2011 at 11:25 PM, Mauro Carvalho Chehab <maurochehab@gmail.com> wrote: > I fail to see any trial from your side to send the patches upstream: > no pull requests and no patches for this driver were _ever_ sent to > the ML. You and I have discussed this issue multiple times with these drivers, including the drx-j (which is the basis for the 80e device in question). All the code is publicly available, and I in fact invited you personally to pull whatever you want (as a policy we don't publish public trees that have outstanding licensing issues). Look how long it took to get xc4000 upstream. Look how long it took drx-d to get upstream. Those trees sat there for *years* with your full knowledge of their existence and that the only reason they weren't merged was because of codingstyle issues. Oh, and I did spend a bunch of hours doing cleanup work on the as102 driver, and it was still not good enough. I decided it wasn't worth the additional time. That tree has only been rotting for 19 months. > I can only guess that maybe submitting it upstream were not > part of your contract with the vendor. I don't even know what this means. Commercial customers who I've done work for almost never are willing to pay for me to merge code upstream. And yet code does get upstream. Why? Because I do it in my free time as a courtesy to the community. Probably also worth noting that the project in question - the 80e - was not done for any customer. I just did the work because I wanted to see the device supported under Linux. > Coding Style fixes are generally trivial, and they can be done very quickly > with some scripting. I took only a few hours to convert drx-d and drx-k > to the Linux Coding Style, on my spare time. The scripts I wrote for that > are together with the commits (they're generally a few lines perl scripting > doing some replacements). I usually do this with other drivers, when people > submit me them with those troubles and I have some time, and never asked > or earned a single penny for doing that. Hey, feel free to grab the drx-j driver then. This is like the fourth time I'm invited you to pull the sources and do such a cleanup. And like I said above, I don't earn any money for such cleanups either. I just believe it's a colossal waste of my time that would be better spent doing real driver development. > Also, as I've told you several times before, code with broken coding styles > can be submitted as-is, without any changes to drivers/staging, where they're > fixed by kernel newbies with more time to work on that. Last I checked you can't put demod or tuners drivers into staging because they are a dependency of the bridge driver. I guess maybe you can accomplish that if you litter the bridge driver source and makefiles with #ifdef lines. If that situation has changed, then great. > So, please don't use weak arguments like that as an excuse for you to not > submit your drivers. Suggesting that the developers who are trying to give you working code at zero cost is a pretty crappy way to treat them. >> Want to see more device support upstream? Optimize the process to >> make it easy for the people who know the hardware and how to write the >> drivers to get code upstream, and leave it to the "janitors" to work >> out the codingstyle issues. > > The process you've just described exists already since Sept, 2008. > It is called: > /drivers/staging > > In summary, if you don't have a couple hours to make your driver to > match Kernel Coding Style, just send it as is to /drivers/staging, c/c > me and Greg KH, and that's it. PULL http://kernellabs.com/hg/~dheitmueller/v4l-dvb-80e/ PULL http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Have fun. The harder you make it to get code upstream, the more developers who will just say "to hell with this". And *that* is why there are thousands of lines of working drivers which various developers have in out-of-tree drivers. You can sit in denial that there is a fundamental problem with the management of this project and blame the developers for being lazy, or you can take some concrete action to get the code merged upstream. Your call. Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com ^ permalink raw reply [flat|nested] 91+ messages in thread
* Staging submission: PCTV 80e and PCTV 74e drivers (was Re: Problems cloning the git repostories) 2011-09-27 2:20 ` Devin Heitmueller @ 2011-09-27 7:44 ` Stefan Richter 2011-09-27 17:43 ` Greg KH 0 siblings, 1 reply; 91+ messages in thread From: Stefan Richter @ 2011-09-27 7:44 UTC (permalink / raw) To: Devin Heitmueller Cc: Mauro Carvalho Chehab, Patrick Dickey, LMML, Greg Kroah-Hartman, devel Adding Cc: staging maintainer and mailinglist. On Sep 26 Devin Heitmueller wrote: > On Sun, Sep 25, 2011 at 11:25 PM, Mauro Carvalho Chehab > <maurochehab@gmail.com> wrote: > >> Want to see more device support upstream? Optimize the process to > >> make it easy for the people who know the hardware and how to write the > >> drivers to get code upstream, and leave it to the "janitors" to work > >> out the codingstyle issues. > > > > The process you've just described exists already since Sept, 2008. > > It is called: > > /drivers/staging > > > > In summary, if you don't have a couple hours to make your driver to > > match Kernel Coding Style, just send it as is to /drivers/staging, c/c > > me and Greg KH, and that's it. > > PULL http://kernellabs.com/hg/~dheitmueller/v4l-dvb-80e/ > PULL http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ > > Have fun. > > The harder you make it to get code upstream, the more developers who > will just say "to hell with this". And *that* is why there are > thousands of lines of working drivers which various developers have in > out-of-tree drivers. Hi, perhaps a kind developer over at devel@driverdev could extract patches for staging out of the above mercurial repositories, and then folks can work on mainline inclusion. (Somebody who actually has such a device might be most motivated to do it.) No need to get angry that it hasn't happened yet. :-) It's just a matter of the right people joining the effort at the right time. Thanks Devin for the offer, -- Stefan Richter -=====-==-== =--= ==-== http://arcgraph.de/sr/ ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Staging submission: PCTV 80e and PCTV 74e drivers (was Re: Problems cloning the git repostories) 2011-09-27 7:44 ` Staging submission: PCTV 80e and PCTV 74e drivers (was Re: Problems cloning the git repostories) Stefan Richter @ 2011-09-27 17:43 ` Greg KH 2011-09-27 19:33 ` Stefan Richter 0 siblings, 1 reply; 91+ messages in thread From: Greg KH @ 2011-09-27 17:43 UTC (permalink / raw) To: Stefan Richter, Devin Heitmueller Cc: Mauro Carvalho Chehab, Patrick Dickey, LMML, devel On Tue, Sep 27, 2011 at 09:44:09AM +0200, Stefan Richter wrote: > Adding Cc: staging maintainer and mailinglist. > > On Sep 26 Devin Heitmueller wrote: > > On Sun, Sep 25, 2011 at 11:25 PM, Mauro Carvalho Chehab > > <maurochehab@gmail.com> wrote: > > >> Want to see more device support upstream? Optimize the process to > > >> make it easy for the people who know the hardware and how to write the > > >> drivers to get code upstream, and leave it to the "janitors" to work > > >> out the codingstyle issues. > > > > > > The process you've just described exists already since Sept, 2008. > > > It is called: > > > /drivers/staging > > > > > > In summary, if you don't have a couple hours to make your driver to > > > match Kernel Coding Style, just send it as is to /drivers/staging, c/c > > > me and Greg KH, and that's it. > > > > PULL http://kernellabs.com/hg/~dheitmueller/v4l-dvb-80e/ > > PULL http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ I can't do that as I need some commit messages in a format we can accept (i.e. your directory structure doesn't match what we need in the kernel tree from what I can tell.) > > Have fun. > > > > The harder you make it to get code upstream, the more developers who > > will just say "to hell with this". And *that* is why there are > > thousands of lines of working drivers which various developers have in > > out-of-tree drivers. The Linux patch process is one of the easiest, and most well-documented for any open source project that I have ever seen. If you don't agree (and that's fine if you don't), any ideas on what we can do to make it better would be glady appreciated. > perhaps a kind developer over at devel@driverdev could extract patches for > staging out of the above mercurial repositories, and then folks can work > on mainline inclusion. (Somebody who actually has such a device might be > most motivated to do it.) As the drivers don't seem to be touched in way over a year, odds are the code isn't going to be able to build as-is, so it will require some changes for basic issues. And I'll glady accept patches for the staging tree. Also note that we've just created a drivers/staging/media/ tree to house lots of different v4l drivers that are being worked on in the staging tree to help coordinate this type of work better. thanks, greg k-h ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Staging submission: PCTV 80e and PCTV 74e drivers (was Re: Problems cloning the git repostories) 2011-09-27 17:43 ` Greg KH @ 2011-09-27 19:33 ` Stefan Richter 2011-10-15 20:54 ` [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup (was: Staging submission: PCTV 80e and PCTV 74e drivers) Piotr Chmura ` (2 more replies) 0 siblings, 3 replies; 91+ messages in thread From: Stefan Richter @ 2011-09-27 19:33 UTC (permalink / raw) To: Greg KH Cc: Devin Heitmueller, Mauro Carvalho Chehab, Patrick Dickey, LMML, devel On Sep 27 Greg KH wrote: > On Tue, Sep 27, 2011 at 09:44:09AM +0200, Stefan Richter wrote: > > Adding Cc: staging maintainer and mailinglist. > > > > On Sep 26 Devin Heitmueller wrote: > > > On Sun, Sep 25, 2011 at 11:25 PM, Mauro Carvalho Chehab > > > <maurochehab@gmail.com> wrote: > > > > In summary, if you don't have a couple hours to make your driver to > > > > match Kernel Coding Style, just send it as is to /drivers/staging, c/c > > > > me and Greg KH, and that's it. > > > > > > PULL http://kernellabs.com/hg/~dheitmueller/v4l-dvb-80e/ > > > PULL http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ > > I can't do that as I need some commit messages in a format we can accept > (i.e. your directory structure doesn't match what we need in the kernel > tree from what I can tell.) [...] > As the drivers don't seem to be touched in way over a year, odds are the > code isn't going to be able to build as-is, so it will require some > changes for basic issues. > > And I'll glady accept patches for the staging tree. Also note that > we've just created a drivers/staging/media/ tree to house lots of > different v4l drivers that are being worked on in the staging tree to > help coordinate this type of work better. The conversion into patches with proper changelog, fitting directory structure, and basic build-ability in current staging is exactly the first step for which a volunteer is sought (next would then be the cleanup associated with staging->mainline transition); Devin noted that he is not going to dedicate time for these types of tasks. (I for one also won't; still got plenty to do in some other drivers...) -- Stefan Richter -=====-==-== =--= ==-== http://arcgraph.de/sr/ ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup (was: Staging submission: PCTV 80e and PCTV 74e drivers) 2011-09-27 19:33 ` Stefan Richter @ 2011-10-15 20:54 ` Piotr Chmura 2011-10-17 22:31 ` Greg KH [not found] ` <4E9992F9.7000101@poczta.onet.pl> [not found] ` <4E999733.2010802@poczta.onet.pl> 2 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-15 20:54 UTC (permalink / raw) To: Stefan Richter Cc: Greg KH, Devin Heitmueller, Mauro Carvalho Chehab, Patrick Dickey, LMML, devel [PATCH 1/7] pull as102 driver fromhttp://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ with the only change needed to compile it in git tree[1]: usb_buffer_alloc() to usb_alloc_coherent() and usb_buffer_free() to usb_free_coherent() [PATCH 2/7] as102: add new device nBox DVB-T Dongle adds new device working on this driver Next patches i made basing on Mauro Carvalho Chehab comments from previous pull try [2]. [PATCH 3/7] as102: cleanup - get rid off typedefs [PATCH 4/7] as102: cleanup - formatting code [PATCH 5/7] as102: cleanup - set __attribute__(packed) instead of pragma(pack) [PATCH 6/7] as102: cleanup - delete vim comments [PATCH 7/7] as102: cleanup - get rid of unnecessary defines (WIN32, LINUX) [1] git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git kernel-3.1.0-git9+ [2] http://www.spinics.net/lists/linux-media/msg16723.html W dniu 27.09.2011 21:33, Stefan Richter pisze: > On Sep 27 Greg KH wrote: >> On Tue, Sep 27, 2011 at 09:44:09AM +0200, Stefan Richter wrote: >>> Adding Cc: staging maintainer and mailinglist. >>> >>> On Sep 26 Devin Heitmueller wrote: >>>> On Sun, Sep 25, 2011 at 11:25 PM, Mauro Carvalho Chehab >>>> <maurochehab@gmail.com> wrote: >>>>> In summary, if you don't have a couple hours to make your driver to >>>>> match Kernel Coding Style, just send it as is to /drivers/staging, c/c >>>>> me and Greg KH, and that's it. >>>> PULLhttp://kernellabs.com/hg/~dheitmueller/v4l-dvb-80e/ >>>> PULLhttp://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ >> I can't do that as I need some commit messages in a format we can accept >> (i.e. your directory structure doesn't match what we need in the kernel >> tree from what I can tell.) > [...] >> As the drivers don't seem to be touched in way over a year, odds are the >> code isn't going to be able to build as-is, so it will require some >> changes for basic issues. >> >> And I'll glady accept patches for the staging tree. Also note that >> we've just created a drivers/staging/media/ tree to house lots of >> different v4l drivers that are being worked on in the staging tree to >> help coordinate this type of work better. > The conversion into patches with proper changelog, fitting directory > structure, and basic build-ability in current staging is exactly > the first step for which a volunteer is sought (next would then be the > cleanup associated with staging->mainline transition); Devin noted that he > is not going to dedicate time for these types of tasks. (I for one also > won't; still got plenty to do in some other drivers...) ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup (was: Staging submission: PCTV 80e and PCTV 74e drivers) 2011-10-15 20:54 ` [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup (was: Staging submission: PCTV 80e and PCTV 74e drivers) Piotr Chmura @ 2011-10-17 22:31 ` Greg KH 2011-10-19 12:36 ` Staging questions: WAS Re: [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup Patrick Dickey 0 siblings, 1 reply; 91+ messages in thread From: Greg KH @ 2011-10-17 22:31 UTC (permalink / raw) To: Piotr Chmura Cc: Stefan Richter, Greg KH, Devin Heitmueller, Mauro Carvalho Chehab, Patrick Dickey, LMML, devel On Sat, Oct 15, 2011 at 10:54:14PM +0200, Piotr Chmura wrote: > [PATCH 1/7] pull as102 driver fromhttp://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ > with the only change needed to compile it in git tree[1]: usb_buffer_alloc() > to usb_alloc_coherent() and usb_buffer_free() to usb_free_coherent() > > [PATCH 2/7] as102: add new device nBox DVB-T Dongle > adds new device working on this driver > > > Next patches i made basing on Mauro Carvalho Chehab comments from previous pull try [2]. > > [PATCH 3/7] as102: cleanup - get rid off typedefs > [PATCH 4/7] as102: cleanup - formatting code > [PATCH 5/7] as102: cleanup - set __attribute__(packed) instead of pragma(pack) > [PATCH 6/7] as102: cleanup - delete vim comments > [PATCH 7/7] as102: cleanup - get rid of unnecessary defines (WIN32, LINUX) Mauro, care to take these and move them under your newly-created drivers/staging/media/ directory? thanks, greg k-h ^ permalink raw reply [flat|nested] 91+ messages in thread
* Staging questions: WAS Re: [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup 2011-10-17 22:31 ` Greg KH @ 2011-10-19 12:36 ` Patrick Dickey 2011-10-19 13:57 ` Devin Heitmueller 0 siblings, 1 reply; 91+ messages in thread From: Patrick Dickey @ 2011-10-19 12:36 UTC (permalink / raw) To: LMML I'm posting this question under this thread because the subject pertains to the question (in that I'm asking about staging and about the PCTV 80e drivers). I started cleaning up the drx39xx* drivers for the PCTV-80e and have them in a github repository. Ultimately I want to send a pull request, so other people can finish the cleaning (as I'm not comfortable with pulling out the #ifdef statements myself). So my questions are these: 1. If I move the drx39xx* and associated files into the staging directory (staging/media/dvb/frontends to be exact), do I simply need to point to staging/filename for any #include statements (specifically in the em28xx-dvb.c and em28xx-cards.c files), or do I need to do something else? 2. In the Makefile for the frontends, I have the commands to make the drivers for the drx39xx* files. Do I need to point those to the staging/ directory as well, or do I need to create Makefiles in that directory for these files? I ask this because on my system, I wasn't able to "make" the files when they were in a subdirectory of frontends. I actually had to move them to the frontends directory and transfer the commands from the Makefile in the subdirectory to the frontends Makefile. 3. If I submit a pull request as is right now (where these files will go into the linux/drivers/media/dvb/frontends directory and the em28xx-* files will point to those files), will they be pulled in, and someone will help me to get them in the right places? Or do I need to move them to staging, reconfigure everything, and then submit the pull request? Thank you for any help and information, and have a great day:) Patrick. On 10/17/2011 05:31 PM, Greg KH wrote: > On Sat, Oct 15, 2011 at 10:54:14PM +0200, Piotr Chmura wrote: >> [PATCH 1/7] pull as102 driver fromhttp://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ >> with the only change needed to compile it in git tree[1]: usb_buffer_alloc() >> to usb_alloc_coherent() and usb_buffer_free() to usb_free_coherent() >> >> [PATCH 2/7] as102: add new device nBox DVB-T Dongle >> adds new device working on this driver >> >> >> Next patches i made basing on Mauro Carvalho Chehab comments from previous pull try [2]. >> >> [PATCH 3/7] as102: cleanup - get rid off typedefs >> [PATCH 4/7] as102: cleanup - formatting code >> [PATCH 5/7] as102: cleanup - set __attribute__(packed) instead of pragma(pack) >> [PATCH 6/7] as102: cleanup - delete vim comments >> [PATCH 7/7] as102: cleanup - get rid of unnecessary defines (WIN32, LINUX) > > Mauro, care to take these and move them under your newly-created > drivers/staging/media/ directory? > > thanks, > > greg k-h ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Staging questions: WAS Re: [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup 2011-10-19 12:36 ` Staging questions: WAS Re: [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup Patrick Dickey @ 2011-10-19 13:57 ` Devin Heitmueller 2011-10-20 3:44 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 91+ messages in thread From: Devin Heitmueller @ 2011-10-19 13:57 UTC (permalink / raw) To: Patrick Dickey; +Cc: LMML, Mauro Carvalho Chehab Hi Patrick, On Wed, Oct 19, 2011 at 8:36 AM, Patrick Dickey <pdickeybeta@gmail.com> wrote: > I'm posting this question under this thread because the subject pertains > to the question (in that I'm asking about staging and about the PCTV 80e > drivers). You should definitely be looking at the "as102" thread that is currently going on this mailing list. Piotr is actually going through the same process as you are (he is working on upstreaming the as102 driver from a kernellabs.com tree). He made some pretty common mistakes (all perfectly understandable), and your reading the thread might help you avoid them (and having to redo your patch series). > I started cleaning up the drx39xx* drivers for the PCTV-80e and have > them in a github repository. Ultimately I want to send a pull request, > so other people can finish the cleaning (as I'm not comfortable with > pulling out the #ifdef statements myself). You should definitely ask Mauro how he expects to do a staging driver for a demodulator before you do any further work. The staging tree works well for bridge drivers, but demod drivers such as the drx require code in the bridge driver (the em28xx in this case), so it's not clear how you would do staging for a product where the bridge driver isn't in staging as well. The answer to that question will likely guide you in how to get the driver into staging. If you have specific questions regarding anything you see in the driver, let me know. I don't have much time nowadays but will find the time if you ask concise questions. Good luck. It will be great to finally see this merged upstream. Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Staging questions: WAS Re: [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup 2011-10-19 13:57 ` Devin Heitmueller @ 2011-10-20 3:44 ` Mauro Carvalho Chehab 2011-10-20 10:53 ` Patrick Dickey 0 siblings, 1 reply; 91+ messages in thread From: Mauro Carvalho Chehab @ 2011-10-20 3:44 UTC (permalink / raw) To: Devin Heitmueller; +Cc: Patrick Dickey, LMML Em 19-10-2011 11:57, Devin Heitmueller escreveu: > Hi Patrick, > > On Wed, Oct 19, 2011 at 8:36 AM, Patrick Dickey <pdickeybeta@gmail.com> wrote: >> I'm posting this question under this thread because the subject pertains >> to the question (in that I'm asking about staging and about the PCTV 80e >> drivers). > > You should definitely be looking at the "as102" thread that is > currently going on this mailing list. Piotr is actually going through > the same process as you are (he is working on upstreaming the as102 > driver from a kernellabs.com tree). He made some pretty common > mistakes (all perfectly understandable), and your reading the thread > might help you avoid them (and having to redo your patch series). > >> I started cleaning up the drx39xx* drivers for the PCTV-80e and have >> them in a github repository. Ultimately I want to send a pull request, >> so other people can finish the cleaning (as I'm not comfortable with >> pulling out the #ifdef statements myself). > > You should definitely ask Mauro how he expects to do a staging driver > for a demodulator before you do any further work. The staging tree > works well for bridge drivers, but demod drivers such as the drx > require code in the bridge driver (the em28xx in this case), so it's > not clear how you would do staging for a product where the bridge > driver isn't in staging as well. The answer to that question will > likely guide you in how to get the driver into staging. Ah yes, good point. Well, just submit it as if it should be added at the right place, but putting the Kconfig changes in separate. If this driver is not that different than the other drx drivers, I may try to find some time to fix it on the same way. You may also take a look at the history for the drx-k merging patches. I basically wrote a few small perl scripts to correct coding style, and a few manual work. > > If you have specific questions regarding anything you see in the > driver, let me know. I don't have much time nowadays but will find > the time if you ask concise questions. > > Good luck. It will be great to finally see this merged upstream. > > Devin > ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Staging questions: WAS Re: [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup 2011-10-20 3:44 ` Mauro Carvalho Chehab @ 2011-10-20 10:53 ` Patrick Dickey 2011-10-20 11:22 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 91+ messages in thread From: Patrick Dickey @ 2011-10-20 10:53 UTC (permalink / raw) To: Mauro Carvalho Chehab; +Cc: Devin Heitmueller, LMML Thank you for the suggestions (both of you). I'll submit a pull request by this weekend (as I want to test it again in Ubuntu 11.10 just to make sure everything works). And for Mauro, is there a direct link to the scripts? I looked for them after the last time I emailed, but couldn't find them (or I wasn't looking in the right place). Have a great day:) Patrick. On 10/19/2011 10:44 PM, Mauro Carvalho Chehab wrote: > Em 19-10-2011 11:57, Devin Heitmueller escreveu: >> Hi Patrick, >> >> On Wed, Oct 19, 2011 at 8:36 AM, Patrick Dickey <pdickeybeta@gmail.com> wrote: >>> I'm posting this question under this thread because the subject pertains >>> to the question (in that I'm asking about staging and about the PCTV 80e >>> drivers). >> >> You should definitely be looking at the "as102" thread that is >> currently going on this mailing list. Piotr is actually going through >> the same process as you are (he is working on upstreaming the as102 >> driver from a kernellabs.com tree). He made some pretty common >> mistakes (all perfectly understandable), and your reading the thread >> might help you avoid them (and having to redo your patch series). >> >>> I started cleaning up the drx39xx* drivers for the PCTV-80e and have >>> them in a github repository. Ultimately I want to send a pull request, >>> so other people can finish the cleaning (as I'm not comfortable with >>> pulling out the #ifdef statements myself). >> >> You should definitely ask Mauro how he expects to do a staging driver >> for a demodulator before you do any further work. The staging tree >> works well for bridge drivers, but demod drivers such as the drx >> require code in the bridge driver (the em28xx in this case), so it's >> not clear how you would do staging for a product where the bridge >> driver isn't in staging as well. The answer to that question will >> likely guide you in how to get the driver into staging. > > Ah yes, good point. Well, just submit it as if it should be added at > the right place, but putting the Kconfig changes in separate. If this > driver is not that different than the other drx drivers, I may try to > find some time to fix it on the same way. > > You may also take a look at the history for the drx-k merging patches. > I basically wrote a few small perl scripts to correct coding style, and > a few manual work. > >> >> If you have specific questions regarding anything you see in the >> driver, let me know. I don't have much time nowadays but will find >> the time if you ask concise questions. >> >> Good luck. It will be great to finally see this merged upstream. >> >> Devin >> > ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Staging questions: WAS Re: [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup 2011-10-20 10:53 ` Patrick Dickey @ 2011-10-20 11:22 ` Mauro Carvalho Chehab 0 siblings, 0 replies; 91+ messages in thread From: Mauro Carvalho Chehab @ 2011-10-20 11:22 UTC (permalink / raw) To: Patrick Dickey; +Cc: Devin Heitmueller, LMML Em 20-10-2011 08:53, Patrick Dickey escreveu: > Thank you for the suggestions (both of you). I'll submit a pull request > by this weekend (as I want to test it again in Ubuntu 11.10 just to make > sure everything works). And for Mauro, is there a direct link to the > scripts? I looked for them after the last time I emailed, but couldn't > find them (or I wasn't looking in the right place). Yes, but it is not easy to navigate into it. They were added as comments at the git history. You can easily get them by using this command: $ git log drivers/media/dvb/frontends/drxk_hard.c It basically shows all changes for drxk_hard. Several of the initial changesets contain the scripts I used to produce the patches. For example, at changeset ea90f011fdcc3d4fde78532eab8af09637176765 contains one: http://git.linuxtv.org/media_tree.git/commitdiff/ea90f011fdcc3d4fde78532eab8af09637176765 That script removes the ugly CHK_ERROR macro that can hide things, as the macro contains a flow control change inside, and silently touches the status var. At the drx drivers I've cleaned up, they used to do something like: #define CHK_ERROR(s) if ((status = s) < 0) break ... int status = 0; do { CHK_ERROR(Write16_0(state, SIO_CC_PWD_MODE__A, SIO_CC_PWD_MODE_LEVEL_NONE)); ... } while (0); And, inside CHK_ERROR, there was a break if error. It is worthy to comment that checkpatch did a very well job pointing this problem: this only works well if there aren't any loop inside the do. However, I got several cases where the above weren't work as expected, as there was an extra loop inside the do/while. So, after appling the above change, I had to manually write a patch replacing the do/while logic with a goto error approach: http://git.linuxtv.org/media_tree.git/commitdiff/be44eb283b97c29b06a125cb5527b299d84315f4 So, the above were rewritten as: int status = 0; status = Write16_0(state, SIO_CC_PWD_MODE__A, SIO_CC_PWD_MODE_LEVEL_NONE); if (status < 0) goto error; ... error: return status; The end result is cleaner, easier to review, and won't contain hidden troubles due to assumption that all calls to CHK_ERROR macro would happen from a do/while logic with no extra loop inside. It should be noticed that I wrote the scripts specifically to replace the bad things I found at the drx-k driver. They are similar to the ones I wrote for drx-d, but I had to change some things, as the logic was not identical (and/or because I've improved the scripts I used for drx-d). In other words, you'll need to verify if they apply for your drx driver or not, and review the diff patch, to be sure that the patch won't break anything. At the end, you'll need to re-test the driver, as you might have added some bad things at the conversion. I hope that helps. > > Have a great day:) > Patrick. > > On 10/19/2011 10:44 PM, Mauro Carvalho Chehab wrote: >> Em 19-10-2011 11:57, Devin Heitmueller escreveu: >>> Hi Patrick, >>> >>> On Wed, Oct 19, 2011 at 8:36 AM, Patrick Dickey <pdickeybeta@gmail.com> wrote: >>>> I'm posting this question under this thread because the subject pertains >>>> to the question (in that I'm asking about staging and about the PCTV 80e >>>> drivers). >>> >>> You should definitely be looking at the "as102" thread that is >>> currently going on this mailing list. Piotr is actually going through >>> the same process as you are (he is working on upstreaming the as102 >>> driver from a kernellabs.com tree). He made some pretty common >>> mistakes (all perfectly understandable), and your reading the thread >>> might help you avoid them (and having to redo your patch series). >>> >>>> I started cleaning up the drx39xx* drivers for the PCTV-80e and have >>>> them in a github repository. Ultimately I want to send a pull request, >>>> so other people can finish the cleaning (as I'm not comfortable with >>>> pulling out the #ifdef statements myself). >>> >>> You should definitely ask Mauro how he expects to do a staging driver >>> for a demodulator before you do any further work. The staging tree >>> works well for bridge drivers, but demod drivers such as the drx >>> require code in the bridge driver (the em28xx in this case), so it's >>> not clear how you would do staging for a product where the bridge >>> driver isn't in staging as well. The answer to that question will >>> likely guide you in how to get the driver into staging. >> >> Ah yes, good point. Well, just submit it as if it should be added at >> the right place, but putting the Kconfig changes in separate. If this >> driver is not that different than the other drx drivers, I may try to >> find some time to fix it on the same way. >> >> You may also take a look at the history for the drx-k merging patches. >> I basically wrote a few small perl scripts to correct coding style, and >> a few manual work. >> >>> >>> If you have specific questions regarding anything you see in the >>> driver, let me know. I don't have much time nowadays but will find >>> the time if you ask concise questions. >>> >>> Good luck. It will be great to finally see this merged upstream. >>> >>> Devin >>> >> > ^ permalink raw reply [flat|nested] 91+ messages in thread
[parent not found: <4E9992F9.7000101@poczta.onet.pl>]
* [PATCH 2/7] staging/as102: add new device nBox DVB-T Dongle [not found] ` <4E9992F9.7000101@poczta.onet.pl> @ 2011-10-15 20:54 ` Piotr Chmura 2011-10-15 20:54 ` [PATCH 3/7] staging/as102: cleanup - get rid of typedefs Piotr Chmura ` (2 subsequent siblings) 3 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-15 20:54 UTC (permalink / raw) To: Stefan Richter Cc: Greg KH, Devin Heitmueller, Mauro Carvalho Chehab, Patrick Dickey, LMML, devel staging/as102: add new device nBox DVB-T Dongle Add nBox DVB-T Dongle tuner based on 74e chip. Tested by me on amd64. Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> Cc: Devin Heitmueller<dheitmueller@kernellabs.com> Cc: Greg HK<gregkh@suse.de> diff -Nur linux.as102.01-initial/drivers/staging/as102/as102_usb_drv.c linux.as102.02-nbox/drivers/staging/as102/as102_usb_drv.c --- linux.as102.01-initial/drivers/staging/as102/as102_usb_drv.c 2011-10-14 18:00:19.000000000 +0200 +++ linux.as102.02-nbox/drivers/staging/as102/as102_usb_drv.c 2011-10-14 18:21:36.000000000 +0200 @@ -41,6 +41,7 @@ { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) }, { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) }, { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) }, + { USB_DEVICE(NBOX_DVBT_DONGLE_USB_VID, NBOX_DVBT_DONGLE_USB_PID) }, { } /* Terminating entry */ }; @@ -50,6 +51,7 @@ AS102_REFERENCE_DESIGN, AS102_PCTV_74E, AS102_ELGATO_EYETV_DTT_NAME, + AS102_NBOX_DVBT_DONGLE_NAME, NULL /* Terminating entry */ }; diff -Nur linux.as102.01-initial/drivers/staging/as102/as102_usb_drv.h linux.as102.02-nbox/drivers/staging/as102/as102_usb_drv.h --- linux.as102.01-initial/drivers/staging/as102/as102_usb_drv.h 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.02-nbox/drivers/staging/as102/as102_usb_drv.h 2011-10-14 18:20:32.000000000 +0200 @@ -42,6 +42,11 @@ #define ELGATO_EYETV_DTT_USB_VID 0x0fd9 #define ELGATO_EYETV_DTT_USB_PID 0x002c +/* nBox: nBox DVB-T Dongle */ +#define AS102_NBOX_DVBT_DONGLE_NAME "nBox DVB-T Dongle" +#define NBOX_DVBT_DONGLE_USB_VID 0x0b89 +#define NBOX_DVBT_DONGLE_USB_PID 0x0007 + #if (LINUX_VERSION_CODE<= KERNEL_VERSION(2, 6, 18)) void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs); #else ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 3/7] staging/as102: cleanup - get rid of typedefs [not found] ` <4E9992F9.7000101@poczta.onet.pl> 2011-10-15 20:54 ` [PATCH 2/7] staging/as102: add new device nBox DVB-T Dongle Piotr Chmura @ 2011-10-15 20:54 ` Piotr Chmura 2011-10-15 20:54 ` [PATCH 4/7] staging/as102: cleanup - formatting code Piotr Chmura 2011-10-15 20:54 ` [PATCH 5/7] staging as102: cleanup - get rid of pragma(pack) Piotr Chmura 3 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-15 20:54 UTC (permalink / raw) To: Stefan Richter Cc: Greg KH, Devin Heitmueller, Mauro Carvalho Chehab, Patrick Dickey, LMML, devel staging as102: cleanup - get rid off typedefs Cleanup code: get rid of typedef in structures and union definitions. Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> Cc: Devin Heitmueller<dheitmueller@kernellabs.com> Cc: Greg HK<gregkh@suse.de> diff -Nur linux.as102.02-nbox/drivers/staging/as102/as10x_cmd.h linux.as102.03-typedefs/drivers/staging/as102/as10x_cmd.h --- linux.as102.02-nbox/drivers/staging/as102/as10x_cmd.h 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.03-typedefs/drivers/staging/as102/as10x_cmd.h 2011-10-14 18:48:39.000000000 +0200 @@ -52,7 +52,7 @@ /*********************************/ /* TYPE DEFINITION */ /*********************************/ -typedef enum { +enum control_proc { CONTROL_PROC_TURNON = 0x0001, CONTROL_PROC_TURNON_RSP = 0x0100, CONTROL_PROC_SET_REGISTER = 0x0002, @@ -92,11 +92,11 @@ CONTROL_PROC_DUMPLOG_MEMORY_RSP = 0xFE00, CONTROL_PROC_TURNOFF = 0x00FF, CONTROL_PROC_TURNOFF_RSP = 0xFF00 -} control_proc; +}; #pragma pack(1) -typedef union { +union TURN_ON { /* request */ struct { /* request identifier */ @@ -109,9 +109,9 @@ /* error */ uint8_t error; } rsp; -} TURN_ON; +}; -typedef union { +union TURN_OFF { /* request */ struct { /* request identifier */ @@ -124,9 +124,9 @@ /* error */ uint8_t err; } rsp; -} TURN_OFF; +}; -typedef union { +union SET_TUNE { /* request */ struct { /* request identifier */ @@ -141,9 +141,9 @@ /* response error */ uint8_t error; } rsp; -} SET_TUNE; +}; -typedef union { +union GET_TUNE_STATUS { /* request */ struct { /* request identifier */ @@ -158,9 +158,9 @@ /* tune status */ struct as10x_tune_status sts; } rsp; -} GET_TUNE_STATUS; +}; -typedef union { +union GET_TPS { /* request */ struct { /* request identifier */ @@ -175,9 +175,9 @@ /* tps details */ struct as10x_tps tps; } rsp; -} GET_TPS; +}; -typedef union { +union COMMON { /* request */ struct { /* request identifier */ @@ -190,9 +190,9 @@ /* response error */ uint8_t error; } rsp; -} COMMON; +}; -typedef union { +union ADD_PID_FILTER { /* request */ struct { /* request identifier */ @@ -213,9 +213,9 @@ /* Filter id */ uint8_t filter_id; } rsp; -} ADD_PID_FILTER; +}; -typedef union { +union DEL_PID_FILTER { /* request */ struct { /* request identifier */ @@ -230,9 +230,9 @@ /* response error */ uint8_t error; } rsp; -} DEL_PID_FILTER; +}; -typedef union { +union START_STREAMING { /* request */ struct { /* request identifier */ @@ -245,9 +245,9 @@ /* error */ uint8_t error; } rsp; -} START_STREAMING; +}; -typedef union { +union STOP_STREAMING { /* request */ struct { /* request identifier */ @@ -260,9 +260,9 @@ /* error */ uint8_t error; } rsp; -} STOP_STREAMING; +}; -typedef union { +union GET_DEMOD_STATS { /* request */ struct { /* request identifier */ @@ -277,9 +277,9 @@ /* demod stats */ struct as10x_demod_stats stats; } rsp; -} GET_DEMOD_STATS; +}; -typedef union { +union GET_IMPULSE_RESP { /* request */ struct { /* request identifier */ @@ -294,9 +294,9 @@ /* impulse response ready */ uint8_t is_ready; } rsp; -} GET_IMPULSE_RESP; +}; -typedef union { +union FW_CONTEXT { /* request */ struct { /* request identifier */ @@ -319,9 +319,9 @@ /* error */ uint8_t error; } rsp; -} FW_CONTEXT; +}; -typedef union { +union SET_REGISTER { /* request */ struct { /* response identifier */ @@ -338,9 +338,9 @@ /* error */ uint8_t error; } rsp; -} SET_REGISTER; +}; -typedef union { +union GET_REGISTER { /* request */ struct { /* response identifier */ @@ -357,9 +357,9 @@ /* register content */ struct as10x_register_value reg_val; } rsp; -} GET_REGISTER; +}; -typedef union { +union CFG_CHANGE_MODE { /* request */ struct { /* request identifier */ @@ -374,7 +374,7 @@ /* error */ uint8_t error; } rsp; -} CFG_CHANGE_MODE; +}; struct as10x_cmd_header_t { uint16_t req_id; @@ -384,7 +384,7 @@ }; #define DUMP_BLOCK_SIZE 16 -typedef union { +union DUMP_MEMORY { /* request */ struct { /* request identifier */ @@ -411,9 +411,9 @@ uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)]; } u; } rsp; -} DUMP_MEMORY; +}; -typedef union { +union DUMPLOG_MEMORY { struct { /* request identifier */ uint16_t proc_id; @@ -430,9 +430,9 @@ /* dump data */ uint8_t data[DUMP_BLOCK_SIZE]; } rsp; -} DUMPLOG_MEMORY; +}; -typedef union { +union RAW_DATA { /* request */ struct { uint16_t proc_id; @@ -445,32 +445,32 @@ uint8_t data[64 - sizeof(struct as10x_cmd_header_t) /* header */ - 2 /* proc_id */ - 1 /* rc */]; } rsp; -} RAW_DATA; +}; struct as10x_cmd_t { /* header */ struct as10x_cmd_header_t header; /* body */ union { - TURN_ON turn_on; - TURN_OFF turn_off; - SET_TUNE set_tune; - GET_TUNE_STATUS get_tune_status; - GET_TPS get_tps; - COMMON common; - ADD_PID_FILTER add_pid_filter; - DEL_PID_FILTER del_pid_filter; - START_STREAMING start_streaming; - STOP_STREAMING stop_streaming; - GET_DEMOD_STATS get_demod_stats; - GET_IMPULSE_RESP get_impulse_rsp; - FW_CONTEXT context; - SET_REGISTER set_register; - GET_REGISTER get_register; - CFG_CHANGE_MODE cfg_change_mode; - DUMP_MEMORY dump_memory; - DUMPLOG_MEMORY dumplog_memory; - RAW_DATA raw_data; + union TURN_ON turn_on; + union TURN_OFF turn_off; + union SET_TUNE set_tune; + union GET_TUNE_STATUS get_tune_status; + union GET_TPS get_tps; + union COMMON common; + union ADD_PID_FILTER add_pid_filter; + union DEL_PID_FILTER del_pid_filter; + union START_STREAMING start_streaming; + union STOP_STREAMING stop_streaming; + union GET_DEMOD_STATS get_demod_stats; + union GET_IMPULSE_RESP get_impulse_rsp; + union FW_CONTEXT context; + union SET_REGISTER set_register; + union GET_REGISTER get_register; + union CFG_CHANGE_MODE cfg_change_mode; + union DUMP_MEMORY dump_memory; + union DUMPLOG_MEMORY dumplog_memory; + union RAW_DATA raw_data; } body; }; ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 4/7] staging/as102: cleanup - formatting code [not found] ` <4E9992F9.7000101@poczta.onet.pl> 2011-10-15 20:54 ` [PATCH 2/7] staging/as102: add new device nBox DVB-T Dongle Piotr Chmura 2011-10-15 20:54 ` [PATCH 3/7] staging/as102: cleanup - get rid of typedefs Piotr Chmura @ 2011-10-15 20:54 ` Piotr Chmura 2011-10-16 12:23 ` Julian Andres Klode 2011-10-15 20:54 ` [PATCH 5/7] staging as102: cleanup - get rid of pragma(pack) Piotr Chmura 3 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-15 20:54 UTC (permalink / raw) To: Stefan Richter Cc: Greg KH, Devin Heitmueller, Mauro Carvalho Chehab, Patrick Dickey, LMML, devel staging as102: cleanup - formatting code Cleanup code: change double spaces into single, put tabs instead of spaces where they should be. Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> Cc: Devin Heitmueller<dheitmueller@kernellabs.com> Cc: Greg HK<gregkh@suse.de> diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as102_drv.c linux.as102.04-tabs/drivers/staging/as102/as102_drv.c --- linux.as102.03-typedefs/drivers/staging/as102/as102_drv.c 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.04-tabs/drivers/staging/as102/as102_drv.c 2011-10-14 23:20:05.000000000 +0200 @@ -10,7 +10,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -115,7 +115,7 @@ } static int as10x_pid_filter(struct as102_dev_t *dev, - int index, u16 pid, int onoff) { + int index, u16 pid, int onoff) { struct as102_bus_adapter_t *bus_adap =&dev->bus_adap; int ret = -EFAULT; @@ -129,22 +129,22 @@ switch (onoff) { case 0: - ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) pid); - dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = %d\n", - index, pid, ret); - break; + ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) pid); + dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = %d\n", + index, pid, ret); + break; case 1: { - struct as10x_ts_filter filter; + struct as10x_ts_filter filter; - filter.type = TS_PID_TYPE_TS; - filter.idx = 0xFF; - filter.pid = pid; - - ret = as10x_cmd_add_PID_filter(bus_adap,&filter); - dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n", - index, filter.idx, filter.pid, ret); - break; + filter.type = TS_PID_TYPE_TS; + filter.idx = 0xFF; + filter.pid = pid; + + ret = as10x_cmd_add_PID_filter(bus_adap,&filter); + dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n", + index, filter.idx, filter.pid, ret); + break; } } @@ -209,22 +209,22 @@ #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) ret = dvb_register_adapter(&as102_dev->dvb_adap, - as102_dev->name, - THIS_MODULE, + as102_dev->name, + THIS_MODULE, #if defined(CONFIG_AS102_USB) - &as102_dev->bus_adap.usb_dev->dev + &as102_dev->bus_adap.usb_dev->dev #elif defined(CONFIG_AS102_SPI) - &as102_dev->bus_adap.spi_dev->dev + &as102_dev->bus_adap.spi_dev->dev #else #error>>> dvb_register_adapter<<< #endif #ifdef DVB_DEFINE_MOD_OPT_ADAPTER_NR - , adapter_nr + , adapter_nr #endif - ); + ); if (ret< 0) { err("%s: dvb_register_adapter() failed (errno = %d)", - __func__, ret); + __func__, ret); goto failed; } @@ -235,7 +235,7 @@ as102_dev->dvb_dmx.stop_feed = as102_dvb_dmx_stop_feed; as102_dev->dvb_dmx.dmx.capabilities = DMX_TS_FILTERING | - DMX_SECTION_FILTERING; + DMX_SECTION_FILTERING; as102_dev->dvb_dmxdev.filternum = as102_dev->dvb_dmx.filternum; as102_dev->dvb_dmxdev.demux =&as102_dev->dvb_dmx.dmx; @@ -250,14 +250,14 @@ ret = dvb_dmxdev_init(&as102_dev->dvb_dmxdev,&as102_dev->dvb_adap); if (ret< 0) { err("%s: dvb_dmxdev_init() failed (errno = %d)", __func__, - ret); + ret); goto failed; } ret = as102_dvb_register_fe(as102_dev,&as102_dev->dvb_fe); if (ret< 0) { err("%s: as102_dvb_register_frontend() failed (errno = %d)", - __func__, ret); + __func__, ret); goto failed; } #endif @@ -278,7 +278,7 @@ "firmware_class"); #endif -failed: + failed: LEAVE(); /* FIXME: free dvb_XXX */ return ret; @@ -332,7 +332,7 @@ /** * \brief as102 driver exit point. This function is called when device has - * to be removed. + * to be removed. */ static void __exit as102_driver_exit(void) { diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as102_drv.h linux.as102.04-tabs/drivers/staging/as102/as102_drv.h --- linux.as102.03-typedefs/drivers/staging/as102/as102_drv.h 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.04-tabs/drivers/staging/as102/as102_drv.h 2011-10-14 22:21:58.000000000 +0200 @@ -9,7 +9,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -48,8 +48,8 @@ } } while (0) #ifdef TRACE -#define ENTER() printk(">> enter %s\n", __FUNCTION__) -#define LEAVE() printk("<< leave %s\n", __FUNCTION__) +#define ENTER() printk(">> enter %s\n", __FUNCTION__) +#define LEAVE() printk("<< leave %s\n", __FUNCTION__) #else #define ENTER() #define LEAVE() diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as102_fe.c linux.as102.04-tabs/drivers/staging/as102/as102_fe.c --- linux.as102.03-typedefs/drivers/staging/as102/as102_fe.c 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.04-tabs/drivers/staging/as102/as102_fe.c 2011-10-14 23:21:51.000000000 +0200 @@ -10,7 +10,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -27,10 +27,10 @@ #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst, - struct as10x_tps *src); + struct as10x_tps *src); static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst, - struct dvb_frontend_parameters *src); + struct dvb_frontend_parameters *src); #if (LINUX_VERSION_CODE< KERNEL_VERSION(2, 6, 19)) static void as102_fe_release(struct dvb_frontend *fe) @@ -60,7 +60,7 @@ dev->ber = -1; /* reset tuner private data */ -/* fe->tuner_priv = NULL; */ + /* fe->tuner_priv = NULL; */ LEAVE(); } @@ -93,7 +93,7 @@ #endif static int as102_fe_set_frontend(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) + struct dvb_frontend_parameters *params) { int ret = 0; struct as102_dev_t *dev; @@ -111,7 +111,7 @@ as102_fe_copy_tune_parameters(&tune_args, params); /* send abilis command: SET_TUNE */ - ret = as10x_cmd_set_tune(&dev->bus_adap,&tune_args); + ret = as10x_cmd_set_tune(&dev->bus_adap,&tune_args); if (ret != 0) dprintk(debug, "as10x_cmd_set_tune failed. (err = %d)\n", ret); @@ -122,7 +122,7 @@ } static int as102_fe_get_frontend(struct dvb_frontend *fe, - struct dvb_frontend_parameters *p) { + struct dvb_frontend_parameters *p) { int ret = 0; struct as102_dev_t *dev; struct as10x_tps tps = { 0 }; @@ -149,14 +149,14 @@ } static int as102_fe_get_tune_settings(struct dvb_frontend *fe, - struct dvb_frontend_tune_settings *settings) { + struct dvb_frontend_tune_settings *settings) { ENTER(); #if 0 dprintk(debug, "step_size = %d\n", settings->step_size); dprintk(debug, "max_drift = %d\n", settings->max_drift); dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms, - 1000); + 1000); #endif settings->min_delay_ms = 1000; @@ -185,12 +185,12 @@ ret = as10x_cmd_get_tune_status(&dev->bus_adap,&tstate); if (ret< 0) { dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n", - ret); + ret); goto out; } - dev->signal_strength = tstate.signal_strength; - dev->ber = tstate.BER; + dev->signal_strength = tstate.signal_strength; + dev->ber = tstate.BER; switch (tstate.tune_state) { case TUNE_STATUS_SIGNAL_DVB_OK: @@ -201,7 +201,7 @@ break; case TUNE_STATUS_STREAM_TUNED: *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC | - FE_HAS_LOCK; + FE_HAS_LOCK; break; default: *status = TUNE_STATUS_NOT_TUNED; @@ -213,24 +213,24 @@ if (*status& FE_HAS_LOCK) { if (as10x_cmd_get_demod_stats(&dev->bus_adap, - (struct as10x_demod_stats *)&dev->demod_stats)< 0) { + (struct as10x_demod_stats *)&dev->demod_stats)< 0) { memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); dprintk(debug, "as10x_cmd_get_demod_stats failed " - "(probably not tuned)\n"); + "(probably not tuned)\n"); } else { dprintk(debug, - "demod status: fc: 0x%08x, bad fc: 0x%08x, " - "bytes corrected: 0x%08x , MER: 0x%04x\n", - dev->demod_stats.frame_count, - dev->demod_stats.bad_frame_count, - dev->demod_stats.bytes_fixed_by_rs, - dev->demod_stats.mer); + "demod status: fc: 0x%08x, bad fc: 0x%08x, " + "bytes corrected: 0x%08x , MER: 0x%04x\n", + dev->demod_stats.frame_count, + dev->demod_stats.bad_frame_count, + dev->demod_stats.bytes_fixed_by_rs, + dev->demod_stats.mer); } } else { memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); } -out: + out: mutex_unlock(&dev->bus_adap.lock); LEAVE(); return ret; @@ -239,9 +239,9 @@ /* * Note: * - in AS102 SNR=MER - * - the SNR will be returned in linear terms, i.e. not in dB - * - the accuracy equals ±2dB for a SNR range from 4dB to 30dB - * - the accuracy is>2dB for SNR values outside this range + * - the SNR will be returned in linear terms, i.e. not in dB + * - the accuracy equals ±2dB for a SNR range from 4dB to 30dB + * - the accuracy is>2dB for SNR values outside this range */ static int as102_fe_read_snr(struct dvb_frontend *fe, u16 *snr) { @@ -276,7 +276,7 @@ } static int as102_fe_read_signal_strength(struct dvb_frontend *fe, - u16 *strength) + u16 *strength) { struct as102_dev_t *dev; @@ -343,40 +343,40 @@ #endif static struct dvb_frontend_ops as102_fe_ops = { - .info = { - .name = "Unknown AS102 device", - .type = FE_OFDM, - .frequency_min = 174000000, - .frequency_max = 862000000, - .frequency_stepsize = 166667, - .caps = FE_CAN_INVERSION_AUTO - | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 - | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO - | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QPSK - | FE_CAN_QAM_AUTO - | FE_CAN_TRANSMISSION_MODE_AUTO - | FE_CAN_GUARD_INTERVAL_AUTO - | FE_CAN_HIERARCHY_AUTO - | FE_CAN_RECOVER - | FE_CAN_MUTE_TS - }, - - .set_frontend = as102_fe_set_frontend, - .get_frontend = as102_fe_get_frontend, - .get_tune_settings = as102_fe_get_tune_settings, - - - .read_status = as102_fe_read_status, - .read_snr = as102_fe_read_snr, - .read_ber = as102_fe_read_ber, - .read_signal_strength = as102_fe_read_signal_strength, - .read_ucblocks = as102_fe_read_ucblocks, + .info = { + .name = "Unknown AS102 device", + .type = FE_OFDM, + .frequency_min = 174000000, + .frequency_max = 862000000, + .frequency_stepsize = 166667, + .caps = FE_CAN_INVERSION_AUTO + | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 + | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO + | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QPSK + | FE_CAN_QAM_AUTO + | FE_CAN_TRANSMISSION_MODE_AUTO + | FE_CAN_GUARD_INTERVAL_AUTO + | FE_CAN_HIERARCHY_AUTO + | FE_CAN_RECOVER + | FE_CAN_MUTE_TS + }, + + .set_frontend = as102_fe_set_frontend, + .get_frontend = as102_fe_get_frontend, + .get_tune_settings = as102_fe_get_tune_settings, + + + .read_status = as102_fe_read_status, + .read_snr = as102_fe_read_snr, + .read_ber = as102_fe_read_ber, + .read_signal_strength = as102_fe_read_signal_strength, + .read_ucblocks = as102_fe_read_ucblocks, #if (LINUX_VERSION_CODE>= KERNEL_VERSION(2, 6, 19)) - .ts_bus_ctrl = as102_fe_ts_bus_ctrl, + .ts_bus_ctrl = as102_fe_ts_bus_ctrl, #else - .release = as102_fe_release, - .init = as102_fe_init, + .release = as102_fe_release, + .init = as102_fe_init, #endif }; @@ -393,7 +393,7 @@ } int as102_dvb_register_fe(struct as102_dev_t *as102_dev, - struct dvb_frontend *dvb_fe) + struct dvb_frontend *dvb_fe) { int errno; struct dvb_adapter *dvb_adap; @@ -407,7 +407,7 @@ /* init frontend callback ops */ memcpy(&dvb_fe->ops,&as102_fe_ops, sizeof(struct dvb_frontend_ops)); strncpy(dvb_fe->ops.info.name, as102_dev->name, - sizeof(dvb_fe->ops.info.name)); + sizeof(dvb_fe->ops.info.name)); /* register dbvb frontend */ errno = dvb_register_frontend(dvb_adap, dvb_fe); @@ -418,7 +418,7 @@ } static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst, - struct as10x_tps *as10x_tps) + struct as10x_tps *as10x_tps) { struct dvb_ofdm_parameters *fe_tps =&dst->u.ofdm; @@ -546,7 +546,7 @@ } static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args, - struct dvb_frontend_parameters *params) + struct dvb_frontend_parameters *params) { /* set frequency */ @@ -642,32 +642,32 @@ * if HP/LP are both set to FEC_NONE, HP will be selected. */ if ((tune_args->hierarchy != HIER_NONE)&& - ((params->u.ofdm.code_rate_LP == FEC_NONE) || - (params->u.ofdm.code_rate_HP == FEC_NONE))) { + ((params->u.ofdm.code_rate_LP == FEC_NONE) || + (params->u.ofdm.code_rate_HP == FEC_NONE))) { if (params->u.ofdm.code_rate_LP == FEC_NONE) { tune_args->hier_select = HIER_HIGH_PRIORITY; tune_args->code_rate = - as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); + as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); } if (params->u.ofdm.code_rate_HP == FEC_NONE) { tune_args->hier_select = HIER_LOW_PRIORITY; tune_args->code_rate = - as102_fe_get_code_rate(params->u.ofdm.code_rate_LP); + as102_fe_get_code_rate(params->u.ofdm.code_rate_LP); } dprintk(debug, "\thierarchy: 0x%02x " "selected: %s code_rate_%s: 0x%02x\n", - tune_args->hierarchy, - tune_args->hier_select == HIER_HIGH_PRIORITY ? - "HP" : "LP", - tune_args->hier_select == HIER_HIGH_PRIORITY ? - "HP" : "LP", - tune_args->code_rate); + tune_args->hierarchy, + tune_args->hier_select == HIER_HIGH_PRIORITY ? + "HP" : "LP", + tune_args->hier_select == HIER_HIGH_PRIORITY ? + "HP" : "LP", + tune_args->code_rate); } else { tune_args->code_rate = - as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); + as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); } } #endif diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as102_fw.c linux.as102.04-tabs/drivers/staging/as102/as102_fw.c --- linux.as102.03-typedefs/drivers/staging/as102/as102_fw.c 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.04-tabs/drivers/staging/as102/as102_fw.c 2011-10-14 23:22:33.000000000 +0200 @@ -10,7 +10,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -52,8 +52,8 @@ * Parse INTEL HEX firmware file to extract address and data. */ static int parse_hex_line(unsigned char *fw_data, unsigned char *addr, - unsigned char *data, int *dataLength, - unsigned char *addr_has_changed) { + unsigned char *data, int *dataLength, + unsigned char *addr_has_changed) { int count = 0; unsigned char *src, dst; @@ -84,8 +84,8 @@ else *addr_has_changed = 0; break; - case 4: - case 5: + case 4: + case 5: if (*addr_has_changed) addr[(count - 4)] = dst; else @@ -103,8 +103,8 @@ } static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap, - unsigned char *cmd, - const struct firmware *firmware) { + unsigned char *cmd, + const struct firmware *firmware) { struct as10x_fw_pkt_t fw_pkt; int total_read_bytes = 0, errno = 0; @@ -134,8 +134,8 @@ /* send EOF command */ errno = bus_adap->ops->upload_fw_pkt(bus_adap, - (uint8_t *) - &fw_pkt, 2, 0); + (uint8_t *) + &fw_pkt, 2, 0); if (errno< 0) goto error; } else { @@ -149,16 +149,16 @@ /* send cmd to device */ errno = bus_adap->ops->upload_fw_pkt(bus_adap, - (uint8_t *) - &fw_pkt, - data_len, - 0); + (uint8_t *) + &fw_pkt, + data_len, + 0); if (errno< 0) goto error; } } } -error: + error: LEAVE(); return (errno == 0) ? total_read_bytes : errno; } @@ -199,7 +199,7 @@ errno = request_firmware(&firmware, fw1,&dev->dev); if (errno< 0) { printk(KERN_ERR "%s: unable to locate firmware file: %s\n", - DRIVER_NAME, fw1); + DRIVER_NAME, fw1); goto error; } @@ -207,12 +207,12 @@ errno = as102_firmware_upload(bus_adap, cmd_buf, firmware); if (errno< 0) { printk(KERN_ERR "%s: error during firmware upload part1\n", - DRIVER_NAME); + DRIVER_NAME); goto error; } printk(KERN_INFO "%s: fimrware: %s loaded with success\n", - DRIVER_NAME, fw1); + DRIVER_NAME, fw1); release_firmware(firmware); /* wait for boot to complete */ @@ -222,7 +222,7 @@ errno = request_firmware(&firmware, fw2,&dev->dev); if (errno< 0) { printk(KERN_ERR "%s: unable to locate firmware file: %s\n", - DRIVER_NAME, fw2); + DRIVER_NAME, fw2); goto error; } @@ -230,13 +230,13 @@ errno = as102_firmware_upload(bus_adap, cmd_buf, firmware); if (errno< 0) { printk(KERN_ERR "%s: error during firmware upload part2\n", - DRIVER_NAME); + DRIVER_NAME); goto error; } printk(KERN_INFO "%s: fimrware: %s loaded with success\n", DRIVER_NAME, fw2); -error: + error: /* free data buffer */ kfree(cmd_buf); /* release firmware if needed */ diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as102_fw.h linux.as102.04-tabs/drivers/staging/as102/as102_fw.h --- linux.as102.03-typedefs/drivers/staging/as102/as102_fw.h 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.04-tabs/drivers/staging/as102/as102_fw.h 2011-10-14 23:36:54.000000000 +0200 @@ -9,7 +9,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as102_usb_drv.c linux.as102.04-tabs/drivers/staging/as102/as102_usb_drv.c --- linux.as102.03-typedefs/drivers/staging/as102/as102_usb_drv.c 2011-10-14 18:21:36.000000000 +0200 +++ linux.as102.04-tabs/drivers/staging/as102/as102_usb_drv.c 2011-10-14 23:23:14.000000000 +0200 @@ -10,7 +10,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -29,7 +29,7 @@ static void as102_usb_disconnect(struct usb_interface *interface); static int as102_usb_probe(struct usb_interface *interface, - const struct usb_device_id *id); + const struct usb_device_id *id); static int as102_usb_start_stream(struct as102_dev_t *dev); static void as102_usb_stop_stream(struct as102_dev_t *dev); @@ -38,59 +38,59 @@ static int as102_release(struct inode *inode, struct file *file); static struct usb_device_id as102_usb_id_table[] = { - { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) }, - { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) }, - { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) }, - { USB_DEVICE(NBOX_DVBT_DONGLE_USB_VID, NBOX_DVBT_DONGLE_USB_PID) }, - { } /* Terminating entry */ + { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) }, + { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) }, + { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) }, + { USB_DEVICE(NBOX_DVBT_DONGLE_USB_VID, NBOX_DVBT_DONGLE_USB_PID) }, + { } /* Terminating entry */ }; /* Note that this table must always have the same number of entries as the - as102_usb_id_table struct */ + as102_usb_id_table struct */ static const char *as102_device_names[] = { - AS102_REFERENCE_DESIGN, - AS102_PCTV_74E, - AS102_ELGATO_EYETV_DTT_NAME, - AS102_NBOX_DVBT_DONGLE_NAME, - NULL /* Terminating entry */ + AS102_REFERENCE_DESIGN, + AS102_PCTV_74E, + AS102_ELGATO_EYETV_DTT_NAME, + AS102_NBOX_DVBT_DONGLE_NAME, + NULL /* Terminating entry */ }; struct usb_driver as102_usb_driver = { - .name = DRIVER_FULL_NAME, - .probe = as102_usb_probe, - .disconnect = as102_usb_disconnect, - .id_table = as102_usb_id_table + .name = DRIVER_FULL_NAME, + .probe = as102_usb_probe, + .disconnect = as102_usb_disconnect, + .id_table = as102_usb_id_table }; static const struct file_operations as102_dev_fops = { - .owner = THIS_MODULE, - .open = as102_open, - .release = as102_release, + .owner = THIS_MODULE, + .open = as102_open, + .release = as102_release, }; static struct usb_class_driver as102_usb_class_driver = { - .name = "aton2-%d", - .fops =&as102_dev_fops, - .minor_base = AS102_DEVICE_MAJOR, + .name = "aton2-%d", + .fops =&as102_dev_fops, + .minor_base = AS102_DEVICE_MAJOR, }; static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap, - unsigned char *send_buf, int send_buf_len, - unsigned char *recv_buf, int recv_buf_len) + unsigned char *send_buf, int send_buf_len, + unsigned char *recv_buf, int recv_buf_len) { int ret = 0; ENTER(); if (send_buf != NULL) { ret = usb_control_msg(bus_adap->usb_dev, - usb_sndctrlpipe(bus_adap->usb_dev, 0), - AS102_USB_DEVICE_TX_CTRL_CMD, - USB_DIR_OUT | USB_TYPE_VENDOR | - USB_RECIP_DEVICE, - bus_adap->cmd_xid, /* value */ - 0, /* index */ - send_buf, send_buf_len, - USB_CTRL_SET_TIMEOUT /* 200 */); + usb_sndctrlpipe(bus_adap->usb_dev, 0), + AS102_USB_DEVICE_TX_CTRL_CMD, + USB_DIR_OUT | USB_TYPE_VENDOR | + USB_RECIP_DEVICE, + bus_adap->cmd_xid, /* value */ + 0, /* index */ + send_buf, send_buf_len, + USB_CTRL_SET_TIMEOUT /* 200 */); if (ret< 0) { dprintk(debug, "usb_control_msg(send) failed, err %i\n", ret); @@ -109,14 +109,14 @@ dprintk(debug, "want to read: %d bytes\n", recv_buf_len); #endif ret = usb_control_msg(bus_adap->usb_dev, - usb_rcvctrlpipe(bus_adap->usb_dev, 0), - AS102_USB_DEVICE_RX_CTRL_CMD, - USB_DIR_IN | USB_TYPE_VENDOR | - USB_RECIP_DEVICE, - bus_adap->cmd_xid, /* value */ - 0, /* index */ - recv_buf, recv_buf_len, - USB_CTRL_GET_TIMEOUT /* 200 */); + usb_rcvctrlpipe(bus_adap->usb_dev, 0), + AS102_USB_DEVICE_RX_CTRL_CMD, + USB_DIR_IN | USB_TYPE_VENDOR | + USB_RECIP_DEVICE, + bus_adap->cmd_xid, /* value */ + 0, /* index */ + recv_buf, recv_buf_len, + USB_CTRL_GET_TIMEOUT /* 200 */); if (ret< 0) { dprintk(debug, "usb_control_msg(recv) failed, err %i\n", ret); @@ -132,15 +132,15 @@ } static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap, - unsigned char *send_buf, - int send_buf_len, - int swap32) + unsigned char *send_buf, + int send_buf_len, + int swap32) { int ret = 0, actual_len; ret = usb_bulk_msg(bus_adap->usb_dev, - usb_sndbulkpipe(bus_adap->usb_dev, 1), - send_buf, send_buf_len,&actual_len, 200); + usb_sndbulkpipe(bus_adap->usb_dev, 1), + send_buf, send_buf_len,&actual_len, 200); if (ret) { dprintk(debug, "usb_bulk_msg(send) failed, err %i\n", ret); return ret; @@ -155,7 +155,7 @@ } static int as102_read_ep2(struct as102_bus_adapter_t *bus_adap, - unsigned char *recv_buf, int recv_buf_len) + unsigned char *recv_buf, int recv_buf_len) { int ret = 0, actual_len; @@ -163,8 +163,8 @@ return -EINVAL; ret = usb_bulk_msg(bus_adap->usb_dev, - usb_rcvbulkpipe(bus_adap->usb_dev, 2), - recv_buf, recv_buf_len,&actual_len, 200); + usb_rcvbulkpipe(bus_adap->usb_dev, 2), + recv_buf, recv_buf_len,&actual_len, 200); if (ret) { dprintk(debug, "usb_bulk_msg(recv) failed, err %i\n", ret); return ret; @@ -179,11 +179,11 @@ } struct as102_priv_ops_t as102_priv_ops = { - .upload_fw_pkt = as102_send_ep1, - .xfer_cmd = as102_usb_xfer_cmd, - .as102_read_ep2 = as102_read_ep2, - .start_stream = as102_usb_start_stream, - .stop_stream = as102_usb_stop_stream, + .upload_fw_pkt = as102_send_ep1, + .xfer_cmd = as102_usb_xfer_cmd, + .as102_read_ep2 = as102_read_ep2, + .start_stream = as102_usb_start_stream, + .stop_stream = as102_usb_stop_stream, }; static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb) @@ -191,12 +191,12 @@ int err; usb_fill_bulk_urb(urb, - dev->bus_adap.usb_dev, - usb_rcvbulkpipe(dev->bus_adap.usb_dev, 0x2), - urb->transfer_buffer, - AS102_USB_BUF_SIZE, - as102_urb_stream_irq, - dev); + dev->bus_adap.usb_dev, + usb_rcvbulkpipe(dev->bus_adap.usb_dev, 0x2), + urb->transfer_buffer, + AS102_USB_BUF_SIZE, + as102_urb_stream_irq, + dev); err = usb_submit_urb(urb, GFP_ATOMIC); if (err) @@ -216,8 +216,8 @@ if (urb->actual_length> 0) { #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) dvb_dmx_swfilter(&as102_dev->dvb_dmx, - urb->transfer_buffer, - urb->actual_length); + urb->transfer_buffer, + urb->actual_length); #else /* do nothing ? */ #endif @@ -254,9 +254,9 @@ ENTER(); dev->stream = usb_alloc_coherent(dev->bus_adap.usb_dev, - MAX_STREAM_URB * AS102_USB_BUF_SIZE, - GFP_KERNEL, - &dev->dma_addr); + MAX_STREAM_URB * AS102_USB_BUF_SIZE, + GFP_KERNEL, + &dev->dma_addr); if (!dev->stream) { dprintk(debug, "%s: usb_buffer_alloc failed\n", __func__); return -ENOMEM; @@ -351,7 +351,7 @@ } static int as102_usb_probe(struct usb_interface *intf, - const struct usb_device_id *id) + const struct usb_device_id *id) { int ret; struct as102_dev_t *as102_dev; @@ -367,14 +367,14 @@ /* This should never actually happen */ if ((sizeof(as102_usb_id_table) / sizeof(struct usb_device_id)) != - (sizeof(as102_device_names) / sizeof(const char *))) { + (sizeof(as102_device_names) / sizeof(const char *))) { printk(KERN_ERR "Device names table invalid size"); return -EINVAL; } /* Assign the user-friendly device name */ for (i = 0; i< (sizeof(as102_usb_id_table) / - sizeof(struct usb_device_id)); i++) { + sizeof(struct usb_device_id)); i++) { if (id ==&as102_usb_id_table[i]) as102_dev->name = as102_device_names[i]; } @@ -403,7 +403,7 @@ if (ret< 0) { /* something prevented us from registering this driver */ err("%s: usb_register_dev() failed (errno = %d)", - __func__, ret); + __func__, ret); goto failed; } @@ -420,7 +420,7 @@ LEAVE(); return ret; -failed: + failed: usb_set_intfdata(intf, NULL); kfree(as102_dev); return ret; @@ -459,7 +459,7 @@ /* increment our usage count for the device */ kref_get(&dev->kref); -exit: + exit: LEAVE(); return ret; } diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as102_usb_drv.h linux.as102.04-tabs/drivers/staging/as102/as102_usb_drv.h --- linux.as102.03-typedefs/drivers/staging/as102/as102_usb_drv.h 2011-10-14 18:20:32.000000000 +0200 +++ linux.as102.04-tabs/drivers/staging/as102/as102_usb_drv.h 2011-10-14 22:22:15.000000000 +0200 @@ -10,7 +10,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as10x_cmd.c linux.as102.04-tabs/drivers/staging/as102/as10x_cmd.c --- linux.as102.03-typedefs/drivers/staging/as102/as10x_cmd.c 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.04-tabs/drivers/staging/as102/as10x_cmd.c 2011-10-14 23:25:27.000000000 +0200 @@ -10,7 +10,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -22,24 +22,24 @@ #include<linux/kernel.h> #include "as102_drv.h" #elif defined(WIN32) - #if defined(__BUILDMACHINE__)&& (__BUILDMACHINE__ == WinDDK) - /* win32 ddk implementation */ - #include "wdm.h" - #include "Device.h" - #include "endian_mgmt.h" /* FIXME */ - #else /* win32 sdk implementation */ - #include<windows.h> - #include "types.h" - #include "util.h" - #include "as10x_handle.h" - #include "endian_mgmt.h" - #endif +#if defined(__BUILDMACHINE__)&& (__BUILDMACHINE__ == WinDDK) +/* win32 ddk implementation */ +#include "wdm.h" +#include "Device.h" +#include "endian_mgmt.h" /* FIXME */ +#else /* win32 sdk implementation */ +#include<windows.h> +#include "types.h" +#include "util.h" +#include "as10x_handle.h" +#include "endian_mgmt.h" +#endif #else /* all other cases */ - #include<string.h> - #include "types.h" - #include "util.h" - #include "as10x_handle.h" - #include "endian_mgmt.h" /* FIXME */ +#include<string.h> +#include "types.h" +#include "util.h" +#include "as10x_handle.h" +#include "endian_mgmt.h" /* FIXME */ #endif /* __KERNEL__ */ #include "as10x_types.h" @@ -50,7 +50,7 @@ \param phandle: pointer to AS10x handle \return 0 when no error,< 0 in case of error. \callgraph -*/ + */ int as10x_cmd_turn_on(as10x_handle_t *phandle) { int error; @@ -71,11 +71,11 @@ /* send command */ if (phandle->ops->xfer_cmd) { error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, - sizeof(pcmd->body.turn_on.req) + - HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.turn_on.rsp) + - HEADER_SIZE); + sizeof(pcmd->body.turn_on.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.turn_on.rsp) + + HEADER_SIZE); } else { error = AS10X_CMD_ERROR; } @@ -86,7 +86,7 @@ /* parse response */ error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP); -out: + out: LEAVE(); return error; } @@ -96,7 +96,7 @@ \param phandle: pointer to AS10x handle \return 0 when no error,< 0 in case of error. \callgraph -*/ + */ int as10x_cmd_turn_off(as10x_handle_t *phandle) { int error; @@ -117,10 +117,10 @@ /* send command */ if (phandle->ops->xfer_cmd) { error = phandle->ops->xfer_cmd( - phandle, (uint8_t *) pcmd, - sizeof(pcmd->body.turn_off.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE); + phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.turn_off.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE); } else { error = AS10X_CMD_ERROR; } @@ -131,7 +131,7 @@ /* parse response */ error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP); -out: + out: LEAVE(); return error; } @@ -164,22 +164,22 @@ preq->body.set_tune.req.args.hier_select = ptune->hier_select; preq->body.set_tune.req.args.constellation = ptune->constellation; preq->body.set_tune.req.args.hierarchy = ptune->hierarchy; - preq->body.set_tune.req.args.interleaving_mode = - ptune->interleaving_mode; - preq->body.set_tune.req.args.code_rate = ptune->code_rate; + preq->body.set_tune.req.args.interleaving_mode = + ptune->interleaving_mode; + preq->body.set_tune.req.args.code_rate = ptune->code_rate; preq->body.set_tune.req.args.guard_interval = ptune->guard_interval; - preq->body.set_tune.req.args.transmission_mode = - ptune->transmission_mode; + preq->body.set_tune.req.args.transmission_mode = + ptune->transmission_mode; /* send command */ if (phandle->ops->xfer_cmd) { error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) preq, - sizeof(preq->body.set_tune.req) - + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.set_tune.rsp) - + HEADER_SIZE); + (uint8_t *) preq, + sizeof(preq->body.set_tune.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.set_tune.rsp) + + HEADER_SIZE); } else { error = AS10X_CMD_ERROR; } @@ -190,7 +190,7 @@ /* parse response */ error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP); -out: + out: LEAVE(); return error; } @@ -203,10 +203,10 @@ \callgraph */ int as10x_cmd_get_tune_status(as10x_handle_t *phandle, - struct as10x_tune_status *pstatus) + struct as10x_tune_status *pstatus) { int error; - struct as10x_cmd_t *preq, *prsp; + struct as10x_cmd_t *preq, *prsp; ENTER(); @@ -219,16 +219,16 @@ /* fill command */ preq->body.get_tune_status.req.proc_id = - cpu_to_le16(CONTROL_PROC_GETTUNESTAT); + cpu_to_le16(CONTROL_PROC_GETTUNESTAT); /* send command */ if (phandle->ops->xfer_cmd) { error = phandle->ops->xfer_cmd( - phandle, - (uint8_t *) preq, - sizeof(preq->body.get_tune_status.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE); + phandle, + (uint8_t *) preq, + sizeof(preq->body.get_tune_status.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE); } else { error = AS10X_CMD_ERROR; } @@ -243,12 +243,12 @@ /* Response OK -> get response data */ pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state; - pstatus->signal_strength = - le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength); + pstatus->signal_strength = + le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength); pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER); pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER); -out: + out: LEAVE(); return error; } @@ -276,17 +276,17 @@ /* fill command */ pcmd->body.get_tune_status.req.proc_id = - cpu_to_le16(CONTROL_PROC_GETTPS); + cpu_to_le16(CONTROL_PROC_GETTPS); /* send command */ if (phandle->ops->xfer_cmd) { error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.get_tps.req) + - HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.get_tps.rsp) + - HEADER_SIZE); + (uint8_t *) pcmd, + sizeof(pcmd->body.get_tps.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_tps.rsp) + + HEADER_SIZE); } else { error = AS10X_CMD_ERROR; } @@ -306,12 +306,12 @@ ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP; ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP; ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval; - ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode; + ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode; ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP; ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP; ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID); -out: + out: LEAVE(); return error; } @@ -322,9 +322,9 @@ \param pdemod_stats: pointer to demod stats parameters structure \return 0 when no error,< 0 in case of error. \callgraph -*/ -int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, - struct as10x_demod_stats *pdemod_stats) + */ +int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, + struct as10x_demod_stats *pdemod_stats) { int error; struct as10x_cmd_t *pcmd, *prsp; @@ -340,7 +340,7 @@ /* fill command */ pcmd->body.get_demod_stats.req.proc_id = - cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); + cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); /* send command */ if (phandle->ops->xfer_cmd) { @@ -365,17 +365,17 @@ /* Response OK -> get response data */ pdemod_stats->frame_count = - le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count); + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count); pdemod_stats->bad_frame_count = - le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count); + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count); pdemod_stats->bytes_fixed_by_rs = - le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs); + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs); pdemod_stats->mer = - le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer); + le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer); pdemod_stats->has_started = - prsp->body.get_demod_stats.rsp.stats.has_started; + prsp->body.get_demod_stats.rsp.stats.has_started; -out: + out: LEAVE(); return error; } @@ -387,9 +387,9 @@ response data is ready \return 0 when no error,< 0 in case of error. \callgraph -*/ -int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, - uint8_t *is_ready) + */ +int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, + uint8_t *is_ready) { int error; struct as10x_cmd_t *pcmd, *prsp; @@ -405,17 +405,17 @@ /* fill command */ pcmd->body.get_impulse_rsp.req.proc_id = - cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); + cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); /* send command */ if (phandle->ops->xfer_cmd) { error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.get_impulse_rsp.req) - + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.get_impulse_rsp.rsp) - + HEADER_SIZE); + (uint8_t *) pcmd, + sizeof(pcmd->body.get_impulse_rsp.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_impulse_rsp.rsp) + + HEADER_SIZE); } else { error = AS10X_CMD_ERROR; } @@ -431,7 +431,7 @@ /* Response OK -> get response data */ *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready; -out: + out: LEAVE(); return error; } @@ -445,9 +445,9 @@ \param cmd_len: lenght of the command \return - \callgraph -*/ + */ void as10x_cmd_build(struct as10x_cmd_t *pcmd, - uint16_t xid, uint16_t cmd_len) + uint16_t xid, uint16_t cmd_len) { pcmd->header.req_id = cpu_to_le16(xid); pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID); @@ -462,7 +462,7 @@ \param cmd_len: lenght of the command \return 0 when no error,< 0 in case of error \callgraph -*/ + */ int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) { int error; @@ -471,7 +471,7 @@ error = prsp->body.common.rsp.error; if ((error == 0)&& - (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) { + (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) { return 0; } diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as10x_cmd_cfg.c linux.as102.04-tabs/drivers/staging/as102/as10x_cmd_cfg.c --- linux.as102.03-typedefs/drivers/staging/as102/as10x_cmd_cfg.c 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.04-tabs/drivers/staging/as102/as10x_cmd_cfg.c 2011-10-14 23:24:05.000000000 +0200 @@ -9,7 +9,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -21,31 +21,31 @@ #include<linux/kernel.h> #include "as102_drv.h" #elif defined(WIN32) - #if defined(__BUILDMACHINE__)&& (__BUILDMACHINE__ == WinDDK) - /* win32 ddk implementation */ - #include "wdm.h" - #include "Device.h" - #include "endian_mgmt.h" /* FIXME */ - #else /* win32 sdk implementation */ - #include<windows.h> - #include "types.h" - #include "util.h" - #include "as10x_handle.h" - #include "endian_mgmt.h" - #endif +#if defined(__BUILDMACHINE__)&& (__BUILDMACHINE__ == WinDDK) +/* win32 ddk implementation */ +#include "wdm.h" +#include "Device.h" +#include "endian_mgmt.h" /* FIXME */ +#else /* win32 sdk implementation */ +#include<windows.h> +#include "types.h" +#include "util.h" +#include "as10x_handle.h" +#include "endian_mgmt.h" +#endif #else /* all other cases */ - #include<string.h> - #include "types.h" - #include "util.h" - #include "as10x_handle.h" - #include "endian_mgmt.h" /* FIXME */ +#include<string.h> +#include "types.h" +#include "util.h" +#include "as10x_handle.h" +#include "endian_mgmt.h" /* FIXME */ #endif /* __KERNEL__ */ #include "as10x_types.h" #include "as10x_cmd.h" /***************************/ -/* FUNCTION DEFINITION */ +/* FUNCTION DEFINITION */ /***************************/ /** @@ -55,11 +55,11 @@ \param pvalue: pointer where to store context value read \return 0 when no error,< 0 in case of error. \callgraph -*/ + */ int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag, - uint32_t *pvalue) + uint32_t *pvalue) { - int error; + int error; struct as10x_cmd_t *pcmd, *prsp; ENTER(); @@ -78,13 +78,13 @@ /* send command */ if (phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.context.req) - + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.context.rsp) - + HEADER_SIZE); + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.context.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.context.rsp) + + HEADER_SIZE); } else { error = AS10X_CMD_ERROR; } @@ -102,7 +102,7 @@ /* value returned is always a 32-bit value */ } -out: + out: LEAVE(); return error; } @@ -114,9 +114,9 @@ \param value: value to set in context \return 0 when no error,< 0 in case of error. \callgraph -*/ + */ int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag, - uint32_t value) + uint32_t value) { int error; struct as10x_cmd_t *pcmd, *prsp; @@ -139,13 +139,13 @@ /* send command */ if (phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.context.req) - + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.context.rsp) - + HEADER_SIZE); + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.context.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.context.rsp) + + HEADER_SIZE); } else { error = AS10X_CMD_ERROR; } @@ -157,7 +157,7 @@ /* structure -> specific handling response parse required */ error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); -out: + out: LEAVE(); return error; } @@ -173,7 +173,7 @@ ON or OFF \return 0 when no error,< 0 in case of error. \callgraph -*/ + */ int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode) { int error; @@ -190,12 +190,12 @@ /* fill command */ pcmd->body.cfg_change_mode.req.proc_id = - cpu_to_le16(CONTROL_PROC_ELNA_CHANGE_MODE); + cpu_to_le16(CONTROL_PROC_ELNA_CHANGE_MODE); pcmd->body.cfg_change_mode.req.mode = mode; /* send command */ if (phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, sizeof(pcmd->body.cfg_change_mode.req) + HEADER_SIZE, (uint8_t *) prsp, sizeof(prsp->body.cfg_change_mode.rsp) @@ -210,7 +210,7 @@ /* parse response */ error = as10x_rsp_parse(prsp, CONTROL_PROC_ELNA_CHANGE_MODE_RSP); -out: + out: LEAVE(); return error; } @@ -223,7 +223,7 @@ \return 0 when no error,< 0 in case of error. ABILIS_RC_NOK \callgraph -*/ + */ int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) { int err; @@ -231,7 +231,7 @@ err = prsp->body.context.rsp.error; if ((err == 0)&& - (le16_to_cpu(prsp->body.context.rsp.proc_id) == proc_id)) { + (le16_to_cpu(prsp->body.context.rsp.proc_id) == proc_id)) { return 0; } return AS10X_CMD_ERROR; diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as10x_cmd.h linux.as102.04-tabs/drivers/staging/as102/as10x_cmd.h --- linux.as102.03-typedefs/drivers/staging/as102/as10x_cmd.h 2011-10-14 18:48:39.000000000 +0200 +++ linux.as102.04-tabs/drivers/staging/as102/as10x_cmd.h 2011-10-14 23:34:17.000000000 +0200 @@ -9,7 +9,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -26,469 +26,468 @@ #include "as10x_types.h" /*********************************/ -/* MACRO DEFINITIONS */ +/* MACRO DEFINITIONS */ /*********************************/ #define AS10X_CMD_ERROR -1 -#define SERVICE_PROG_ID 0x0002 -#define SERVICE_PROG_VERSION 0x0001 +#define SERVICE_PROG_ID 0x0002 +#define SERVICE_PROG_VERSION 0x0001 -#define HIER_NONE 0x00 -#define HIER_LOW_PRIORITY 0x01 +#define HIER_NONE 0x00 +#define HIER_LOW_PRIORITY 0x01 #define HEADER_SIZE (sizeof(struct as10x_cmd_header_t)) /* context request types */ -#define GET_CONTEXT_DATA 1 -#define SET_CONTEXT_DATA 2 +#define GET_CONTEXT_DATA 1 +#define SET_CONTEXT_DATA 2 /* ODSP suspend modes */ -#define CFG_MODE_ODSP_RESUME 0 -#define CFG_MODE_ODSP_SUSPEND 1 +#define CFG_MODE_ODSP_RESUME 0 +#define CFG_MODE_ODSP_SUSPEND 1 /* Dump memory size */ -#define DUMP_BLOCK_SIZE_MAX 0x20 +#define DUMP_BLOCK_SIZE_MAX 0x20 /*********************************/ -/* TYPE DEFINITION */ +/* TYPE DEFINITION */ /*********************************/ enum control_proc { - CONTROL_PROC_TURNON = 0x0001, - CONTROL_PROC_TURNON_RSP = 0x0100, - CONTROL_PROC_SET_REGISTER = 0x0002, - CONTROL_PROC_SET_REGISTER_RSP = 0x0200, - CONTROL_PROC_GET_REGISTER = 0x0003, - CONTROL_PROC_GET_REGISTER_RSP = 0x0300, - CONTROL_PROC_SETTUNE = 0x000A, - CONTROL_PROC_SETTUNE_RSP = 0x0A00, - CONTROL_PROC_GETTUNESTAT = 0x000B, - CONTROL_PROC_GETTUNESTAT_RSP = 0x0B00, - CONTROL_PROC_GETTPS = 0x000D, - CONTROL_PROC_GETTPS_RSP = 0x0D00, - CONTROL_PROC_SETFILTER = 0x000E, - CONTROL_PROC_SETFILTER_RSP = 0x0E00, - CONTROL_PROC_REMOVEFILTER = 0x000F, - CONTROL_PROC_REMOVEFILTER_RSP = 0x0F00, - CONTROL_PROC_GET_IMPULSE_RESP = 0x0012, - CONTROL_PROC_GET_IMPULSE_RESP_RSP = 0x1200, - CONTROL_PROC_START_STREAMING = 0x0013, - CONTROL_PROC_START_STREAMING_RSP = 0x1300, - CONTROL_PROC_STOP_STREAMING = 0x0014, - CONTROL_PROC_STOP_STREAMING_RSP = 0x1400, - CONTROL_PROC_GET_DEMOD_STATS = 0x0015, - CONTROL_PROC_GET_DEMOD_STATS_RSP = 0x1500, - CONTROL_PROC_ELNA_CHANGE_MODE = 0x0016, - CONTROL_PROC_ELNA_CHANGE_MODE_RSP = 0x1600, - CONTROL_PROC_ODSP_CHANGE_MODE = 0x0017, - CONTROL_PROC_ODSP_CHANGE_MODE_RSP = 0x1700, - CONTROL_PROC_AGC_CHANGE_MODE = 0x0018, - CONTROL_PROC_AGC_CHANGE_MODE_RSP = 0x1800, - - CONTROL_PROC_CONTEXT = 0x00FC, - CONTROL_PROC_CONTEXT_RSP = 0xFC00, - CONTROL_PROC_DUMP_MEMORY = 0x00FD, - CONTROL_PROC_DUMP_MEMORY_RSP = 0xFD00, - CONTROL_PROC_DUMPLOG_MEMORY = 0x00FE, - CONTROL_PROC_DUMPLOG_MEMORY_RSP = 0xFE00, - CONTROL_PROC_TURNOFF = 0x00FF, - CONTROL_PROC_TURNOFF_RSP = 0xFF00 + CONTROL_PROC_TURNON = 0x0001, + CONTROL_PROC_TURNON_RSP = 0x0100, + CONTROL_PROC_SET_REGISTER = 0x0002, + CONTROL_PROC_SET_REGISTER_RSP = 0x0200, + CONTROL_PROC_GET_REGISTER = 0x0003, + CONTROL_PROC_GET_REGISTER_RSP = 0x0300, + CONTROL_PROC_SETTUNE = 0x000A, + CONTROL_PROC_SETTUNE_RSP = 0x0A00, + CONTROL_PROC_GETTUNESTAT = 0x000B, + CONTROL_PROC_GETTUNESTAT_RSP = 0x0B00, + CONTROL_PROC_GETTPS = 0x000D, + CONTROL_PROC_GETTPS_RSP = 0x0D00, + CONTROL_PROC_SETFILTER = 0x000E, + CONTROL_PROC_SETFILTER_RSP = 0x0E00, + CONTROL_PROC_REMOVEFILTER = 0x000F, + CONTROL_PROC_REMOVEFILTER_RSP = 0x0F00, + CONTROL_PROC_GET_IMPULSE_RESP = 0x0012, + CONTROL_PROC_GET_IMPULSE_RESP_RSP = 0x1200, + CONTROL_PROC_START_STREAMING = 0x0013, + CONTROL_PROC_START_STREAMING_RSP = 0x1300, + CONTROL_PROC_STOP_STREAMING = 0x0014, + CONTROL_PROC_STOP_STREAMING_RSP = 0x1400, + CONTROL_PROC_GET_DEMOD_STATS = 0x0015, + CONTROL_PROC_GET_DEMOD_STATS_RSP = 0x1500, + CONTROL_PROC_ELNA_CHANGE_MODE = 0x0016, + CONTROL_PROC_ELNA_CHANGE_MODE_RSP = 0x1600, + CONTROL_PROC_ODSP_CHANGE_MODE = 0x0017, + CONTROL_PROC_ODSP_CHANGE_MODE_RSP = 0x1700, + CONTROL_PROC_AGC_CHANGE_MODE = 0x0018, + CONTROL_PROC_AGC_CHANGE_MODE_RSP = 0x1800, + + CONTROL_PROC_CONTEXT = 0x00FC, + CONTROL_PROC_CONTEXT_RSP = 0xFC00, + CONTROL_PROC_DUMP_MEMORY = 0x00FD, + CONTROL_PROC_DUMP_MEMORY_RSP = 0xFD00, + CONTROL_PROC_DUMPLOG_MEMORY = 0x00FE, + CONTROL_PROC_DUMPLOG_MEMORY_RSP = 0xFE00, + CONTROL_PROC_TURNOFF = 0x00FF, + CONTROL_PROC_TURNOFF_RSP = 0xFF00 }; #pragma pack(1) union TURN_ON { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* error */ - uint8_t error; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; }; union TURN_OFF { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* error */ - uint8_t err; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t err; + } rsp; }; union SET_TUNE { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - /* tune params */ - struct as10x_tune_args args; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* response error */ - uint8_t error; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* tune params */ + struct as10x_tune_args args; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + } rsp; }; union GET_TUNE_STATUS { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* response error */ - uint8_t error; - /* tune status */ - struct as10x_tune_status sts; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + /* tune status */ + struct as10x_tune_status sts; + } rsp; }; union GET_TPS { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* response error */ - uint8_t error; - /* tps details */ - struct as10x_tps tps; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + /* tps details */ + struct as10x_tps tps; + } rsp; }; union COMMON { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* response error */ - uint8_t error; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + } rsp; }; union ADD_PID_FILTER { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - /* PID to filter */ - uint16_t pid; - /* stream type (MPE, PSI/SI or PES )*/ - uint8_t stream_type; - /* PID index in filter table */ - uint8_t idx; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* response error */ - uint8_t error; - /* Filter id */ - uint8_t filter_id; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* PID to filter */ + uint16_t pid; + /* stream type (MPE, PSI/SI or PES )*/ + uint8_t stream_type; + /* PID index in filter table */ + uint8_t idx; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + /* Filter id */ + uint8_t filter_id; + } rsp; }; union DEL_PID_FILTER { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - /* PID to remove */ - uint16_t pid; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* response error */ - uint8_t error; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* PID to remove */ + uint16_t pid; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + } rsp; }; union START_STREAMING { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* error */ - uint8_t error; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; }; union STOP_STREAMING { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* error */ - uint8_t error; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; }; union GET_DEMOD_STATS { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* error */ - uint8_t error; - /* demod stats */ - struct as10x_demod_stats stats; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* demod stats */ + struct as10x_demod_stats stats; + } rsp; }; union GET_IMPULSE_RESP { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* error */ - uint8_t error; - /* impulse response ready */ - uint8_t is_ready; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* impulse response ready */ + uint8_t is_ready; + } rsp; }; union FW_CONTEXT { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - /* value to write (for set context)*/ - struct as10x_register_value reg_val; - /* context tag */ - uint16_t tag; - /* context request type */ - uint16_t type; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* value read (for get context) */ - struct as10x_register_value reg_val; - /* context request type */ - uint16_t type; - /* error */ - uint8_t error; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* value to write (for set context)*/ + struct as10x_register_value reg_val; + /* context tag */ + uint16_t tag; + /* context request type */ + uint16_t type; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* value read (for get context) */ + struct as10x_register_value reg_val; + /* context request type */ + uint16_t type; + /* error */ + uint8_t error; + } rsp; }; union SET_REGISTER { - /* request */ - struct { - /* response identifier */ - uint16_t proc_id; - /* register description */ - struct as10x_register_addr reg_addr; - /* register content */ - struct as10x_register_value reg_val; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* error */ - uint8_t error; - } rsp; + /* request */ + struct { + /* response identifier */ + uint16_t proc_id; + /* register description */ + struct as10x_register_addr reg_addr; + /* register content */ + struct as10x_register_value reg_val; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; }; union GET_REGISTER { - /* request */ - struct { - /* response identifier */ - uint16_t proc_id; - /* register description */ - struct as10x_register_addr reg_addr; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* error */ - uint8_t error; - /* register content */ - struct as10x_register_value reg_val; - } rsp; + /* request */ + struct { + /* response identifier */ + uint16_t proc_id; + /* register description */ + struct as10x_register_addr reg_addr; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* register content */ + struct as10x_register_value reg_val; + } rsp; }; union CFG_CHANGE_MODE { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - /* mode */ - uint8_t mode; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* error */ - uint8_t error; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* mode */ + uint8_t mode; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; }; struct as10x_cmd_header_t { - uint16_t req_id; - uint16_t prog; - uint16_t version; - uint16_t data_len; + uint16_t req_id; + uint16_t prog; + uint16_t version; + uint16_t data_len; }; #define DUMP_BLOCK_SIZE 16 union DUMP_MEMORY { - /* request */ - struct { - /* request identifier */ - uint16_t proc_id; - /* dump memory type request */ - uint8_t dump_req; - /* register description */ - struct as10x_register_addr reg_addr; - /* nb blocks to read */ - uint16_t num_blocks; - } req; - /* response */ - struct { - /* response identifier */ - uint16_t proc_id; - /* error */ - uint8_t error; - /* dump response */ - uint8_t dump_rsp; - /* data */ - union { - uint8_t data8[DUMP_BLOCK_SIZE]; - uint16_t data16[DUMP_BLOCK_SIZE / sizeof(uint16_t)]; - uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)]; - } u; - } rsp; + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* dump memory type request */ + uint8_t dump_req; + /* register description */ + struct as10x_register_addr reg_addr; + /* nb blocks to read */ + uint16_t num_blocks; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* dump response */ + uint8_t dump_rsp; + /* data */ + union { + uint8_t data8[DUMP_BLOCK_SIZE]; + uint16_t data16[DUMP_BLOCK_SIZE / sizeof(uint16_t)]; + uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)]; + } u; + } rsp; }; union DUMPLOG_MEMORY { - struct { - /* request identifier */ - uint16_t proc_id; - /* dump memory type request */ - uint8_t dump_req; - } req; - struct { - /* request identifier */ - uint16_t proc_id; - /* error */ - uint8_t error; - /* dump response */ - uint8_t dump_rsp; - /* dump data */ - uint8_t data[DUMP_BLOCK_SIZE]; - } rsp; + struct { + /* request identifier */ + uint16_t proc_id; + /* dump memory type request */ + uint8_t dump_req; + } req; + struct { + /* request identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* dump response */ + uint8_t dump_rsp; + /* dump data */ + uint8_t data[DUMP_BLOCK_SIZE]; + } rsp; }; union RAW_DATA { - /* request */ - struct { - uint16_t proc_id; - uint8_t data[64 - sizeof(struct as10x_cmd_header_t) -2 /* proc_id */]; - } req; - /* response */ - struct { - uint16_t proc_id; - uint8_t error; - uint8_t data[64 - sizeof(struct as10x_cmd_header_t) /* header */ - - 2 /* proc_id */ - 1 /* rc */]; - } rsp; + /* request */ + struct { + uint16_t proc_id; + uint8_t data[64 - sizeof(struct as10x_cmd_header_t) -2 /* proc_id */]; + } req; + /* response */ + struct { + uint16_t proc_id; + uint8_t error; + uint8_t data[64 - sizeof(struct as10x_cmd_header_t) - 2 - 1]; /* 64 - header - proc_id - rc */ + } rsp; }; struct as10x_cmd_t { - /* header */ - struct as10x_cmd_header_t header; - /* body */ - union { - union TURN_ON turn_on; - union TURN_OFF turn_off; - union SET_TUNE set_tune; - union GET_TUNE_STATUS get_tune_status; - union GET_TPS get_tps; - union COMMON common; - union ADD_PID_FILTER add_pid_filter; - union DEL_PID_FILTER del_pid_filter; - union START_STREAMING start_streaming; - union STOP_STREAMING stop_streaming; - union GET_DEMOD_STATS get_demod_stats; - union GET_IMPULSE_RESP get_impulse_rsp; - union FW_CONTEXT context; - union SET_REGISTER set_register; - union GET_REGISTER get_register; - union CFG_CHANGE_MODE cfg_change_mode; - union DUMP_MEMORY dump_memory; - union DUMPLOG_MEMORY dumplog_memory; - union RAW_DATA raw_data; - } body; + /* header */ + struct as10x_cmd_header_t header; + /* body */ + union { + union TURN_ON turn_on; + union TURN_OFF turn_off; + union SET_TUNE set_tune; + union GET_TUNE_STATUS get_tune_status; + union GET_TPS get_tps; + union COMMON common; + union ADD_PID_FILTER add_pid_filter; + union DEL_PID_FILTER del_pid_filter; + union START_STREAMING start_streaming; + union STOP_STREAMING stop_streaming; + union GET_DEMOD_STATS get_demod_stats; + union GET_IMPULSE_RESP get_impulse_rsp; + union FW_CONTEXT context; + union SET_REGISTER set_register; + union GET_REGISTER get_register; + union CFG_CHANGE_MODE cfg_change_mode; + union DUMP_MEMORY dump_memory; + union DUMPLOG_MEMORY dumplog_memory; + union RAW_DATA raw_data; + } body; }; struct as10x_token_cmd_t { - /* token cmd */ - struct as10x_cmd_t c; - /* token response */ - struct as10x_cmd_t r; + /* token cmd */ + struct as10x_cmd_t c; + /* token response */ + struct as10x_cmd_t r; }; #pragma pack() -/**************************/ -/* FUNCTION DECLARATION */ -/**************************/ +/************************/ +/* FUNCTION DECLARATION */ +/************************/ void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id, - uint16_t cmd_len); + uint16_t cmd_len); int as10x_rsp_parse(struct as10x_cmd_t *r, uint16_t proc_id); #ifdef __cplusplus @@ -500,36 +499,36 @@ int as10x_cmd_turn_off(as10x_handle_t *phandle); int as10x_cmd_set_tune(as10x_handle_t *phandle, - struct as10x_tune_args *ptune); + struct as10x_tune_args *ptune); int as10x_cmd_get_tune_status(as10x_handle_t *phandle, - struct as10x_tune_status *pstatus); + struct as10x_tune_status *pstatus); int as10x_cmd_get_tps(as10x_handle_t *phandle, - struct as10x_tps *ptps); + struct as10x_tps *ptps); -int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, - struct as10x_demod_stats *pdemod_stats); +int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, + struct as10x_demod_stats *pdemod_stats); int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, - uint8_t *is_ready); + uint8_t *is_ready); /* as10x cmd stream */ int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, - struct as10x_ts_filter *filter); + struct as10x_ts_filter *filter); int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, - uint16_t pid_value); + uint16_t pid_value); int as10x_cmd_start_streaming(as10x_handle_t *phandle); int as10x_cmd_stop_streaming(as10x_handle_t *phandle); /* as10x cmd cfg */ int as10x_cmd_set_context(as10x_handle_t *phandle, - uint16_t tag, - uint32_t value); + uint16_t tag, + uint32_t value); int as10x_cmd_get_context(as10x_handle_t *phandle, - uint16_t tag, - uint32_t *pvalue); + uint16_t tag, + uint32_t *pvalue); int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode); int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id); diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as10x_cmd_stream.c linux.as102.04-tabs/drivers/staging/as102/as10x_cmd_stream.c --- linux.as102.03-typedefs/drivers/staging/as102/as10x_cmd_stream.c 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.04-tabs/drivers/staging/as102/as10x_cmd_stream.c 2011-10-14 23:24:32.000000000 +0200 @@ -9,7 +9,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -20,23 +20,23 @@ #include<linux/kernel.h> #include "as102_drv.h" #elif defined(WIN32) - #if defined(DDK) /* win32 ddk implementation */ - #include "wdm.h" - #include "Device.h" - #include "endian_mgmt.h" /* FIXME */ - #else /* win32 sdk implementation */ - #include<windows.h> - #include "types.h" - #include "util.h" - #include "as10x_handle.h" - #include "endian_mgmt.h" - #endif +#if defined(DDK) /* win32 ddk implementation */ +#include "wdm.h" +#include "Device.h" +#include "endian_mgmt.h" /* FIXME */ +#else /* win32 sdk implementation */ +#include<windows.h> +#include "types.h" +#include "util.h" +#include "as10x_handle.h" +#include "endian_mgmt.h" +#endif #else /* all other cases */ - #include<string.h> - #include "types.h" - #include "util.h" - #include "as10x_handle.h" - #include "endian_mgmt.h" /* FIXME */ +#include<string.h> +#include "types.h" +#include "util.h" +#include "as10x_handle.h" +#include "endian_mgmt.h" /* FIXME */ #endif /* __KERNEL__ */ #include "as10x_cmd.h" @@ -49,9 +49,9 @@ \param pfilter_handle: pointer where to store filter handle \return 0 when no error,< 0 in case of error. \callgraph -*/ + */ int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, - struct as10x_ts_filter *filter) + struct as10x_ts_filter *filter) { int error; struct as10x_cmd_t *pcmd, *prsp; @@ -67,7 +67,7 @@ /* fill command */ pcmd->body.add_pid_filter.req.proc_id = - cpu_to_le16(CONTROL_PROC_SETFILTER); + cpu_to_le16(CONTROL_PROC_SETFILTER); pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid); pcmd->body.add_pid_filter.req.stream_type = filter->type; @@ -98,7 +98,7 @@ filter->idx = prsp->body.add_pid_filter.rsp.filter_id; } -out: + out: LEAVE(); return error; } @@ -109,9 +109,9 @@ \param filter_handle: filter handle \return 0 when no error,< 0 in case of error. \callgraph -*/ + */ int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, - uint16_t pid_value) + uint16_t pid_value) { int error; struct as10x_cmd_t *pcmd, *prsp; @@ -127,7 +127,7 @@ /* fill command */ pcmd->body.del_pid_filter.req.proc_id = - cpu_to_le16(CONTROL_PROC_REMOVEFILTER); + cpu_to_le16(CONTROL_PROC_REMOVEFILTER); pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value); /* send command */ @@ -147,7 +147,7 @@ /* parse response */ error = as10x_rsp_parse(prsp, CONTROL_PROC_REMOVEFILTER_RSP); -out: + out: LEAVE(); return error; } @@ -157,7 +157,7 @@ \param phandle: pointer to AS10x handle \return 0 when no error,< 0 in case of error. \callgraph -*/ + */ int as10x_cmd_start_streaming(as10x_handle_t *phandle) { int error; @@ -174,7 +174,7 @@ /* fill command */ pcmd->body.start_streaming.req.proc_id = - cpu_to_le16(CONTROL_PROC_START_STREAMING); + cpu_to_le16(CONTROL_PROC_START_STREAMING); /* send command */ if (phandle->ops->xfer_cmd) { @@ -193,7 +193,7 @@ /* parse response */ error = as10x_rsp_parse(prsp, CONTROL_PROC_START_STREAMING_RSP); -out: + out: LEAVE(); return error; } @@ -203,7 +203,7 @@ \param phandle: pointer to AS10x handle \return 0 when no error,< 0 in case of error. \callgraph -*/ + */ int as10x_cmd_stop_streaming(as10x_handle_t *phandle) { int8_t error; @@ -220,7 +220,7 @@ /* fill command */ pcmd->body.stop_streaming.req.proc_id = - cpu_to_le16(CONTROL_PROC_STOP_STREAMING); + cpu_to_le16(CONTROL_PROC_STOP_STREAMING); /* send command */ if (phandle->ops->xfer_cmd) { @@ -239,7 +239,7 @@ /* parse response */ error = as10x_rsp_parse(prsp, CONTROL_PROC_STOP_STREAMING_RSP); -out: + out: LEAVE(); return error; } diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as10x_handle.h linux.as102.04-tabs/drivers/staging/as102/as10x_handle.h --- linux.as102.03-typedefs/drivers/staging/as102/as10x_handle.h 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.04-tabs/drivers/staging/as102/as10x_handle.h 2011-10-14 22:47:14.000000000 +0200 @@ -9,7 +9,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -24,13 +24,13 @@ #include "as10x_cmd.h" /* values for "mode" field */ -#define REGMODE8 8 -#define REGMODE16 16 -#define REGMODE32 32 +#define REGMODE8 8 +#define REGMODE16 16 +#define REGMODE32 32 struct as102_priv_ops_t { int (*upload_fw_pkt) (struct as102_bus_adapter_t *bus_adap, - unsigned char *buf, int buflen, int swap32); + unsigned char *buf, int buflen, int swap32); int (*send_cmd) (struct as102_bus_adapter_t *bus_adap, unsigned char *buf, int buflen); @@ -40,7 +40,7 @@ unsigned char *recv_buf, int recv_buf_len); /* int (*pid_filter) (struct as102_bus_adapter_t *bus_adap, - int index, u16 pid, int onoff); + int index, u16 pid, int onoff); */ int (*start_stream) (struct as102_dev_t *dev); void (*stop_stream) (struct as102_dev_t *dev); @@ -48,11 +48,11 @@ int (*reset_target) (struct as102_bus_adapter_t *bus_adap); int (*read_write)(struct as102_bus_adapter_t *bus_adap, uint8_t mode, - uint32_t rd_addr, uint16_t rd_len, - uint32_t wr_addr, uint16_t wr_len); + uint32_t rd_addr, uint16_t rd_len, + uint32_t wr_addr, uint16_t wr_len); int (*as102_read_ep2) (struct as102_bus_adapter_t *bus_adap, - unsigned char *recv_buf, - int recv_buf_len); + unsigned char *recv_buf, + int recv_buf_len); }; #endif diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as10x_types.h linux.as102.04-tabs/drivers/staging/as102/as10x_types.h --- linux.as102.03-typedefs/drivers/staging/as102/as10x_types.h 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.04-tabs/drivers/staging/as102/as10x_types.h 2011-10-14 23:33:20.000000000 +0200 @@ -9,7 +9,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -22,176 +22,176 @@ #include "as10x_handle.h" /*********************************/ -/* MACRO DEFINITIONS */ +/* MACRO DEFINITIONS */ /*********************************/ /* bandwidth constant values */ -#define BW_5_MHZ 0x00 -#define BW_6_MHZ 0x01 -#define BW_7_MHZ 0x02 -#define BW_8_MHZ 0x03 +#define BW_5_MHZ 0x00 +#define BW_6_MHZ 0x01 +#define BW_7_MHZ 0x02 +#define BW_8_MHZ 0x03 /* hierarchy priority selection values */ -#define HIER_NO_PRIORITY 0x00 -#define HIER_LOW_PRIORITY 0x01 -#define HIER_HIGH_PRIORITY 0x02 +#define HIER_NO_PRIORITY 0x00 +#define HIER_LOW_PRIORITY 0x01 +#define HIER_HIGH_PRIORITY 0x02 /* constellation available values */ -#define CONST_QPSK 0x00 -#define CONST_QAM16 0x01 -#define CONST_QAM64 0x02 -#define CONST_UNKNOWN 0xFF +#define CONST_QPSK 0x00 +#define CONST_QAM16 0x01 +#define CONST_QAM64 0x02 +#define CONST_UNKNOWN 0xFF /* hierarchy available values */ -#define HIER_NONE 0x00 -#define HIER_ALPHA_1 0x01 -#define HIER_ALPHA_2 0x02 -#define HIER_ALPHA_4 0x03 -#define HIER_UNKNOWN 0xFF +#define HIER_NONE 0x00 +#define HIER_ALPHA_1 0x01 +#define HIER_ALPHA_2 0x02 +#define HIER_ALPHA_4 0x03 +#define HIER_UNKNOWN 0xFF /* interleaving available values */ -#define INTLV_NATIVE 0x00 -#define INTLV_IN_DEPTH 0x01 -#define INTLV_UNKNOWN 0xFF +#define INTLV_NATIVE 0x00 +#define INTLV_IN_DEPTH 0x01 +#define INTLV_UNKNOWN 0xFF /* code rate available values */ -#define CODE_RATE_1_2 0x00 -#define CODE_RATE_2_3 0x01 -#define CODE_RATE_3_4 0x02 -#define CODE_RATE_5_6 0x03 -#define CODE_RATE_7_8 0x04 -#define CODE_RATE_UNKNOWN 0xFF +#define CODE_RATE_1_2 0x00 +#define CODE_RATE_2_3 0x01 +#define CODE_RATE_3_4 0x02 +#define CODE_RATE_5_6 0x03 +#define CODE_RATE_7_8 0x04 +#define CODE_RATE_UNKNOWN 0xFF /* guard interval available values */ -#define GUARD_INT_1_32 0x00 -#define GUARD_INT_1_16 0x01 -#define GUARD_INT_1_8 0x02 -#define GUARD_INT_1_4 0x03 -#define GUARD_UNKNOWN 0xFF +#define GUARD_INT_1_32 0x00 +#define GUARD_INT_1_16 0x01 +#define GUARD_INT_1_8 0x02 +#define GUARD_INT_1_4 0x03 +#define GUARD_UNKNOWN 0xFF /* transmission mode available values */ -#define TRANS_MODE_2K 0x00 -#define TRANS_MODE_8K 0x01 -#define TRANS_MODE_4K 0x02 -#define TRANS_MODE_UNKNOWN 0xFF +#define TRANS_MODE_2K 0x00 +#define TRANS_MODE_8K 0x01 +#define TRANS_MODE_4K 0x02 +#define TRANS_MODE_UNKNOWN 0xFF /* DVBH signalling available values */ -#define TIMESLICING_PRESENT 0x01 -#define MPE_FEC_PRESENT 0x02 +#define TIMESLICING_PRESENT 0x01 +#define MPE_FEC_PRESENT 0x02 /* tune state available */ -#define TUNE_STATUS_NOT_TUNED 0x00 -#define TUNE_STATUS_IDLE 0x01 -#define TUNE_STATUS_LOCKING 0x02 -#define TUNE_STATUS_SIGNAL_DVB_OK 0x03 -#define TUNE_STATUS_STREAM_DETECTED 0x04 -#define TUNE_STATUS_STREAM_TUNED 0x05 -#define TUNE_STATUS_ERROR 0xFF +#define TUNE_STATUS_NOT_TUNED 0x00 +#define TUNE_STATUS_IDLE 0x01 +#define TUNE_STATUS_LOCKING 0x02 +#define TUNE_STATUS_SIGNAL_DVB_OK 0x03 +#define TUNE_STATUS_STREAM_DETECTED 0x04 +#define TUNE_STATUS_STREAM_TUNED 0x05 +#define TUNE_STATUS_ERROR 0xFF /* available TS FID filter types */ -#define TS_PID_TYPE_TS 0 -#define TS_PID_TYPE_PSI_SI 1 -#define TS_PID_TYPE_MPE 2 +#define TS_PID_TYPE_TS 0 +#define TS_PID_TYPE_PSI_SI 1 +#define TS_PID_TYPE_MPE 2 /* number of echos available */ -#define MAX_ECHOS 15 +#define MAX_ECHOS 15 /* Context types */ -#define CONTEXT_LNA 1010 -#define CONTEXT_ELNA_HYSTERESIS 4003 -#define CONTEXT_ELNA_GAIN 4004 -#define CONTEXT_MER_THRESHOLD 5005 -#define CONTEXT_MER_OFFSET 5006 -#define CONTEXT_IR_STATE 7000 -#define CONTEXT_TSOUT_MSB_FIRST 7004 -#define CONTEXT_TSOUT_FALLING_EDGE 7005 +#define CONTEXT_LNA 1010 +#define CONTEXT_ELNA_HYSTERESIS 4003 +#define CONTEXT_ELNA_GAIN 4004 +#define CONTEXT_MER_THRESHOLD 5005 +#define CONTEXT_MER_OFFSET 5006 +#define CONTEXT_IR_STATE 7000 +#define CONTEXT_TSOUT_MSB_FIRST 7004 +#define CONTEXT_TSOUT_FALLING_EDGE 7005 /* Configuration modes */ -#define CFG_MODE_ON 0 -#define CFG_MODE_OFF 1 -#define CFG_MODE_AUTO 2 +#define CFG_MODE_ON 0 +#define CFG_MODE_OFF 1 +#define CFG_MODE_AUTO 2 #pragma pack(1) struct as10x_tps { - uint8_t constellation; - uint8_t hierarchy; - uint8_t interleaving_mode; - uint8_t code_rate_HP; - uint8_t code_rate_LP; - uint8_t guard_interval; - uint8_t transmission_mode; - uint8_t DVBH_mask_HP; - uint8_t DVBH_mask_LP; - uint16_t cell_ID; + uint8_t constellation; + uint8_t hierarchy; + uint8_t interleaving_mode; + uint8_t code_rate_HP; + uint8_t code_rate_LP; + uint8_t guard_interval; + uint8_t transmission_mode; + uint8_t DVBH_mask_HP; + uint8_t DVBH_mask_LP; + uint16_t cell_ID; }; struct as10x_tune_args { - /* frequency */ - uint32_t freq; - /* bandwidth */ - uint8_t bandwidth; - /* hierarchy selection */ - uint8_t hier_select; - /* constellation */ - uint8_t constellation; - /* hierarchy */ - uint8_t hierarchy; - /* interleaving mode */ - uint8_t interleaving_mode; - /* code rate */ - uint8_t code_rate; - /* guard interval */ - uint8_t guard_interval; - /* transmission mode */ - uint8_t transmission_mode; + /* frequency */ + uint32_t freq; + /* bandwidth */ + uint8_t bandwidth; + /* hierarchy selection */ + uint8_t hier_select; + /* constellation */ + uint8_t constellation; + /* hierarchy */ + uint8_t hierarchy; + /* interleaving mode */ + uint8_t interleaving_mode; + /* code rate */ + uint8_t code_rate; + /* guard interval */ + uint8_t guard_interval; + /* transmission mode */ + uint8_t transmission_mode; }; struct as10x_tune_status { - /* tune status */ - uint8_t tune_state; - /* signal strength */ - int16_t signal_strength; - /* packet error rate 10^-4 */ - uint16_t PER; - /* bit error rate 10^-4 */ - uint16_t BER; + /* tune status */ + uint8_t tune_state; + /* signal strength */ + int16_t signal_strength; + /* packet error rate 10^-4 */ + uint16_t PER; + /* bit error rate 10^-4 */ + uint16_t BER; }; struct as10x_demod_stats { - /* frame counter */ - uint32_t frame_count; - /* Bad frame counter */ - uint32_t bad_frame_count; - /* Number of wrong bytes fixed by Reed-Solomon */ - uint32_t bytes_fixed_by_rs; - /* Averaged MER */ - uint16_t mer; - /* statistics calculation state indicator (started or not) */ - uint8_t has_started; + /* frame counter */ + uint32_t frame_count; + /* Bad frame counter */ + uint32_t bad_frame_count; + /* Number of wrong bytes fixed by Reed-Solomon */ + uint32_t bytes_fixed_by_rs; + /* Averaged MER */ + uint16_t mer; + /* statistics calculation state indicator (started or not) */ + uint8_t has_started; }; struct as10x_ts_filter { - uint16_t pid; /** valid PID value 0x00 : 0x2000 */ - uint8_t type; /** Red TS_PID_TYPE_<N> values */ - uint8_t idx; /** index in filtering table */ + uint16_t pid; /** valid PID value 0x00 : 0x2000 */ + uint8_t type; /** Red TS_PID_TYPE_<N> values */ + uint8_t idx; /** index in filtering table */ }; struct as10x_register_value { - uint8_t mode; - union { - uint8_t value8; /* 8 bit value */ - uint16_t value16; /* 16 bit value */ - uint32_t value32; /* 32 bit value */ - }u; + uint8_t mode; + union { + uint8_t value8; /* 8 bit value */ + uint16_t value16; /* 16 bit value */ + uint32_t value32; /* 32 bit value */ + }u; }; #pragma pack() struct as10x_register_addr { - /* register addr */ - uint32_t addr; - /* register mode access */ - uint8_t mode; + /* register addr */ + uint32_t addr; + /* register mode access */ + uint8_t mode; }; ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 4/7] staging/as102: cleanup - formatting code 2011-10-15 20:54 ` [PATCH 4/7] staging/as102: cleanup - formatting code Piotr Chmura @ 2011-10-16 12:23 ` Julian Andres Klode 2011-10-16 12:40 ` Devin Heitmueller 0 siblings, 1 reply; 91+ messages in thread From: Julian Andres Klode @ 2011-10-16 12:23 UTC (permalink / raw) To: Piotr Chmura Cc: Stefan Richter, devel, Devin Heitmueller, Patrick Dickey, Greg KH, Mauro Carvalho Chehab, LMML On Sat, Oct 15, 2011 at 10:54:43PM +0200, Piotr Chmura wrote: > staging as102: cleanup - formatting code > > Cleanup code: change double spaces into single, put tabs instead of spaces where they should be. > > Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> > Cc: Devin Heitmueller<dheitmueller@kernellabs.com> > Cc: Greg HK<gregkh@suse.de> Just a few hints from my side. Most of my comments apply to multiple other parts of the code, but I did not want to quote everything and you should be able to find the other parts I did not mention explicitely as well. I don't have much knowledge of kernel code style, but wanted to point out a few things that seem to be obviously wrong or uncommon, and stuff I wouldn't do. There may be a few false positives and some things missing. [And yes, I actually only wanted to comment on the two-space thing, but I somehow ended up reading the complete patch or the first half of it]. > > diff -Nur linux.as102.03-typedefs/drivers/staging/as102/as102_drv.c linux.as102.04-tabs/drivers/staging/as102/as102_drv.c > --- linux.as102.03-typedefs/drivers/staging/as102/as102_drv.c 2011-10-14 17:55:02.000000000 +0200 > +++ linux.as102.04-tabs/drivers/staging/as102/as102_drv.c 2011-10-14 23:20:05.000000000 +0200 > @@ -10,7 +10,7 @@ > * > * This program is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > * GNU General Public License for more details. > * > * You should have received a copy of the GNU General Public License For reference, the standard variant uses two spaces after the period (aka English Spacing). > -failed: > + failed: > LEAVE(); > /* FIXME: free dvb_XXX */ > return ret; It's more common to have no indentation before labels (about 7 times more common). > @@ -332,7 +332,7 @@ > > /** > * \brief as102 driver exit point. This function is called when device has > - * to be removed. > + * to be removed. > */ Does it make sense to reindent that? If you intent to keep API documentation comments, you want to convert them to kernel-doc style anyway. > dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms, > - 1000); > + 1000); > #endif Seems to be more indentation than really required. > @@ -201,7 +201,7 @@ > break; > case TUNE_STATUS_STREAM_TUNED: > *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC | > - FE_HAS_LOCK; > + FE_HAS_LOCK; > break; I think it looks better with indentation here. Otherwise you might not read the | at the end of the previous line and think FE_HAS_LOCK is a strange macro evaluating to a function call. Moving the operator into the second line would also make this even more clear. > #else > - .release = as102_fe_release, > - .init = as102_fe_init, > + .release = as102_fe_release, > + .init = as102_fe_init, > #endif > }; Is there a reason why struct members are indented using two tabs (here and elsewhere)? > > @@ -393,7 +393,7 @@ > } > > int as102_dvb_register_fe(struct as102_dev_t *as102_dev, > - struct dvb_frontend *dvb_fe) > + struct dvb_frontend *dvb_fe) > { If there's still space to align further to the right, why not use it? It makes the code look better if parameters are aligned below each other (or at least nearly). > int errno; > struct dvb_adapter *dvb_adap; > @@ -407,7 +407,7 @@ > /* init frontend callback ops */ > memcpy(&dvb_fe->ops,&as102_fe_ops, sizeof(struct dvb_frontend_ops)); > strncpy(dvb_fe->ops.info.name, as102_dev->name, > - sizeof(dvb_fe->ops.info.name)); > + sizeof(dvb_fe->ops.info.name)); > It does not seem helpful to align like this, it certainly looks much uglier than the old one which had sizeof aligned with dvb. > /* set frequency */ > @@ -642,32 +642,32 @@ > * if HP/LP are both set to FEC_NONE, HP will be selected. > */ > if ((tune_args->hierarchy != HIER_NONE)&& Misses a space before the && > dprintk(debug, "\thierarchy: 0x%02x " > "selected: %s code_rate_%s: 0x%02x\n", > - tune_args->hierarchy, > - tune_args->hier_select == HIER_HIGH_PRIORITY ? > - "HP" : "LP", > - tune_args->hier_select == HIER_HIGH_PRIORITY ? > - "HP" : "LP", > - tune_args->code_rate); > + tune_args->hierarchy, > + tune_args->hier_select == HIER_HIGH_PRIORITY ? > + "HP" : "LP", > + tune_args->hier_select == HIER_HIGH_PRIORITY ? > + "HP" : "LP", > + tune_args->code_rate); You indented the second argument one level further than the first one. And the third argument even more. > errno = bus_adap->ops->upload_fw_pkt(bus_adap, > - (uint8_t *) > - &fw_pkt, 2, 0); > + (uint8_t *) > + &fw_pkt, 2, 0); Splitting after the "&fw_pkt," seems more sensible, as you have the cast and its operand on the same line then. > > static int as102_usb_start_stream(struct as102_dev_t *dev); > static void as102_usb_stop_stream(struct as102_dev_t *dev); > @@ -38,59 +38,59 @@ > static int as102_release(struct inode *inode, struct file *file); > > static struct usb_device_id as102_usb_id_table[] = { > - { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) }, > - { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) }, > - { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) }, > - { USB_DEVICE(NBOX_DVBT_DONGLE_USB_VID, NBOX_DVBT_DONGLE_USB_PID) }, > - { } /* Terminating entry */ > + { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) }, > + { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) }, > + { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) }, > + { USB_DEVICE(NBOX_DVBT_DONGLE_USB_VID, NBOX_DVBT_DONGLE_USB_PID) }, > + { } /* Terminating entry */ > }; Again, two levels of indentation do not add anything valuable. > > /* Note that this table must always have the same number of entries as the > - as102_usb_id_table struct */ > + as102_usb_id_table struct */ > static const char *as102_device_names[] = { > - AS102_REFERENCE_DESIGN, > - AS102_PCTV_74E, > - AS102_ELGATO_EYETV_DTT_NAME, > - AS102_NBOX_DVBT_DONGLE_NAME, > - NULL /* Terminating entry */ > + AS102_REFERENCE_DESIGN, > + AS102_PCTV_74E, > + AS102_ELGATO_EYETV_DTT_NAME, > + AS102_NBOX_DVBT_DONGLE_NAME, > + NULL /* Terminating entry */ > }; Same here and at a lot of other locations. [I stopped here] -- Julian Andres Klode - Debian Developer, Ubuntu Member See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 4/7] staging/as102: cleanup - formatting code 2011-10-16 12:23 ` Julian Andres Klode @ 2011-10-16 12:40 ` Devin Heitmueller 2011-10-16 21:53 ` Dan Carpenter 0 siblings, 1 reply; 91+ messages in thread From: Devin Heitmueller @ 2011-10-16 12:40 UTC (permalink / raw) To: Julian Andres Klode Cc: Piotr Chmura, Stefan Richter, devel, Patrick Dickey, Greg KH, Mauro Carvalho Chehab, LMML On Sun, Oct 16, 2011 at 8:23 AM, Julian Andres Klode <jak@jak-linux.org> wrote: > On Sat, Oct 15, 2011 at 10:54:43PM +0200, Piotr Chmura wrote: >> staging as102: cleanup - formatting code >> >> Cleanup code: change double spaces into single, put tabs instead of spaces where they should be. >> >> Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> >> Cc: Devin Heitmueller<dheitmueller@kernellabs.com> >> Cc: Greg HK<gregkh@suse.de> > > Just a few hints from my side. Most of my comments apply to multiple other parts > of the code, but I did not want to quote everything and you should be able to > find the other parts I did not mention explicitely as well. > > I don't have much knowledge of kernel code style, but wanted to point out a few > things that seem to be obviously wrong or uncommon, and stuff I wouldn't do. There > may be a few false positives and some things missing. > > [And yes, I actually only wanted to comment on the two-space thing, but I somehow > ended up reading the complete patch or the first half of it]. I think that rather than having Piotr rework the whitespace fifty times until everybody is satisfied, let's get a functional patch series into the staging tree and then people can submit whitespace cleanup patches to their hearts content. That said, Piotr, I would not spend effort reworking the existing patch per Julian's request. Fix the issues related to the history that I mentioned in my previous email (which would be required to get it into staging), and then the people who have nothing better to do than obsess about whitespace can submit incremental patches on top of yours which address their concerns. Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 4/7] staging/as102: cleanup - formatting code 2011-10-16 12:40 ` Devin Heitmueller @ 2011-10-16 21:53 ` Dan Carpenter 0 siblings, 0 replies; 91+ messages in thread From: Dan Carpenter @ 2011-10-16 21:53 UTC (permalink / raw) To: Devin Heitmueller Cc: Julian Andres Klode, devel, Patrick Dickey, Greg KH, Stefan Richter, Piotr Chmura, LMML, Mauro Carvalho Chehab On Sun, Oct 16, 2011 at 08:40:06AM -0400, Devin Heitmueller wrote: > then the people who have nothing better to do than obsess about > whitespace can submit incremental patches You're right that the white space changes aren't needed to get the driver into staging, but there is no need to get snarky about it. Julian was replying to problems that a specific patch introduced and everything he said was correct. Piotr was already going to redo the patches anyway. regards, dan carpenter ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 5/7] staging as102: cleanup - get rid of pragma(pack) [not found] ` <4E9992F9.7000101@poczta.onet.pl> ` (2 preceding siblings ...) 2011-10-15 20:54 ` [PATCH 4/7] staging/as102: cleanup - formatting code Piotr Chmura @ 2011-10-15 20:54 ` Piotr Chmura 3 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-15 20:54 UTC (permalink / raw) To: Stefan Richter Cc: Greg KH, Devin Heitmueller, Mauro Carvalho Chehab, Patrick Dickey, LMML, devel staging as102: cleanup - get rid of pragma(pack) Cleanup code: change #pragma(pack) directive to __attribute__(packed) Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> Cc: Devin Heitmueller<dheitmueller@kernellabs.com> Cc: Greg HK<gregkh@suse.de> diff -Nur linux.as102.04-tabs/drivers/staging/as102/as102_fw.h linux.as102.05-pragmapack//drivers/staging/as102/as102_fw.h --- linux.as102.04-tabs/drivers/staging/as102/as102_fw.h 2011-10-14 23:36:54.000000000 +0200 +++ linux.as102.05-pragmapack//drivers/staging/as102/as102_fw.h 2011-10-14 23:38:24.000000000 +0200 @@ -20,11 +20,10 @@ extern int dual_tuner; -#pragma pack(1) struct as10x_raw_fw_pkt { unsigned char address[4]; unsigned char data[MAX_FW_PKT_SIZE - 6]; -}; +} __attribute__((packed)); struct as10x_fw_pkt_t { union { @@ -32,8 +31,7 @@ unsigned char length[2]; } u; struct as10x_raw_fw_pkt raw; -}; -#pragma pack() +} __attribute__((packed)); #ifdef __KERNEL__ int as102_fw_upload(struct as102_bus_adapter_t *bus_adap); diff -Nur linux.as102.04-tabs/drivers/staging/as102/as10x_cmd.h linux.as102.05-pragmapack//drivers/staging/as102/as10x_cmd.h --- linux.as102.04-tabs/drivers/staging/as102/as10x_cmd.h 2011-10-14 23:34:17.000000000 +0200 +++ linux.as102.05-pragmapack//drivers/staging/as102/as10x_cmd.h 2011-10-14 23:39:06.000000000 +0200 @@ -95,7 +95,6 @@ }; -#pragma pack(1) union TURN_ON { /* request */ struct { @@ -109,7 +108,7 @@ /* error */ uint8_t error; } rsp; -}; +} __attribute__((packed)); union TURN_OFF { /* request */ @@ -124,7 +123,7 @@ /* error */ uint8_t err; } rsp; -}; +} __attribute__((packed)); union SET_TUNE { /* request */ @@ -141,7 +140,7 @@ /* response error */ uint8_t error; } rsp; -}; +} __attribute__((packed)); union GET_TUNE_STATUS { /* request */ @@ -158,7 +157,7 @@ /* tune status */ struct as10x_tune_status sts; } rsp; -}; +} __attribute__((packed)); union GET_TPS { /* request */ @@ -175,7 +174,7 @@ /* tps details */ struct as10x_tps tps; } rsp; -}; +} __attribute__((packed)); union COMMON { /* request */ @@ -190,7 +189,7 @@ /* response error */ uint8_t error; } rsp; -}; +} __attribute__((packed)); union ADD_PID_FILTER { /* request */ @@ -213,7 +212,7 @@ /* Filter id */ uint8_t filter_id; } rsp; -}; +} __attribute__((packed)); union DEL_PID_FILTER { /* request */ @@ -230,7 +229,7 @@ /* response error */ uint8_t error; } rsp; -}; +} __attribute__((packed)); union START_STREAMING { /* request */ @@ -245,7 +244,7 @@ /* error */ uint8_t error; } rsp; -}; +} __attribute__((packed)); union STOP_STREAMING { /* request */ @@ -260,7 +259,7 @@ /* error */ uint8_t error; } rsp; -}; +} __attribute__((packed)); union GET_DEMOD_STATS { /* request */ @@ -277,7 +276,7 @@ /* demod stats */ struct as10x_demod_stats stats; } rsp; -}; +} __attribute__((packed)); union GET_IMPULSE_RESP { /* request */ @@ -294,7 +293,7 @@ /* impulse response ready */ uint8_t is_ready; } rsp; -}; +} __attribute__((packed)); union FW_CONTEXT { /* request */ @@ -319,7 +318,7 @@ /* error */ uint8_t error; } rsp; -}; +} __attribute__((packed)); union SET_REGISTER { /* request */ @@ -338,7 +337,7 @@ /* error */ uint8_t error; } rsp; -}; +} __attribute__((packed)); union GET_REGISTER { /* request */ @@ -357,7 +356,7 @@ /* register content */ struct as10x_register_value reg_val; } rsp; -}; +} __attribute__((packed)); union CFG_CHANGE_MODE { /* request */ @@ -374,14 +373,14 @@ /* error */ uint8_t error; } rsp; -}; +} __attribute__((packed)); struct as10x_cmd_header_t { uint16_t req_id; uint16_t prog; uint16_t version; uint16_t data_len; -}; +} __attribute__((packed)); #define DUMP_BLOCK_SIZE 16 union DUMP_MEMORY { @@ -411,7 +410,7 @@ uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)]; } u; } rsp; -}; +} __attribute__((packed)); union DUMPLOG_MEMORY { struct { @@ -430,7 +429,7 @@ /* dump data */ uint8_t data[DUMP_BLOCK_SIZE]; } rsp; -}; +} __attribute__((packed)); union RAW_DATA { /* request */ @@ -444,7 +443,7 @@ uint8_t error; uint8_t data[64 - sizeof(struct as10x_cmd_header_t) - 2 - 1]; /* 64 - header - proc_id - rc */ } rsp; -}; +} __attribute__((packed)); struct as10x_cmd_t { /* header */ @@ -471,15 +470,14 @@ union DUMPLOG_MEMORY dumplog_memory; union RAW_DATA raw_data; } body; -}; +} __attribute__((packed)); struct as10x_token_cmd_t { /* token cmd */ struct as10x_cmd_t c; /* token response */ struct as10x_cmd_t r; -}; -#pragma pack() +} __attribute__((packed)); /************************/ diff -Nur linux.as102.04-tabs/drivers/staging/as102/as10x_types.h linux.as102.05-pragmapack//drivers/staging/as102/as10x_types.h --- linux.as102.04-tabs/drivers/staging/as102/as10x_types.h 2011-10-14 23:33:20.000000000 +0200 +++ linux.as102.05-pragmapack//drivers/staging/as102/as10x_types.h 2011-10-14 23:40:11.000000000 +0200 @@ -111,7 +111,6 @@ #define CFG_MODE_OFF 1 #define CFG_MODE_AUTO 2 -#pragma pack(1) struct as10x_tps { uint8_t constellation; uint8_t hierarchy; @@ -123,7 +122,7 @@ uint8_t DVBH_mask_HP; uint8_t DVBH_mask_LP; uint16_t cell_ID; -}; +} __attribute__((packed)); struct as10x_tune_args { /* frequency */ @@ -144,7 +143,7 @@ uint8_t guard_interval; /* transmission mode */ uint8_t transmission_mode; -}; +} __attribute__((packed)); struct as10x_tune_status { /* tune status */ @@ -155,7 +154,7 @@ uint16_t PER; /* bit error rate 10^-4 */ uint16_t BER; -}; +} __attribute__((packed)); struct as10x_demod_stats { /* frame counter */ @@ -168,13 +167,13 @@ uint16_t mer; /* statistics calculation state indicator (started or not) */ uint8_t has_started; -}; +} __attribute__((packed)); struct as10x_ts_filter { uint16_t pid; /** valid PID value 0x00 : 0x2000 */ uint8_t type; /** Red TS_PID_TYPE_<N> values */ uint8_t idx; /** index in filtering table */ -}; +} __attribute__((packed)); struct as10x_register_value { uint8_t mode; @@ -183,9 +182,7 @@ uint16_t value16; /* 16 bit value */ uint32_t value32; /* 32 bit value */ }u; -}; - -#pragma pack() +} __attribute__((packed)); struct as10x_register_addr { /* register addr */ ^ permalink raw reply [flat|nested] 91+ messages in thread
[parent not found: <4E999733.2010802@poczta.onet.pl>]
* [PATCH 1/7] Staging submission: PCTV 74e driver (as102) [not found] ` <4E999733.2010802@poczta.onet.pl> @ 2011-10-15 20:54 ` Piotr Chmura 2011-10-16 8:57 ` Stefan Richter 2011-10-15 20:55 ` [PATCH 6/7] staging/as102: cleanup - get rid of editor comments Piotr Chmura 2011-10-15 20:55 ` [PATCH 7/7] staging/as102: cleanup - get rid unnecessary LINUX and WIN32 defines Piotr Chmura 2 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-15 20:54 UTC (permalink / raw) To: Stefan Richter Cc: Greg KH, Devin Heitmueller, Mauro Carvalho Chehab, Patrick Dickey, LMML, devel Staging submission: PCTV 74e driver (as102) From: Devin Heitmueller<dheitmueller@kernellabs.com> pull as102 driver from This is driver for PCTV 74e DVB-T USB tuner, taken from [1], written by Devin Heitmueller using the GPL reference driver provided by Abilis. The only change needed to compile it in current git tree [2] was changing calls usb_buffer_alloc() and usb_buffer_free() to usb_alloc_coherent() and usb_free_coherent(). It's included in this patch. Patch was tested by me on amd64. [1]http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ [2] git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git kernel-3.1.0-git9+ Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> Cc: Devin Heitmueller<dheitmueller@kernellabs.com> Cc: Greg HK<gregkh@suse.de> diff -Nur linux.clean/drivers/staging/as102/as102_drv.c linux.as102_initial/drivers/staging/as102/as102_drv.c --- linux.clean/drivers/staging/as102/as102_drv.c 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as102_drv.c 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,360 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller<dheitmueller@kernellabs.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include<linux/kernel.h> +#include<linux/errno.h> +#include<linux/init.h> +#include<linux/slab.h> +#include<linux/module.h> +#include<linux/mm.h> +#include<linux/kref.h> +#include<asm/uaccess.h> +#include<linux/usb.h> + +/* header file for Usb device driver*/ +#include "as102_drv.h" +#include "as102_fw.h" + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +#include "dvbdev.h" +#else +#warning>>> DVB_CORE not defined !!!<<< +#endif + +int debug; +module_param_named(debug, debug, int, 0644); +MODULE_PARM_DESC(debug, "Turn on/off debugging (default: off)"); + +int dual_tuner; +module_param_named(dual_tuner, dual_tuner, int, 0644); +MODULE_PARM_DESC(dual_tuner, "Activate Dual-Tuner config (default: off)"); + +static int fw_upload = 1; +module_param_named(fw_upload, fw_upload, int, 0644); +MODULE_PARM_DESC(fw_upload, "Turn on/off default FW upload (default: on)"); + +static int pid_filtering; +module_param_named(pid_filtering, pid_filtering, int, 0644); +MODULE_PARM_DESC(pid_filtering, "Activate HW PID filtering (default: off)"); + +static int ts_auto_disable; +module_param_named(ts_auto_disable, ts_auto_disable, int, 0644); +MODULE_PARM_DESC(ts_auto_disable, "Stream Auto Enable on FW (default: off)"); + +int elna_enable = 1; +module_param_named(elna_enable, elna_enable, int, 0644); +MODULE_PARM_DESC(elna_enable, "Activate eLNA (default: on)"); + +#ifdef DVB_DEFINE_MOD_OPT_ADAPTER_NR +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); +#endif + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +static void as102_stop_stream(struct as102_dev_t *dev) +{ + struct as102_bus_adapter_t *bus_adap; + + if (dev != NULL) + bus_adap =&dev->bus_adap; + else + return; + + if (bus_adap->ops->stop_stream != NULL) + bus_adap->ops->stop_stream(dev); + + if (ts_auto_disable) { + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return; + + if (as10x_cmd_stop_streaming(bus_adap)< 0) + dprintk(debug, "as10x_cmd_stop_streaming failed\n"); + + mutex_unlock(&dev->bus_adap.lock); + } +} + +static int as102_start_stream(struct as102_dev_t *dev) +{ + struct as102_bus_adapter_t *bus_adap; + int ret = -EFAULT; + + if (dev != NULL) + bus_adap =&dev->bus_adap; + else + return ret; + + if (bus_adap->ops->start_stream != NULL) + ret = bus_adap->ops->start_stream(dev); + + if (ts_auto_disable) { + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EFAULT; + + ret = as10x_cmd_start_streaming(bus_adap); + + mutex_unlock(&dev->bus_adap.lock); + } + + return ret; +} + +static int as10x_pid_filter(struct as102_dev_t *dev, + int index, u16 pid, int onoff) { + + struct as102_bus_adapter_t *bus_adap =&dev->bus_adap; + int ret = -EFAULT; + + ENTER(); + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) { + dprintk(debug, "mutex_lock_interruptible(lock) failed !\n"); + return -EBUSY; + } + + switch (onoff) { + case 0: + ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) pid); + dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = %d\n", + index, pid, ret); + break; + case 1: + { + struct as10x_ts_filter filter; + + filter.type = TS_PID_TYPE_TS; + filter.idx = 0xFF; + filter.pid = pid; + + ret = as10x_cmd_add_PID_filter(bus_adap,&filter); + dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n", + index, filter.idx, filter.pid, ret); + break; + } + } + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return ret; +} + +static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed) +{ + int ret = 0; + struct dvb_demux *demux = dvbdmxfeed->demux; + struct as102_dev_t *as102_dev = demux->priv; + + ENTER(); + + if (mutex_lock_interruptible(&as102_dev->sem)) + return -ERESTARTSYS; + + if (pid_filtering) { + as10x_pid_filter(as102_dev, + dvbdmxfeed->index, dvbdmxfeed->pid, 1); + } + + if (as102_dev->streaming++ == 0) + ret = as102_start_stream(as102_dev); + + mutex_unlock(&as102_dev->sem); + LEAVE(); + return ret; +} + +static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed) +{ + struct dvb_demux *demux = dvbdmxfeed->demux; + struct as102_dev_t *as102_dev = demux->priv; + + ENTER(); + + if (mutex_lock_interruptible(&as102_dev->sem)) + return -ERESTARTSYS; + + if (--as102_dev->streaming == 0) + as102_stop_stream(as102_dev); + + if (pid_filtering) { + as10x_pid_filter(as102_dev, + dvbdmxfeed->index, dvbdmxfeed->pid, 0); + } + + mutex_unlock(&as102_dev->sem); + LEAVE(); + return 0; +} +#endif + +int as102_dvb_register(struct as102_dev_t *as102_dev) +{ + int ret = 0; + ENTER(); + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) + ret = dvb_register_adapter(&as102_dev->dvb_adap, + as102_dev->name, + THIS_MODULE, +#if defined(CONFIG_AS102_USB) + &as102_dev->bus_adap.usb_dev->dev +#elif defined(CONFIG_AS102_SPI) + &as102_dev->bus_adap.spi_dev->dev +#else +#error>>> dvb_register_adapter<<< +#endif +#ifdef DVB_DEFINE_MOD_OPT_ADAPTER_NR + , adapter_nr +#endif + ); + if (ret< 0) { + err("%s: dvb_register_adapter() failed (errno = %d)", + __func__, ret); + goto failed; + } + + as102_dev->dvb_dmx.priv = as102_dev; + as102_dev->dvb_dmx.filternum = pid_filtering ? 16 : 256; + as102_dev->dvb_dmx.feednum = 256; + as102_dev->dvb_dmx.start_feed = as102_dvb_dmx_start_feed; + as102_dev->dvb_dmx.stop_feed = as102_dvb_dmx_stop_feed; + + as102_dev->dvb_dmx.dmx.capabilities = DMX_TS_FILTERING | + DMX_SECTION_FILTERING; + + as102_dev->dvb_dmxdev.filternum = as102_dev->dvb_dmx.filternum; + as102_dev->dvb_dmxdev.demux =&as102_dev->dvb_dmx.dmx; + as102_dev->dvb_dmxdev.capabilities = 0; + + ret = dvb_dmx_init(&as102_dev->dvb_dmx); + if (ret< 0) { + err("%s: dvb_dmx_init() failed (errno = %d)", __func__, ret); + goto failed; + } + + ret = dvb_dmxdev_init(&as102_dev->dvb_dmxdev,&as102_dev->dvb_adap); + if (ret< 0) { + err("%s: dvb_dmxdev_init() failed (errno = %d)", __func__, + ret); + goto failed; + } + + ret = as102_dvb_register_fe(as102_dev,&as102_dev->dvb_fe); + if (ret< 0) { + err("%s: as102_dvb_register_frontend() failed (errno = %d)", + __func__, ret); + goto failed; + } +#endif + + /* init bus mutex for token locking */ + mutex_init(&as102_dev->bus_adap.lock); + + /* init start / stop stream mutex */ + mutex_init(&as102_dev->sem); + +#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) + /* + * try to load as102 firmware. If firmware upload failed, we'll be + * able to upload it later. + */ + if (fw_upload) + try_then_request_module(as102_fw_upload(&as102_dev->bus_adap), + "firmware_class"); +#endif + +failed: + LEAVE(); + /* FIXME: free dvb_XXX */ + return ret; +} + +void as102_dvb_unregister(struct as102_dev_t *as102_dev) +{ + ENTER(); + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) + /* unregister as102 frontend */ + as102_dvb_unregister_fe(&as102_dev->dvb_fe); + + /* unregister demux device */ + dvb_dmxdev_release(&as102_dev->dvb_dmxdev); + dvb_dmx_release(&as102_dev->dvb_dmx); + + /* unregister dvb adapter */ + dvb_unregister_adapter(&as102_dev->dvb_adap); +#endif + LEAVE(); +} + +static int __init as102_driver_init(void) +{ + int ret = 0; + + ENTER(); + + /* register this driver with the low level subsystem */ +#if defined(CONFIG_AS102_USB) + ret = usb_register(&as102_usb_driver); + if (ret) + err("usb_register failed (ret = %d)", ret); +#endif +#if defined(CONFIG_AS102_SPI) + ret = spi_register_driver(&as102_spi_driver); + if (ret) + printk(KERN_ERR "spi_register failed (ret = %d)", ret); +#endif + + LEAVE(); + return ret; +} + +/* + * Mandatory function : Adds a special section to the module indicating + * where initialisation function is defined + */ +module_init(as102_driver_init); + +/** + * \brief as102 driver exit point. This function is called when device has + * to be removed. + */ +static void __exit as102_driver_exit(void) +{ + ENTER(); + /* deregister this driver with the low level bus subsystem */ +#if defined(CONFIG_AS102_USB) + usb_deregister(&as102_usb_driver); +#endif +#if defined(CONFIG_AS102_SPI) + spi_unregister_driver(&as102_spi_driver); +#endif + LEAVE(); +} + +/* + * required function for unload: Adds a special section to the module + * indicating where unload function is defined + */ +module_exit(as102_driver_exit); +/* modinfo details */ +MODULE_DESCRIPTION(DRIVER_FULL_NAME); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Pierrick Hascoet<pierrick.hascoet@abilis.com>"); + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.clean/drivers/staging/as102/as102_drv.h linux.as102_initial/drivers/staging/as102/as102_drv.h --- linux.clean/drivers/staging/as102/as102_drv.h 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as102_drv.h 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,147 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if defined(CONFIG_AS102_USB) +#include<linux/usb.h> +extern struct usb_driver as102_usb_driver; +#endif + +#if defined(CONFIG_AS102_SPI) +#include<linux/platform_device.h> +#include<linux/spi/spi.h> +#include<linux/cdev.h> + +extern struct spi_driver as102_spi_driver; +#endif + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +#include "dvb_demux.h" +#include "dvb_frontend.h" +#include "dmxdev.h" +#endif + +#define DRIVER_FULL_NAME "Abilis Systems as10x usb driver" +#define DRIVER_NAME "as10x_usb" + +extern int debug; + +#define dprintk(debug, args...) \ + do { if (debug) { \ + printk(KERN_DEBUG "%s: ",__FUNCTION__); \ + printk(args); \ + } } while (0) + +#ifdef TRACE +#define ENTER() printk(">> enter %s\n", __FUNCTION__) +#define LEAVE() printk("<< leave %s\n", __FUNCTION__) +#else +#define ENTER() +#define LEAVE() +#endif + +#define AS102_DEVICE_MAJOR 192 + +#define AS102_USB_BUF_SIZE 512 +#define MAX_STREAM_URB 32 + +#include "as10x_cmd.h" + +#if defined(CONFIG_AS102_USB) +#include "as102_usb_drv.h" +#endif + +#if defined(CONFIG_AS102_SPI) +#include "as10x_spi_drv.h" +#endif + + +struct as102_bus_adapter_t { +#if defined(CONFIG_AS102_USB) + struct usb_device *usb_dev; +#elif defined(CONFIG_AS102_SPI) + struct spi_device *spi_dev; + struct cdev cdev; /* spidev raw device */ + + struct timer_list timer; + struct completion xfer_done; +#endif + /* bus token lock */ + struct mutex lock; + /* low level interface for bus adapter */ + union as10x_bus_token_t { +#if defined(CONFIG_AS102_USB) + /* usb token */ + struct as10x_usb_token_cmd_t usb; +#endif +#if defined(CONFIG_AS102_SPI) + /* spi token */ + struct as10x_spi_token_cmd_t spi; +#endif + } token; + + /* token cmd xfer id */ + uint16_t cmd_xid; + + /* as10x command and response for dvb interface*/ + struct as10x_cmd_t *cmd, *rsp; + + /* bus adapter private ops callback */ + struct as102_priv_ops_t *ops; +}; + +struct as102_dev_t { + const char *name; + struct as102_bus_adapter_t bus_adap; + struct list_head device_entry; + struct kref kref; + unsigned long minor; + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) + struct dvb_adapter dvb_adap; + struct dvb_frontend dvb_fe; + struct dvb_demux dvb_dmx; + struct dmxdev dvb_dmxdev; +#endif + + /* demodulator stats */ + struct as10x_demod_stats demod_stats; + /* signal strength */ + uint16_t signal_strength; + /* bit error rate */ + uint32_t ber; + + /* timer handle to trig ts stream download */ + struct timer_list timer_handle; + + struct mutex sem; + dma_addr_t dma_addr; + void *stream; + int streaming; + struct urb *stream_urb[MAX_STREAM_URB]; +}; + +int as102_dvb_register(struct as102_dev_t *dev); +void as102_dvb_unregister(struct as102_dev_t *dev); + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +int as102_dvb_register_fe(struct as102_dev_t *dev, struct dvb_frontend *fe); +int as102_dvb_unregister_fe(struct dvb_frontend *dev); +#endif + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.clean/drivers/staging/as102/as102_fe.c linux.as102_initial/drivers/staging/as102/as102_fe.c --- linux.clean/drivers/staging/as102/as102_fe.c 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as102_fe.c 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,675 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller<dheitmueller@kernellabs.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include<linux/version.h> + +#include "as102_drv.h" +#include "as10x_types.h" +#include "as10x_cmd.h" + +extern int elna_enable; + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst, + struct as10x_tps *src); + +static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst, + struct dvb_frontend_parameters *src); + +#if (LINUX_VERSION_CODE< KERNEL_VERSION(2, 6, 19)) +static void as102_fe_release(struct dvb_frontend *fe) +{ + struct as102_dev_t *dev; + + ENTER(); + + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) + return; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return; + + /* send abilis command: TURN_OFF */ + as10x_cmd_turn_off(&dev->bus_adap); + + mutex_unlock(&dev->bus_adap.lock); + + /* release frontend callback ops */ + memset(&fe->ops, 0, sizeof(struct dvb_frontend_ops)); + + /* flush statistics */ + memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); + dev->signal_strength = 0; + dev->ber = -1; + + /* reset tuner private data */ +/* fe->tuner_priv = NULL; */ + + LEAVE(); +} + +static int as102_fe_init(struct dvb_frontend *fe) +{ + int ret = 0; + struct as102_dev_t *dev; + + ENTER(); + + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) + return -ENODEV; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + if (elna_enable) + ret = as10x_cmd_set_context(&dev->bus_adap, 1010, 0xC0); + + /* send abilis command: TURN_ON */ + ret = as10x_cmd_turn_on(&dev->bus_adap); + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return (ret< 0) ? -EINVAL : 0; +} +#endif + +static int as102_fe_set_frontend(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params) +{ + int ret = 0; + struct as102_dev_t *dev; + struct as10x_tune_args tune_args = { 0 }; + + ENTER(); + + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) + return -ENODEV; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + as102_fe_copy_tune_parameters(&tune_args, params); + + /* send abilis command: SET_TUNE */ + ret = as10x_cmd_set_tune(&dev->bus_adap,&tune_args); + if (ret != 0) + dprintk(debug, "as10x_cmd_set_tune failed. (err = %d)\n", ret); + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return (ret< 0) ? -EINVAL : 0; +} + +static int as102_fe_get_frontend(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p) { + int ret = 0; + struct as102_dev_t *dev; + struct as10x_tps tps = { 0 }; + + ENTER(); + + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) + return -EINVAL; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + /* send abilis command: GET_TPS */ + ret = as10x_cmd_get_tps(&dev->bus_adap,&tps); + + if (ret == 0) + as10x_fe_copy_tps_parameters(p,&tps); + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return (ret< 0) ? -EINVAL : 0; +} + +static int as102_fe_get_tune_settings(struct dvb_frontend *fe, + struct dvb_frontend_tune_settings *settings) { + ENTER(); + +#if 0 + dprintk(debug, "step_size = %d\n", settings->step_size); + dprintk(debug, "max_drift = %d\n", settings->max_drift); + dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms, + 1000); +#endif + + settings->min_delay_ms = 1000; + + LEAVE(); + return 0; +} + + +static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) +{ + int ret = 0; + struct as102_dev_t *dev; + struct as10x_tune_status tstate = { 0 }; + + ENTER(); + + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) + return -ENODEV; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + /* send abilis command: GET_TUNE_STATUS */ + ret = as10x_cmd_get_tune_status(&dev->bus_adap,&tstate); + if (ret< 0) { + dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n", + ret); + goto out; + } + + dev->signal_strength = tstate.signal_strength; + dev->ber = tstate.BER; + + switch (tstate.tune_state) { + case TUNE_STATUS_SIGNAL_DVB_OK: + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER; + break; + case TUNE_STATUS_STREAM_DETECTED: + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC; + break; + case TUNE_STATUS_STREAM_TUNED: + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC | + FE_HAS_LOCK; + break; + default: + *status = TUNE_STATUS_NOT_TUNED; + } + + dprintk(debug, "tuner status: 0x%02x, strength %d, per: %d, ber: %d\n", + tstate.tune_state, tstate.signal_strength, + tstate.PER, tstate.BER); + + if (*status& FE_HAS_LOCK) { + if (as10x_cmd_get_demod_stats(&dev->bus_adap, + (struct as10x_demod_stats *)&dev->demod_stats)< 0) { + memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); + dprintk(debug, "as10x_cmd_get_demod_stats failed " + "(probably not tuned)\n"); + } else { + dprintk(debug, + "demod status: fc: 0x%08x, bad fc: 0x%08x, " + "bytes corrected: 0x%08x , MER: 0x%04x\n", + dev->demod_stats.frame_count, + dev->demod_stats.bad_frame_count, + dev->demod_stats.bytes_fixed_by_rs, + dev->demod_stats.mer); + } + } else { + memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); + } + +out: + mutex_unlock(&dev->bus_adap.lock); + LEAVE(); + return ret; +} + +/* + * Note: + * - in AS102 SNR=MER + * - the SNR will be returned in linear terms, i.e. not in dB + * - the accuracy equals ±2dB for a SNR range from 4dB to 30dB + * - the accuracy is>2dB for SNR values outside this range + */ +static int as102_fe_read_snr(struct dvb_frontend *fe, u16 *snr) +{ + struct as102_dev_t *dev; + + ENTER(); + + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) + return -ENODEV; + + *snr = dev->demod_stats.mer; + + LEAVE(); + return 0; +} + +static int as102_fe_read_ber(struct dvb_frontend *fe, u32 *ber) +{ + struct as102_dev_t *dev; + + ENTER(); + + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) + return -ENODEV; + + *ber = dev->ber; + + LEAVE(); + return 0; +} + +static int as102_fe_read_signal_strength(struct dvb_frontend *fe, + u16 *strength) +{ + struct as102_dev_t *dev; + + ENTER(); + + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) + return -ENODEV; + + *strength = (((0xffff * 400) * dev->signal_strength + 41000) * 2); + + LEAVE(); + return 0; +} + +static int as102_fe_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) +{ + struct as102_dev_t *dev; + + ENTER(); + + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) + return -ENODEV; + + if (dev->demod_stats.has_started) + *ucblocks = dev->demod_stats.bad_frame_count; + else + *ucblocks = 0; + + LEAVE(); + return 0; +} + +#if (LINUX_VERSION_CODE>= KERNEL_VERSION(2, 6, 19)) +static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) +{ + struct as102_dev_t *dev; + int ret; + + ENTER(); + + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) + return -ENODEV; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + if (acquire) { + if (elna_enable) + as10x_cmd_set_context(&dev->bus_adap, 1010, 0xC0); + + ret = as10x_cmd_turn_on(&dev->bus_adap); + } else { + ret = as10x_cmd_turn_off(&dev->bus_adap); + } + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return ret; +} +#endif + +static struct dvb_frontend_ops as102_fe_ops = { + .info = { + .name = "Unknown AS102 device", + .type = FE_OFDM, + .frequency_min = 174000000, + .frequency_max = 862000000, + .frequency_stepsize = 166667, + .caps = FE_CAN_INVERSION_AUTO + | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 + | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO + | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QPSK + | FE_CAN_QAM_AUTO + | FE_CAN_TRANSMISSION_MODE_AUTO + | FE_CAN_GUARD_INTERVAL_AUTO + | FE_CAN_HIERARCHY_AUTO + | FE_CAN_RECOVER + | FE_CAN_MUTE_TS + }, + + .set_frontend = as102_fe_set_frontend, + .get_frontend = as102_fe_get_frontend, + .get_tune_settings = as102_fe_get_tune_settings, + + + .read_status = as102_fe_read_status, + .read_snr = as102_fe_read_snr, + .read_ber = as102_fe_read_ber, + .read_signal_strength = as102_fe_read_signal_strength, + .read_ucblocks = as102_fe_read_ucblocks, + +#if (LINUX_VERSION_CODE>= KERNEL_VERSION(2, 6, 19)) + .ts_bus_ctrl = as102_fe_ts_bus_ctrl, +#else + .release = as102_fe_release, + .init = as102_fe_init, +#endif +}; + +int as102_dvb_unregister_fe(struct dvb_frontend *fe) +{ + /* unregister frontend */ + dvb_unregister_frontend(fe); + +#if (LINUX_VERSION_CODE>= KERNEL_VERSION(2, 6, 19)) + /* detach frontend */ + dvb_frontend_detach(fe); +#endif + return 0; +} + +int as102_dvb_register_fe(struct as102_dev_t *as102_dev, + struct dvb_frontend *dvb_fe) +{ + int errno; + struct dvb_adapter *dvb_adap; + + if (as102_dev == NULL) + return -EINVAL; + + /* extract dvb_adapter */ + dvb_adap =&as102_dev->dvb_adap; + + /* init frontend callback ops */ + memcpy(&dvb_fe->ops,&as102_fe_ops, sizeof(struct dvb_frontend_ops)); + strncpy(dvb_fe->ops.info.name, as102_dev->name, + sizeof(dvb_fe->ops.info.name)); + + /* register dbvb frontend */ + errno = dvb_register_frontend(dvb_adap, dvb_fe); + if (errno == 0) + dvb_fe->tuner_priv = as102_dev; + + return errno; +} + +static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst, + struct as10x_tps *as10x_tps) +{ + + struct dvb_ofdm_parameters *fe_tps =&dst->u.ofdm; + + /* extract consteallation */ + switch (as10x_tps->constellation) { + case CONST_QPSK: + fe_tps->constellation = QPSK; + break; + case CONST_QAM16: + fe_tps->constellation = QAM_16; + break; + case CONST_QAM64: + fe_tps->constellation = QAM_64; + break; + } + + /* extract hierarchy */ + switch (as10x_tps->hierarchy) { + case HIER_NONE: + fe_tps->hierarchy_information = HIERARCHY_NONE; + break; + case HIER_ALPHA_1: + fe_tps->hierarchy_information = HIERARCHY_1; + break; + case HIER_ALPHA_2: + fe_tps->hierarchy_information = HIERARCHY_2; + break; + case HIER_ALPHA_4: + fe_tps->hierarchy_information = HIERARCHY_4; + break; + } + + /* extract code rate HP */ + switch (as10x_tps->code_rate_HP) { + case CODE_RATE_1_2: + fe_tps->code_rate_HP = FEC_1_2; + break; + case CODE_RATE_2_3: + fe_tps->code_rate_HP = FEC_2_3; + break; + case CODE_RATE_3_4: + fe_tps->code_rate_HP = FEC_3_4; + break; + case CODE_RATE_5_6: + fe_tps->code_rate_HP = FEC_5_6; + break; + case CODE_RATE_7_8: + fe_tps->code_rate_HP = FEC_7_8; + break; + } + + /* extract code rate LP */ + switch (as10x_tps->code_rate_LP) { + case CODE_RATE_1_2: + fe_tps->code_rate_LP = FEC_1_2; + break; + case CODE_RATE_2_3: + fe_tps->code_rate_LP = FEC_2_3; + break; + case CODE_RATE_3_4: + fe_tps->code_rate_LP = FEC_3_4; + break; + case CODE_RATE_5_6: + fe_tps->code_rate_LP = FEC_5_6; + break; + case CODE_RATE_7_8: + fe_tps->code_rate_LP = FEC_7_8; + break; + } + + /* extract guard interval */ + switch (as10x_tps->guard_interval) { + case GUARD_INT_1_32: + fe_tps->guard_interval = GUARD_INTERVAL_1_32; + break; + case GUARD_INT_1_16: + fe_tps->guard_interval = GUARD_INTERVAL_1_16; + break; + case GUARD_INT_1_8: + fe_tps->guard_interval = GUARD_INTERVAL_1_8; + break; + case GUARD_INT_1_4: + fe_tps->guard_interval = GUARD_INTERVAL_1_4; + break; + } + + /* extract transmission mode */ + switch (as10x_tps->transmission_mode) { + case TRANS_MODE_2K: + fe_tps->transmission_mode = TRANSMISSION_MODE_2K; + break; + case TRANS_MODE_8K: + fe_tps->transmission_mode = TRANSMISSION_MODE_8K; + break; + } +} + +static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg) +{ + uint8_t c; + + switch (arg) { + case FEC_1_2: + c = CODE_RATE_1_2; + break; + case FEC_2_3: + c = CODE_RATE_2_3; + break; + case FEC_3_4: + c = CODE_RATE_3_4; + break; + case FEC_5_6: + c = CODE_RATE_5_6; + break; + case FEC_7_8: + c = CODE_RATE_7_8; + break; + default: + c = CODE_RATE_UNKNOWN; + break; + } + + return c; +} + +static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args, + struct dvb_frontend_parameters *params) +{ + + /* set frequency */ + tune_args->freq = params->frequency / 1000; + + /* fix interleaving_mode */ + tune_args->interleaving_mode = INTLV_NATIVE; + + switch (params->u.ofdm.bandwidth) { + case BANDWIDTH_8_MHZ: + tune_args->bandwidth = BW_8_MHZ; + break; + case BANDWIDTH_7_MHZ: + tune_args->bandwidth = BW_7_MHZ; + break; + case BANDWIDTH_6_MHZ: + tune_args->bandwidth = BW_6_MHZ; + break; + default: + tune_args->bandwidth = BW_8_MHZ; + } + + switch (params->u.ofdm.guard_interval) { + case GUARD_INTERVAL_1_32: + tune_args->guard_interval = GUARD_INT_1_32; + break; + case GUARD_INTERVAL_1_16: + tune_args->guard_interval = GUARD_INT_1_16; + break; + case GUARD_INTERVAL_1_8: + tune_args->guard_interval = GUARD_INT_1_8; + break; + case GUARD_INTERVAL_1_4: + tune_args->guard_interval = GUARD_INT_1_4; + break; + case GUARD_INTERVAL_AUTO: + default: + tune_args->guard_interval = GUARD_UNKNOWN; + break; + } + + switch (params->u.ofdm.constellation) { + case QPSK: + tune_args->constellation = CONST_QPSK; + break; + case QAM_16: + tune_args->constellation = CONST_QAM16; + break; + case QAM_64: + tune_args->constellation = CONST_QAM64; + break; + default: + tune_args->constellation = CONST_UNKNOWN; + break; + } + + switch (params->u.ofdm.transmission_mode) { + case TRANSMISSION_MODE_2K: + tune_args->transmission_mode = TRANS_MODE_2K; + break; + case TRANSMISSION_MODE_8K: + tune_args->transmission_mode = TRANS_MODE_8K; + break; + default: + tune_args->transmission_mode = TRANS_MODE_UNKNOWN; + } + + switch (params->u.ofdm.hierarchy_information) { + case HIERARCHY_NONE: + tune_args->hierarchy = HIER_NONE; + break; + case HIERARCHY_1: + tune_args->hierarchy = HIER_ALPHA_1; + break; + case HIERARCHY_2: + tune_args->hierarchy = HIER_ALPHA_2; + break; + case HIERARCHY_4: + tune_args->hierarchy = HIER_ALPHA_4; + break; + case HIERARCHY_AUTO: + tune_args->hierarchy = HIER_UNKNOWN; + break; + } + + dprintk(debug, "tuner parameters: freq: %d bw: 0x%02x gi: 0x%02x\n", + params->frequency, + tune_args->bandwidth, + tune_args->guard_interval); + + /* + * Detect a hierarchy selection + * if HP/LP are both set to FEC_NONE, HP will be selected. + */ + if ((tune_args->hierarchy != HIER_NONE)&& + ((params->u.ofdm.code_rate_LP == FEC_NONE) || + (params->u.ofdm.code_rate_HP == FEC_NONE))) { + + if (params->u.ofdm.code_rate_LP == FEC_NONE) { + tune_args->hier_select = HIER_HIGH_PRIORITY; + tune_args->code_rate = + as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); + } + + if (params->u.ofdm.code_rate_HP == FEC_NONE) { + tune_args->hier_select = HIER_LOW_PRIORITY; + tune_args->code_rate = + as102_fe_get_code_rate(params->u.ofdm.code_rate_LP); + } + + dprintk(debug, "\thierarchy: 0x%02x " + "selected: %s code_rate_%s: 0x%02x\n", + tune_args->hierarchy, + tune_args->hier_select == HIER_HIGH_PRIORITY ? + "HP" : "LP", + tune_args->hier_select == HIER_HIGH_PRIORITY ? + "HP" : "LP", + tune_args->code_rate); + } else { + tune_args->code_rate = + as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); + } +} +#endif + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.clean/drivers/staging/as102/as102_fw.c linux.as102_initial/drivers/staging/as102/as102_fw.c --- linux.clean/drivers/staging/as102/as102_fw.c 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as102_fw.c 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,251 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller<dheitmueller@kernellabs.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include<linux/kernel.h> +#include<linux/errno.h> +#include<linux/ctype.h> +#include<linux/delay.h> +#include<linux/firmware.h> + +#include "as102_drv.h" +#include "as102_fw.h" + +#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) +char as102_st_fw1[] = "as102_data1_st.hex"; +char as102_st_fw2[] = "as102_data2_st.hex"; +char as102_dt_fw1[] = "as102_data1_dt.hex"; +char as102_dt_fw2[] = "as102_data2_dt.hex"; + +static unsigned char atohx(unsigned char *dst, char *src) +{ + unsigned char value = 0; + + char msb = tolower(*src) - '0'; + char lsb = tolower(*(src + 1)) - '0'; + + if (msb> 9) + msb -= 7; + if (lsb> 9) + lsb -= 7; + + *dst = value = ((msb& 0xF)<< 4) | (lsb& 0xF); + return value; +} + +/* + * Parse INTEL HEX firmware file to extract address and data. + */ +static int parse_hex_line(unsigned char *fw_data, unsigned char *addr, + unsigned char *data, int *dataLength, + unsigned char *addr_has_changed) { + + int count = 0; + unsigned char *src, dst; + + if (*fw_data++ != ':') { + printk(KERN_ERR "invalid firmware file\n"); + return -EFAULT; + } + + /* locate end of line */ + for (src = fw_data; *src != '\n'; src += 2) { + atohx(&dst, src); + /* parse line to split addr / data */ + switch (count) { + case 0: + *dataLength = dst; + break; + case 1: + addr[2] = dst; + break; + case 2: + addr[3] = dst; + break; + case 3: + /* check if data is an address */ + if (dst == 0x04) + *addr_has_changed = 1; + else + *addr_has_changed = 0; + break; + case 4: + case 5: + if (*addr_has_changed) + addr[(count - 4)] = dst; + else + data[(count - 4)] = dst; + break; + default: + data[(count - 4)] = dst; + break; + } + count++; + } + + /* return read value + ':' + '\n' */ + return (count * 2) + 2; +} + +static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap, + unsigned char *cmd, + const struct firmware *firmware) { + + struct as10x_fw_pkt_t fw_pkt; + int total_read_bytes = 0, errno = 0; + unsigned char addr_has_changed = 0; + + ENTER(); + + for (total_read_bytes = 0; total_read_bytes< firmware->size; ) { + int read_bytes = 0, data_len = 0; + + /* parse intel hex line */ + read_bytes = parse_hex_line( + (u8 *) (firmware->data + total_read_bytes), + fw_pkt.raw.address, + fw_pkt.raw.data, + &data_len, + &addr_has_changed); + + if (read_bytes<= 0) + goto error; + + /* detect the end of file */ + total_read_bytes += read_bytes; + if (total_read_bytes == firmware->size) { + fw_pkt.u.request[0] = 0x00; + fw_pkt.u.request[1] = 0x03; + + /* send EOF command */ + errno = bus_adap->ops->upload_fw_pkt(bus_adap, + (uint8_t *) + &fw_pkt, 2, 0); + if (errno< 0) + goto error; + } else { + if (!addr_has_changed) { + /* prepare command to send */ + fw_pkt.u.request[0] = 0x00; + fw_pkt.u.request[1] = 0x01; + + data_len += sizeof(fw_pkt.u.request); + data_len += sizeof(fw_pkt.raw.address); + + /* send cmd to device */ + errno = bus_adap->ops->upload_fw_pkt(bus_adap, + (uint8_t *) + &fw_pkt, + data_len, + 0); + if (errno< 0) + goto error; + } + } + } +error: + LEAVE(); + return (errno == 0) ? total_read_bytes : errno; +} + +int as102_fw_upload(struct as102_bus_adapter_t *bus_adap) +{ + int errno = -EFAULT; + const struct firmware *firmware; + unsigned char *cmd_buf = NULL; + char *fw1, *fw2; + +#if defined(CONFIG_AS102_USB) + struct usb_device *dev = bus_adap->usb_dev; +#endif +#if defined(CONFIG_AS102_SPI) + struct spi_device *dev = bus_adap->spi_dev; +#endif + ENTER(); + + /* select fw file to upload */ + if (dual_tuner) { + fw1 = as102_dt_fw1; + fw2 = as102_dt_fw2; + } else { + fw1 = as102_st_fw1; + fw2 = as102_st_fw2; + } + +#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) + /* allocate buffer to store firmware upload command and data */ + cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL); + if (cmd_buf == NULL) { + errno = -ENOMEM; + goto error; + } + + /* request kernel to locate firmware file: part1 */ + errno = request_firmware(&firmware, fw1,&dev->dev); + if (errno< 0) { + printk(KERN_ERR "%s: unable to locate firmware file: %s\n", + DRIVER_NAME, fw1); + goto error; + } + + /* initiate firmware upload */ + errno = as102_firmware_upload(bus_adap, cmd_buf, firmware); + if (errno< 0) { + printk(KERN_ERR "%s: error during firmware upload part1\n", + DRIVER_NAME); + goto error; + } + + printk(KERN_INFO "%s: fimrware: %s loaded with success\n", + DRIVER_NAME, fw1); + release_firmware(firmware); + + /* wait for boot to complete */ + mdelay(100); + + /* request kernel to locate firmware file: part2 */ + errno = request_firmware(&firmware, fw2,&dev->dev); + if (errno< 0) { + printk(KERN_ERR "%s: unable to locate firmware file: %s\n", + DRIVER_NAME, fw2); + goto error; + } + + /* initiate firmware upload */ + errno = as102_firmware_upload(bus_adap, cmd_buf, firmware); + if (errno< 0) { + printk(KERN_ERR "%s: error during firmware upload part2\n", + DRIVER_NAME); + goto error; + } + + printk(KERN_INFO "%s: fimrware: %s loaded with success\n", + DRIVER_NAME, fw2); +error: + /* free data buffer */ + kfree(cmd_buf); + /* release firmware if needed */ + if (firmware != NULL) + release_firmware(firmware); +#endif + LEAVE(); + return errno; +} +#endif + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.clean/drivers/staging/as102/as102_fw.h linux.as102_initial/drivers/staging/as102/as102_fw.h --- linux.clean/drivers/staging/as102/as102_fw.h 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as102_fw.h 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,42 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#define MAX_FW_PKT_SIZE 64 + +extern int dual_tuner; + +#pragma pack(1) +struct as10x_raw_fw_pkt { + unsigned char address[4]; + unsigned char data[MAX_FW_PKT_SIZE - 6]; +}; + +struct as10x_fw_pkt_t { + union { + unsigned char request[2]; + unsigned char length[2]; + } u; + struct as10x_raw_fw_pkt raw; +}; +#pragma pack() + +#ifdef __KERNEL__ +int as102_fw_upload(struct as102_bus_adapter_t *bus_adap); +#endif + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.clean/drivers/staging/as102/as102_usb_drv.c linux.as102_initial/drivers/staging/as102/as102_usb_drv.c --- linux.clean/drivers/staging/as102/as102_usb_drv.c 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as102_usb_drv.c 2011-10-14 18:00:19.000000000 +0200 @@ -0,0 +1,484 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller<dheitmueller@kernellabs.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include<linux/kernel.h> +#include<linux/errno.h> +#include<linux/slab.h> +#include<linux/mm.h> +#include<linux/usb.h> + +#include "as102_drv.h" +#include "as102_usb_drv.h" +#include "as102_fw.h" + +static void as102_usb_disconnect(struct usb_interface *interface); +static int as102_usb_probe(struct usb_interface *interface, + const struct usb_device_id *id); + +static int as102_usb_start_stream(struct as102_dev_t *dev); +static void as102_usb_stop_stream(struct as102_dev_t *dev); + +static int as102_open(struct inode *inode, struct file *file); +static int as102_release(struct inode *inode, struct file *file); + +static struct usb_device_id as102_usb_id_table[] = { + { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) }, + { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) }, + { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) }, + { } /* Terminating entry */ +}; + +/* Note that this table must always have the same number of entries as the + as102_usb_id_table struct */ +static const char *as102_device_names[] = { + AS102_REFERENCE_DESIGN, + AS102_PCTV_74E, + AS102_ELGATO_EYETV_DTT_NAME, + NULL /* Terminating entry */ +}; + +struct usb_driver as102_usb_driver = { + .name = DRIVER_FULL_NAME, + .probe = as102_usb_probe, + .disconnect = as102_usb_disconnect, + .id_table = as102_usb_id_table +}; + +static const struct file_operations as102_dev_fops = { + .owner = THIS_MODULE, + .open = as102_open, + .release = as102_release, +}; + +static struct usb_class_driver as102_usb_class_driver = { + .name = "aton2-%d", + .fops =&as102_dev_fops, + .minor_base = AS102_DEVICE_MAJOR, +}; + +static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap, + unsigned char *send_buf, int send_buf_len, + unsigned char *recv_buf, int recv_buf_len) +{ + int ret = 0; + ENTER(); + + if (send_buf != NULL) { + ret = usb_control_msg(bus_adap->usb_dev, + usb_sndctrlpipe(bus_adap->usb_dev, 0), + AS102_USB_DEVICE_TX_CTRL_CMD, + USB_DIR_OUT | USB_TYPE_VENDOR | + USB_RECIP_DEVICE, + bus_adap->cmd_xid, /* value */ + 0, /* index */ + send_buf, send_buf_len, + USB_CTRL_SET_TIMEOUT /* 200 */); + if (ret< 0) { + dprintk(debug, "usb_control_msg(send) failed, err %i\n", + ret); + return ret; + } + + if (ret != send_buf_len) { + dprintk(debug, "only wrote %d of %d bytes\n", + ret, send_buf_len); + return -1; + } + } + + if (recv_buf != NULL) { +#ifdef TRACE + dprintk(debug, "want to read: %d bytes\n", recv_buf_len); +#endif + ret = usb_control_msg(bus_adap->usb_dev, + usb_rcvctrlpipe(bus_adap->usb_dev, 0), + AS102_USB_DEVICE_RX_CTRL_CMD, + USB_DIR_IN | USB_TYPE_VENDOR | + USB_RECIP_DEVICE, + bus_adap->cmd_xid, /* value */ + 0, /* index */ + recv_buf, recv_buf_len, + USB_CTRL_GET_TIMEOUT /* 200 */); + if (ret< 0) { + dprintk(debug, "usb_control_msg(recv) failed, err %i\n", + ret); + return ret; + } +#ifdef TRACE + dprintk(debug, "read %d bytes\n", recv_buf_len); +#endif + } + + LEAVE(); + return ret; +} + +static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap, + unsigned char *send_buf, + int send_buf_len, + int swap32) +{ + int ret = 0, actual_len; + + ret = usb_bulk_msg(bus_adap->usb_dev, + usb_sndbulkpipe(bus_adap->usb_dev, 1), + send_buf, send_buf_len,&actual_len, 200); + if (ret) { + dprintk(debug, "usb_bulk_msg(send) failed, err %i\n", ret); + return ret; + } + + if (actual_len != send_buf_len) { + dprintk(debug, "only wrote %d of %d bytes\n", + actual_len, send_buf_len); + return -1; + } + return ret ? ret : actual_len; +} + +static int as102_read_ep2(struct as102_bus_adapter_t *bus_adap, + unsigned char *recv_buf, int recv_buf_len) +{ + int ret = 0, actual_len; + + if (recv_buf == NULL) + return -EINVAL; + + ret = usb_bulk_msg(bus_adap->usb_dev, + usb_rcvbulkpipe(bus_adap->usb_dev, 2), + recv_buf, recv_buf_len,&actual_len, 200); + if (ret) { + dprintk(debug, "usb_bulk_msg(recv) failed, err %i\n", ret); + return ret; + } + + if (actual_len != recv_buf_len) { + dprintk(debug, "only read %d of %d bytes\n", + actual_len, recv_buf_len); + return -1; + } + return ret ? ret : actual_len; +} + +struct as102_priv_ops_t as102_priv_ops = { + .upload_fw_pkt = as102_send_ep1, + .xfer_cmd = as102_usb_xfer_cmd, + .as102_read_ep2 = as102_read_ep2, + .start_stream = as102_usb_start_stream, + .stop_stream = as102_usb_stop_stream, +}; + +static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb) +{ + int err; + + usb_fill_bulk_urb(urb, + dev->bus_adap.usb_dev, + usb_rcvbulkpipe(dev->bus_adap.usb_dev, 0x2), + urb->transfer_buffer, + AS102_USB_BUF_SIZE, + as102_urb_stream_irq, + dev); + + err = usb_submit_urb(urb, GFP_ATOMIC); + if (err) + dprintk(debug, "%s: usb_submit_urb failed\n", __func__); + + return err; +} + +#if (LINUX_VERSION_CODE<= KERNEL_VERSION(2, 6, 18)) +void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs) +#else +void as102_urb_stream_irq(struct urb *urb) +#endif +{ + struct as102_dev_t *as102_dev = urb->context; + + if (urb->actual_length> 0) { +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) + dvb_dmx_swfilter(&as102_dev->dvb_dmx, + urb->transfer_buffer, + urb->actual_length); +#else + /* do nothing ? */ +#endif + } else { + if (urb->actual_length == 0) + memset(urb->transfer_buffer, 0, AS102_USB_BUF_SIZE); + } + + /* is not stopped, re-submit urb */ + if (as102_dev->streaming) + as102_submit_urb_stream(as102_dev, urb); +} + +static void as102_free_usb_stream_buffer(struct as102_dev_t *dev) +{ + int i; + + ENTER(); + + for (i = 0; i< MAX_STREAM_URB; i++) + usb_free_urb(dev->stream_urb[i]); + + usb_free_coherent(dev->bus_adap.usb_dev, + MAX_STREAM_URB * AS102_USB_BUF_SIZE, + dev->stream, + dev->dma_addr); + LEAVE(); +} + +static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) +{ + int i, ret = 0; + + ENTER(); + + dev->stream = usb_alloc_coherent(dev->bus_adap.usb_dev, + MAX_STREAM_URB * AS102_USB_BUF_SIZE, + GFP_KERNEL, + &dev->dma_addr); + if (!dev->stream) { + dprintk(debug, "%s: usb_buffer_alloc failed\n", __func__); + return -ENOMEM; + } + + memset(dev->stream, 0, MAX_STREAM_URB * AS102_USB_BUF_SIZE); + + /* init urb buffers */ + for (i = 0; i< MAX_STREAM_URB; i++) { + struct urb *urb; + + urb = usb_alloc_urb(0, GFP_ATOMIC); + if (urb == NULL) { + dprintk(debug, "%s: usb_alloc_urb failed\n", __func__); + as102_free_usb_stream_buffer(dev); + return -ENOMEM; + } + + urb->transfer_buffer = dev->stream + (i * AS102_USB_BUF_SIZE); + urb->transfer_buffer_length = AS102_USB_BUF_SIZE; + + dev->stream_urb[i] = urb; + } + LEAVE(); + return ret; +} + +static void as102_usb_stop_stream(struct as102_dev_t *dev) +{ + int i; + + for (i = 0; i< MAX_STREAM_URB; i++) + usb_kill_urb(dev->stream_urb[i]); +} + +static int as102_usb_start_stream(struct as102_dev_t *dev) +{ + int i, ret = 0; + + for (i = 0; i< MAX_STREAM_URB; i++) { + ret = as102_submit_urb_stream(dev, dev->stream_urb[i]); + if (ret) { + as102_usb_stop_stream(dev); + return ret; + } + } + + return 0; +} + +static void as102_usb_release(struct kref *kref) +{ + struct as102_dev_t *as102_dev; + + ENTER(); + + as102_dev = container_of(kref, struct as102_dev_t, kref); + if (as102_dev != NULL) { + usb_put_dev(as102_dev->bus_adap.usb_dev); + kfree(as102_dev); + } + + LEAVE(); +} + +static void as102_usb_disconnect(struct usb_interface *intf) +{ + struct as102_dev_t *as102_dev; + + ENTER(); + + /* extract as102_dev_t from usb_device private data */ + as102_dev = usb_get_intfdata(intf); + + /* unregister dvb layer */ + as102_dvb_unregister(as102_dev); + + /* free usb buffers */ + as102_free_usb_stream_buffer(as102_dev); + + usb_set_intfdata(intf, NULL); + + /* usb unregister device */ + usb_deregister_dev(intf,&as102_usb_class_driver); + + /* decrement usage counter */ + kref_put(&as102_dev->kref, as102_usb_release); + + printk(KERN_INFO "%s: device has been disconnected\n", DRIVER_NAME); + + LEAVE(); +} + +static int as102_usb_probe(struct usb_interface *intf, + const struct usb_device_id *id) +{ + int ret; + struct as102_dev_t *as102_dev; + int i; + + ENTER(); + + as102_dev = kzalloc(sizeof(struct as102_dev_t), GFP_KERNEL); + if (as102_dev == NULL) { + err("%s: kzalloc failed", __func__); + return -ENOMEM; + } + + /* This should never actually happen */ + if ((sizeof(as102_usb_id_table) / sizeof(struct usb_device_id)) != + (sizeof(as102_device_names) / sizeof(const char *))) { + printk(KERN_ERR "Device names table invalid size"); + return -EINVAL; + } + + /* Assign the user-friendly device name */ + for (i = 0; i< (sizeof(as102_usb_id_table) / + sizeof(struct usb_device_id)); i++) { + if (id ==&as102_usb_id_table[i]) + as102_dev->name = as102_device_names[i]; + } + + if (as102_dev->name == NULL) + as102_dev->name = "Unknown AS102 device"; + + /* set private callback functions */ + as102_dev->bus_adap.ops =&as102_priv_ops; + + /* init cmd token for usb bus */ + as102_dev->bus_adap.cmd =&as102_dev->bus_adap.token.usb.c; + as102_dev->bus_adap.rsp =&as102_dev->bus_adap.token.usb.r; + + /* init kernel device reference */ + kref_init(&as102_dev->kref); + + /* store as102 device to usb_device private data */ + usb_set_intfdata(intf, (void *) as102_dev); + + /* store in as102 device the usb_device pointer */ + as102_dev->bus_adap.usb_dev = usb_get_dev(interface_to_usbdev(intf)); + + /* we can register the device now, as it is ready */ + ret = usb_register_dev(intf,&as102_usb_class_driver); + if (ret< 0) { + /* something prevented us from registering this driver */ + err("%s: usb_register_dev() failed (errno = %d)", + __func__, ret); + goto failed; + } + + printk(KERN_INFO "%s: device has been detected\n", DRIVER_NAME); + + /* request buffer allocation for streaming */ + ret = as102_alloc_usb_stream_buffer(as102_dev); + if (ret != 0) + goto failed; + + /* register dvb layer */ + ret = as102_dvb_register(as102_dev); + + LEAVE(); + return ret; + +failed: + usb_set_intfdata(intf, NULL); + kfree(as102_dev); + return ret; +} + +static int as102_open(struct inode *inode, struct file *file) +{ + int ret = 0, minor = 0; + struct usb_interface *intf = NULL; + struct as102_dev_t *dev = NULL; + + ENTER(); + + /* read minor from inode */ + minor = iminor(inode); + + /* fetch device from usb interface */ + intf = usb_find_interface(&as102_usb_driver, minor); + if (intf == NULL) { + printk(KERN_ERR "%s: can't find device for minor %d\n", + __func__, minor); + ret = -ENODEV; + goto exit; + } + + /* get our device */ + dev = usb_get_intfdata(intf); + if (dev == NULL) { + ret = -EFAULT; + goto exit; + } + + /* save our device object in the file's private structure */ + file->private_data = dev; + + /* increment our usage count for the device */ + kref_get(&dev->kref); + +exit: + LEAVE(); + return ret; +} + +static int as102_release(struct inode *inode, struct file *file) +{ + int ret = 0; + struct as102_dev_t *dev = NULL; + + ENTER(); + + dev = file->private_data; + if (dev != NULL) { + /* decrement the count on our device */ + kref_put(&dev->kref, as102_usb_release); + } + + LEAVE(); + return ret; +} + +MODULE_DEVICE_TABLE(usb, as102_usb_id_table); + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.clean/drivers/staging/as102/as102_usb_drv.h linux.as102_initial/drivers/staging/as102/as102_usb_drv.h --- linux.clean/drivers/staging/as102/as102_usb_drv.h 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as102_usb_drv.h 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,59 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller<dheitmueller@kernellabs.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include<linux/version.h> + +#ifndef _AS102_USB_DRV_H_ +#define _AS102_USB_DRV_H_ + +#define AS102_USB_DEVICE_TX_CTRL_CMD 0xF1 +#define AS102_USB_DEVICE_RX_CTRL_CMD 0xF2 + +/* define these values to match the supported devices */ + +/* Abilis system: "TITAN" */ +#define AS102_REFERENCE_DESIGN "Abilis Systems DVB-Titan" +#define AS102_USB_DEVICE_VENDOR_ID 0x1BA6 +#define AS102_USB_DEVICE_PID_0001 0x0001 + +/* PCTV Systems: PCTV picoStick (74e) */ +#define AS102_PCTV_74E "PCTV Systems picoStick (74e)" +#define PCTV_74E_USB_VID 0x2013 +#define PCTV_74E_USB_PID 0x0246 + +/* Elgato: EyeTV DTT Deluxe */ +#define AS102_ELGATO_EYETV_DTT_NAME "Elgato EyeTV DTT Deluxe" +#define ELGATO_EYETV_DTT_USB_VID 0x0fd9 +#define ELGATO_EYETV_DTT_USB_PID 0x002c + +#if (LINUX_VERSION_CODE<= KERNEL_VERSION(2, 6, 18)) +void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs); +#else +void as102_urb_stream_irq(struct urb *urb); +#endif + + +struct as10x_usb_token_cmd_t { + /* token cmd */ + struct as10x_cmd_t c; + /* token response */ + struct as10x_cmd_t r; +}; +#endif +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.clean/drivers/staging/as102/as10x_cmd.c linux.as102_initial/drivers/staging/as102/as10x_cmd.c --- linux.clean/drivers/staging/as102/as10x_cmd.c 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as10x_cmd.c 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,481 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller<dheitmueller@kernellabs.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if defined(LINUX)&& defined(__KERNEL__) /* linux kernel implementation */ +#include<linux/kernel.h> +#include "as102_drv.h" +#elif defined(WIN32) + #if defined(__BUILDMACHINE__)&& (__BUILDMACHINE__ == WinDDK) + /* win32 ddk implementation */ + #include "wdm.h" + #include "Device.h" + #include "endian_mgmt.h" /* FIXME */ + #else /* win32 sdk implementation */ + #include<windows.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" + #endif +#else /* all other cases */ + #include<string.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" /* FIXME */ +#endif /* __KERNEL__ */ + +#include "as10x_types.h" +#include "as10x_cmd.h" + +/** + \brief send turn on command to AS10x + \param phandle: pointer to AS10x handle + \return 0 when no error,< 0 in case of error. + \callgraph +*/ +int as10x_cmd_turn_on(as10x_handle_t *phandle) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.turn_on.req)); + + /* fill command */ + pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON); + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.turn_on.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.turn_on.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP); + +out: + LEAVE(); + return error; +} + +/** + \brief send turn off command to AS10x + \param phandle: pointer to AS10x handle + \return 0 when no error,< 0 in case of error. + \callgraph +*/ +int as10x_cmd_turn_off(as10x_handle_t *phandle) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.turn_off.req)); + + /* fill command */ + pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF); + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( + phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.turn_off.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP); + +out: + LEAVE(); + return error; +} + +/** + \brief send set tune command to AS10x + \param phandle: pointer to AS10x handle + \param ptune: tune parameters + \return 0 when no error,< 0 in case of error. + \callgraph + */ +int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune) +{ + int error; + struct as10x_cmd_t *preq, *prsp; + + ENTER(); + + preq = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(preq, (++phandle->cmd_xid), + sizeof(preq->body.set_tune.req)); + + /* fill command */ + preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE); + preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq); + preq->body.set_tune.req.args.bandwidth = ptune->bandwidth; + preq->body.set_tune.req.args.hier_select = ptune->hier_select; + preq->body.set_tune.req.args.constellation = ptune->constellation; + preq->body.set_tune.req.args.hierarchy = ptune->hierarchy; + preq->body.set_tune.req.args.interleaving_mode = + ptune->interleaving_mode; + preq->body.set_tune.req.args.code_rate = ptune->code_rate; + preq->body.set_tune.req.args.guard_interval = ptune->guard_interval; + preq->body.set_tune.req.args.transmission_mode = + ptune->transmission_mode; + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) preq, + sizeof(preq->body.set_tune.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.set_tune.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP); + +out: + LEAVE(); + return error; +} + +/** + \brief send get tune status command to AS10x + \param phandle: pointer to AS10x handle + \param pstatus: pointer to updated status structure of the current tune + \return 0 when no error,< 0 in case of error. + \callgraph + */ +int as10x_cmd_get_tune_status(as10x_handle_t *phandle, + struct as10x_tune_status *pstatus) +{ + int error; + struct as10x_cmd_t *preq, *prsp; + + ENTER(); + + preq = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(preq, (++phandle->cmd_xid), + sizeof(preq->body.get_tune_status.req)); + + /* fill command */ + preq->body.get_tune_status.req.proc_id = + cpu_to_le16(CONTROL_PROC_GETTUNESTAT); + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( + phandle, + (uint8_t *) preq, + sizeof(preq->body.get_tune_status.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP); + if (error< 0) + goto out; + + /* Response OK -> get response data */ + pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state; + pstatus->signal_strength = + le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength); + pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER); + pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER); + +out: + LEAVE(); + return error; +} + +/** + \brief send get TPS command to AS10x + \param phandle: pointer to AS10x handle + \param ptps: pointer to TPS parameters structure + \return 0 when no error,< 0 in case of error. + \callgraph + */ +int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_tps.req)); + + /* fill command */ + pcmd->body.get_tune_status.req.proc_id = + cpu_to_le16(CONTROL_PROC_GETTPS); + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_tps.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_tps.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP); + if (error< 0) + goto out; + + /* Response OK -> get response data */ + ptps->constellation = prsp->body.get_tps.rsp.tps.constellation; + ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy; + ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode; + ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP; + ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP; + ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval; + ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode; + ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP; + ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP; + ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID); + +out: + LEAVE(); + return error; +} + +/** + \brief send get demod stats command to AS10x + \param phandle: pointer to AS10x handle + \param pdemod_stats: pointer to demod stats parameters structure + \return 0 when no error,< 0 in case of error. + \callgraph +*/ +int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, + struct as10x_demod_stats *pdemod_stats) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_demod_stats.req)); + + /* fill command */ + pcmd->body.get_demod_stats.req.proc_id = + cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_demod_stats.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_demod_stats.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_DEMOD_STATS_RSP); + if (error< 0) + goto out; + + /* Response OK -> get response data */ + pdemod_stats->frame_count = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count); + pdemod_stats->bad_frame_count = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count); + pdemod_stats->bytes_fixed_by_rs = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs); + pdemod_stats->mer = + le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer); + pdemod_stats->has_started = + prsp->body.get_demod_stats.rsp.stats.has_started; + +out: + LEAVE(); + return error; +} + +/** + \brief send get impulse response command to AS10x + \param phandle: pointer to AS10x handle + \param is_ready: pointer to value indicating when impulse + response data is ready + \return 0 when no error,< 0 in case of error. + \callgraph +*/ +int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, + uint8_t *is_ready) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_impulse_rsp.req)); + + /* fill command */ + pcmd->body.get_impulse_rsp.req.proc_id = + cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_impulse_rsp.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_impulse_rsp.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_IMPULSE_RESP_RSP); + if (error< 0) + goto out; + + /* Response OK -> get response data */ + *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready; + +out: + LEAVE(); + return error; +} + + + +/** + \brief build AS10x command header + \param pcmd: pointer to AS10x command buffer + \param xid: sequence id of the command + \param cmd_len: lenght of the command + \return - + \callgraph +*/ +void as10x_cmd_build(struct as10x_cmd_t *pcmd, + uint16_t xid, uint16_t cmd_len) +{ + pcmd->header.req_id = cpu_to_le16(xid); + pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID); + pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION); + pcmd->header.data_len = cpu_to_le16(cmd_len); +} + +/** + \brief Parse command response + \param pcmd: pointer to AS10x command buffer + \param cmd_seqid: sequence id of the command + \param cmd_len: lenght of the command + \return 0 when no error,< 0 in case of error + \callgraph +*/ +int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) +{ + int error; + + /* extract command error code */ + error = prsp->body.common.rsp.error; + + if ((error == 0)&& + (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) { + return 0; + } + + return AS10X_CMD_ERROR; +} + + diff -Nur linux.clean/drivers/staging/as102/as10x_cmd_cfg.c linux.as102_initial/drivers/staging/as102/as10x_cmd_cfg.c --- linux.clean/drivers/staging/as102/as10x_cmd_cfg.c 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as10x_cmd_cfg.c 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,238 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if defined(LINUX)&& defined(__KERNEL__) /* linux kernel implementation */ +#include<linux/kernel.h> +#include "as102_drv.h" +#elif defined(WIN32) + #if defined(__BUILDMACHINE__)&& (__BUILDMACHINE__ == WinDDK) + /* win32 ddk implementation */ + #include "wdm.h" + #include "Device.h" + #include "endian_mgmt.h" /* FIXME */ + #else /* win32 sdk implementation */ + #include<windows.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" + #endif +#else /* all other cases */ + #include<string.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" /* FIXME */ +#endif /* __KERNEL__ */ + +#include "as10x_types.h" +#include "as10x_cmd.h" + +/***************************/ +/* FUNCTION DEFINITION */ +/***************************/ + +/** + \brief send get context command to AS10x + \param phandle: pointer to AS10x handle + \param tag: context tag + \param pvalue: pointer where to store context value read + \return 0 when no error,< 0 in case of error. + \callgraph +*/ +int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag, + uint32_t *pvalue) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.context.req)); + + /* fill command */ + pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); + pcmd->body.context.req.tag = cpu_to_le16(tag); + pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA); + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.context.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.context.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response: context command do not follow the common response */ + /* structure -> specific handling response parse required */ + error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); + + if (error == 0) { + /* Response OK -> get response data */ + *pvalue = le32_to_cpu(prsp->body.context.rsp.reg_val.u.value32); + /* value returned is always a 32-bit value */ + } + +out: + LEAVE(); + return error; +} + +/** + \brief send set context command to AS10x + \param phandle: pointer to AS10x handle + \param tag: context tag + \param value: value to set in context + \return 0 when no error,< 0 in case of error. + \callgraph +*/ +int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag, + uint32_t value) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.context.req)); + + /* fill command */ + pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); + /* pcmd->body.context.req.reg_val.mode initialization is not required */ + pcmd->body.context.req.reg_val.u.value32 = cpu_to_le32(value); + pcmd->body.context.req.tag = cpu_to_le16(tag); + pcmd->body.context.req.type = cpu_to_le16(SET_CONTEXT_DATA); + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.context.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.context.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response: context command do not follow the common response */ + /* structure -> specific handling response parse required */ + error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); + +out: + LEAVE(); + return error; +} + +/** + \brief send eLNA change mode command to AS10x + \param phandle: pointer to AS10x handle + \param tag: context tag + \param mode: mode selected: + - ON : 0x0 => eLNA always ON + - OFF : 0x1 => eLNA always OFF + - AUTO : 0x2 => eLNA follow hysteresis parameters to be + ON or OFF + \return 0 when no error,< 0 in case of error. + \callgraph +*/ +int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.cfg_change_mode.req)); + + /* fill command */ + pcmd->body.cfg_change_mode.req.proc_id = + cpu_to_le16(CONTROL_PROC_ELNA_CHANGE_MODE); + pcmd->body.cfg_change_mode.req.mode = mode; + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.cfg_change_mode.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.cfg_change_mode.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_ELNA_CHANGE_MODE_RSP); + +out: + LEAVE(); + return error; +} + +/** + \brief Parse context command response. Since this command does not follow + the common response, a specific parse function is required. + \param prsp: pointer to AS10x command response buffer + \param proc_id: id of the command + \return 0 when no error,< 0 in case of error. + ABILIS_RC_NOK + \callgraph +*/ +int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) +{ + int err; + + err = prsp->body.context.rsp.error; + + if ((err == 0)&& + (le16_to_cpu(prsp->body.context.rsp.proc_id) == proc_id)) { + return 0; + } + return AS10X_CMD_ERROR; +} diff -Nur linux.clean/drivers/staging/as102/as10x_cmd.h linux.as102_initial/drivers/staging/as102/as10x_cmd.h --- linux.clean/drivers/staging/as102/as10x_cmd.h 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as10x_cmd.h 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,540 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifndef _AS10X_CMD_H_ +#define _AS10X_CMD_H_ + +#ifdef __KERNEL__ +#include<linux/kernel.h> +#endif + +#include "as10x_types.h" + +/*********************************/ +/* MACRO DEFINITIONS */ +/*********************************/ +#define AS10X_CMD_ERROR -1 + +#define SERVICE_PROG_ID 0x0002 +#define SERVICE_PROG_VERSION 0x0001 + +#define HIER_NONE 0x00 +#define HIER_LOW_PRIORITY 0x01 + +#define HEADER_SIZE (sizeof(struct as10x_cmd_header_t)) + +/* context request types */ +#define GET_CONTEXT_DATA 1 +#define SET_CONTEXT_DATA 2 + +/* ODSP suspend modes */ +#define CFG_MODE_ODSP_RESUME 0 +#define CFG_MODE_ODSP_SUSPEND 1 + +/* Dump memory size */ +#define DUMP_BLOCK_SIZE_MAX 0x20 + +/*********************************/ +/* TYPE DEFINITION */ +/*********************************/ +typedef enum { + CONTROL_PROC_TURNON = 0x0001, + CONTROL_PROC_TURNON_RSP = 0x0100, + CONTROL_PROC_SET_REGISTER = 0x0002, + CONTROL_PROC_SET_REGISTER_RSP = 0x0200, + CONTROL_PROC_GET_REGISTER = 0x0003, + CONTROL_PROC_GET_REGISTER_RSP = 0x0300, + CONTROL_PROC_SETTUNE = 0x000A, + CONTROL_PROC_SETTUNE_RSP = 0x0A00, + CONTROL_PROC_GETTUNESTAT = 0x000B, + CONTROL_PROC_GETTUNESTAT_RSP = 0x0B00, + CONTROL_PROC_GETTPS = 0x000D, + CONTROL_PROC_GETTPS_RSP = 0x0D00, + CONTROL_PROC_SETFILTER = 0x000E, + CONTROL_PROC_SETFILTER_RSP = 0x0E00, + CONTROL_PROC_REMOVEFILTER = 0x000F, + CONTROL_PROC_REMOVEFILTER_RSP = 0x0F00, + CONTROL_PROC_GET_IMPULSE_RESP = 0x0012, + CONTROL_PROC_GET_IMPULSE_RESP_RSP = 0x1200, + CONTROL_PROC_START_STREAMING = 0x0013, + CONTROL_PROC_START_STREAMING_RSP = 0x1300, + CONTROL_PROC_STOP_STREAMING = 0x0014, + CONTROL_PROC_STOP_STREAMING_RSP = 0x1400, + CONTROL_PROC_GET_DEMOD_STATS = 0x0015, + CONTROL_PROC_GET_DEMOD_STATS_RSP = 0x1500, + CONTROL_PROC_ELNA_CHANGE_MODE = 0x0016, + CONTROL_PROC_ELNA_CHANGE_MODE_RSP = 0x1600, + CONTROL_PROC_ODSP_CHANGE_MODE = 0x0017, + CONTROL_PROC_ODSP_CHANGE_MODE_RSP = 0x1700, + CONTROL_PROC_AGC_CHANGE_MODE = 0x0018, + CONTROL_PROC_AGC_CHANGE_MODE_RSP = 0x1800, + + CONTROL_PROC_CONTEXT = 0x00FC, + CONTROL_PROC_CONTEXT_RSP = 0xFC00, + CONTROL_PROC_DUMP_MEMORY = 0x00FD, + CONTROL_PROC_DUMP_MEMORY_RSP = 0xFD00, + CONTROL_PROC_DUMPLOG_MEMORY = 0x00FE, + CONTROL_PROC_DUMPLOG_MEMORY_RSP = 0xFE00, + CONTROL_PROC_TURNOFF = 0x00FF, + CONTROL_PROC_TURNOFF_RSP = 0xFF00 +} control_proc; + + +#pragma pack(1) +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} TURN_ON; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t err; + } rsp; +} TURN_OFF; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* tune params */ + struct as10x_tune_args args; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + } rsp; +} SET_TUNE; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + /* tune status */ + struct as10x_tune_status sts; + } rsp; +} GET_TUNE_STATUS; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + /* tps details */ + struct as10x_tps tps; + } rsp; +} GET_TPS; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + } rsp; +} COMMON; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* PID to filter */ + uint16_t pid; + /* stream type (MPE, PSI/SI or PES )*/ + uint8_t stream_type; + /* PID index in filter table */ + uint8_t idx; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + /* Filter id */ + uint8_t filter_id; + } rsp; +} ADD_PID_FILTER; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* PID to remove */ + uint16_t pid; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + } rsp; +} DEL_PID_FILTER; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} START_STREAMING; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} STOP_STREAMING; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* demod stats */ + struct as10x_demod_stats stats; + } rsp; +} GET_DEMOD_STATS; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* impulse response ready */ + uint8_t is_ready; + } rsp; +} GET_IMPULSE_RESP; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* value to write (for set context)*/ + struct as10x_register_value reg_val; + /* context tag */ + uint16_t tag; + /* context request type */ + uint16_t type; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* value read (for get context) */ + struct as10x_register_value reg_val; + /* context request type */ + uint16_t type; + /* error */ + uint8_t error; + } rsp; +} FW_CONTEXT; + +typedef union { + /* request */ + struct { + /* response identifier */ + uint16_t proc_id; + /* register description */ + struct as10x_register_addr reg_addr; + /* register content */ + struct as10x_register_value reg_val; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} SET_REGISTER; + +typedef union { + /* request */ + struct { + /* response identifier */ + uint16_t proc_id; + /* register description */ + struct as10x_register_addr reg_addr; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* register content */ + struct as10x_register_value reg_val; + } rsp; +} GET_REGISTER; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* mode */ + uint8_t mode; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} CFG_CHANGE_MODE; + +struct as10x_cmd_header_t { + uint16_t req_id; + uint16_t prog; + uint16_t version; + uint16_t data_len; +}; + +#define DUMP_BLOCK_SIZE 16 +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* dump memory type request */ + uint8_t dump_req; + /* register description */ + struct as10x_register_addr reg_addr; + /* nb blocks to read */ + uint16_t num_blocks; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* dump response */ + uint8_t dump_rsp; + /* data */ + union { + uint8_t data8[DUMP_BLOCK_SIZE]; + uint16_t data16[DUMP_BLOCK_SIZE / sizeof(uint16_t)]; + uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)]; + } u; + } rsp; +} DUMP_MEMORY; + +typedef union { + struct { + /* request identifier */ + uint16_t proc_id; + /* dump memory type request */ + uint8_t dump_req; + } req; + struct { + /* request identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* dump response */ + uint8_t dump_rsp; + /* dump data */ + uint8_t data[DUMP_BLOCK_SIZE]; + } rsp; +} DUMPLOG_MEMORY; + +typedef union { + /* request */ + struct { + uint16_t proc_id; + uint8_t data[64 - sizeof(struct as10x_cmd_header_t) -2 /* proc_id */]; + } req; + /* response */ + struct { + uint16_t proc_id; + uint8_t error; + uint8_t data[64 - sizeof(struct as10x_cmd_header_t) /* header */ + - 2 /* proc_id */ - 1 /* rc */]; + } rsp; +} RAW_DATA; + +struct as10x_cmd_t { + /* header */ + struct as10x_cmd_header_t header; + /* body */ + union { + TURN_ON turn_on; + TURN_OFF turn_off; + SET_TUNE set_tune; + GET_TUNE_STATUS get_tune_status; + GET_TPS get_tps; + COMMON common; + ADD_PID_FILTER add_pid_filter; + DEL_PID_FILTER del_pid_filter; + START_STREAMING start_streaming; + STOP_STREAMING stop_streaming; + GET_DEMOD_STATS get_demod_stats; + GET_IMPULSE_RESP get_impulse_rsp; + FW_CONTEXT context; + SET_REGISTER set_register; + GET_REGISTER get_register; + CFG_CHANGE_MODE cfg_change_mode; + DUMP_MEMORY dump_memory; + DUMPLOG_MEMORY dumplog_memory; + RAW_DATA raw_data; + } body; +}; + +struct as10x_token_cmd_t { + /* token cmd */ + struct as10x_cmd_t c; + /* token response */ + struct as10x_cmd_t r; +}; +#pragma pack() + + +/**************************/ +/* FUNCTION DECLARATION */ +/**************************/ + +void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id, + uint16_t cmd_len); +int as10x_rsp_parse(struct as10x_cmd_t *r, uint16_t proc_id); + +#ifdef __cplusplus +extern "C" { +#endif + +/* as10x cmd */ +int as10x_cmd_turn_on(as10x_handle_t *phandle); +int as10x_cmd_turn_off(as10x_handle_t *phandle); + +int as10x_cmd_set_tune(as10x_handle_t *phandle, + struct as10x_tune_args *ptune); + +int as10x_cmd_get_tune_status(as10x_handle_t *phandle, + struct as10x_tune_status *pstatus); + +int as10x_cmd_get_tps(as10x_handle_t *phandle, + struct as10x_tps *ptps); + +int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, + struct as10x_demod_stats *pdemod_stats); + +int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, + uint8_t *is_ready); + +/* as10x cmd stream */ +int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, + struct as10x_ts_filter *filter); +int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, + uint16_t pid_value); + +int as10x_cmd_start_streaming(as10x_handle_t *phandle); +int as10x_cmd_stop_streaming(as10x_handle_t *phandle); + +/* as10x cmd cfg */ +int as10x_cmd_set_context(as10x_handle_t *phandle, + uint16_t tag, + uint32_t value); +int as10x_cmd_get_context(as10x_handle_t *phandle, + uint16_t tag, + uint32_t *pvalue); + +int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode); +int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id); +#ifdef __cplusplus +} +#endif +#endif +/* EOF - vim: set textwidth=80 ts=3 sw=3 sts=3 et: */ diff -Nur linux.clean/drivers/staging/as102/as10x_cmd_stream.c linux.as102_initial/drivers/staging/as102/as10x_cmd_stream.c --- linux.clean/drivers/staging/as102/as10x_cmd_stream.c 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as10x_cmd_stream.c 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,247 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#if defined(LINUX)&& defined(__KERNEL__) /* linux kernel implementation */ +#include<linux/kernel.h> +#include "as102_drv.h" +#elif defined(WIN32) + #if defined(DDK) /* win32 ddk implementation */ + #include "wdm.h" + #include "Device.h" + #include "endian_mgmt.h" /* FIXME */ + #else /* win32 sdk implementation */ + #include<windows.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" + #endif +#else /* all other cases */ + #include<string.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" /* FIXME */ +#endif /* __KERNEL__ */ + +#include "as10x_cmd.h" + + +/** + \brief send add filter command to AS10x + \param phandle: pointer to AS10x handle + \param filter: TSFilter filter for DVB-T + \param pfilter_handle: pointer where to store filter handle + \return 0 when no error,< 0 in case of error. + \callgraph +*/ +int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, + struct as10x_ts_filter *filter) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.add_pid_filter.req)); + + /* fill command */ + pcmd->body.add_pid_filter.req.proc_id = + cpu_to_le16(CONTROL_PROC_SETFILTER); + pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid); + pcmd->body.add_pid_filter.req.stream_type = filter->type; + + if (filter->idx< 16) + pcmd->body.add_pid_filter.req.idx = filter->idx; + else + pcmd->body.add_pid_filter.req.idx = 0xFF; + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.add_pid_filter.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.add_pid_filter.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP); + + if (error == 0) { + /* Response OK -> get response data */ + filter->idx = prsp->body.add_pid_filter.rsp.filter_id; + } + +out: + LEAVE(); + return error; +} + +/** + \brief Send delete filter command to AS10x + \param phandle: pointer to AS10x handle + \param filter_handle: filter handle + \return 0 when no error,< 0 in case of error. + \callgraph +*/ +int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, + uint16_t pid_value) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.del_pid_filter.req)); + + /* fill command */ + pcmd->body.del_pid_filter.req.proc_id = + cpu_to_le16(CONTROL_PROC_REMOVEFILTER); + pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value); + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.del_pid_filter.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.del_pid_filter.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_REMOVEFILTER_RSP); + +out: + LEAVE(); + return error; +} + +/** + \brief Send start streaming command to AS10x + \param phandle: pointer to AS10x handle + \return 0 when no error,< 0 in case of error. + \callgraph +*/ +int as10x_cmd_start_streaming(as10x_handle_t *phandle) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.start_streaming.req)); + + /* fill command */ + pcmd->body.start_streaming.req.proc_id = + cpu_to_le16(CONTROL_PROC_START_STREAMING); + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.start_streaming.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.start_streaming.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_START_STREAMING_RSP); + +out: + LEAVE(); + return error; +} + +/** + \brief Send stop streaming command to AS10x + \param phandle: pointer to AS10x handle + \return 0 when no error,< 0 in case of error. + \callgraph +*/ +int as10x_cmd_stop_streaming(as10x_handle_t *phandle) +{ + int8_t error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.stop_streaming.req)); + + /* fill command */ + pcmd->body.stop_streaming.req.proc_id = + cpu_to_le16(CONTROL_PROC_STOP_STREAMING); + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.stop_streaming.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.stop_streaming.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } + + if (error< 0) + goto out; + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_STOP_STREAMING_RSP); + +out: + LEAVE(); + return error; +} + + diff -Nur linux.clean/drivers/staging/as102/as10x_handle.h linux.as102_initial/drivers/staging/as102/as10x_handle.h --- linux.clean/drivers/staging/as102/as10x_handle.h 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as10x_handle.h 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,58 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifdef __KERNEL__ +struct as102_bus_adapter_t; +struct as102_dev_t; + +#define as10x_handle_t struct as102_bus_adapter_t +#include "as10x_cmd.h" + +/* values for "mode" field */ +#define REGMODE8 8 +#define REGMODE16 16 +#define REGMODE32 32 + +struct as102_priv_ops_t { + int (*upload_fw_pkt) (struct as102_bus_adapter_t *bus_adap, + unsigned char *buf, int buflen, int swap32); + + int (*send_cmd) (struct as102_bus_adapter_t *bus_adap, + unsigned char *buf, int buflen); + + int (*xfer_cmd) (struct as102_bus_adapter_t *bus_adap, + unsigned char *send_buf, int send_buf_len, + unsigned char *recv_buf, int recv_buf_len); +/* + int (*pid_filter) (struct as102_bus_adapter_t *bus_adap, + int index, u16 pid, int onoff); +*/ + int (*start_stream) (struct as102_dev_t *dev); + void (*stop_stream) (struct as102_dev_t *dev); + + int (*reset_target) (struct as102_bus_adapter_t *bus_adap); + + int (*read_write)(struct as102_bus_adapter_t *bus_adap, uint8_t mode, + uint32_t rd_addr, uint16_t rd_len, + uint32_t wr_addr, uint16_t wr_len); + + int (*as102_read_ep2) (struct as102_bus_adapter_t *bus_adap, + unsigned char *recv_buf, + int recv_buf_len); +}; +#endif diff -Nur linux.clean/drivers/staging/as102/as10x_types.h linux.as102_initial/drivers/staging/as102/as10x_types.h --- linux.clean/drivers/staging/as102/as10x_types.h 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as10x_types.h 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,198 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifndef _AS10X_TYPES_H_ +#define _AS10X_TYPES_H_ + +#include "as10x_handle.h" + +/*********************************/ +/* MACRO DEFINITIONS */ +/*********************************/ + +/* bandwidth constant values */ +#define BW_5_MHZ 0x00 +#define BW_6_MHZ 0x01 +#define BW_7_MHZ 0x02 +#define BW_8_MHZ 0x03 + +/* hierarchy priority selection values */ +#define HIER_NO_PRIORITY 0x00 +#define HIER_LOW_PRIORITY 0x01 +#define HIER_HIGH_PRIORITY 0x02 + +/* constellation available values */ +#define CONST_QPSK 0x00 +#define CONST_QAM16 0x01 +#define CONST_QAM64 0x02 +#define CONST_UNKNOWN 0xFF + +/* hierarchy available values */ +#define HIER_NONE 0x00 +#define HIER_ALPHA_1 0x01 +#define HIER_ALPHA_2 0x02 +#define HIER_ALPHA_4 0x03 +#define HIER_UNKNOWN 0xFF + +/* interleaving available values */ +#define INTLV_NATIVE 0x00 +#define INTLV_IN_DEPTH 0x01 +#define INTLV_UNKNOWN 0xFF + +/* code rate available values */ +#define CODE_RATE_1_2 0x00 +#define CODE_RATE_2_3 0x01 +#define CODE_RATE_3_4 0x02 +#define CODE_RATE_5_6 0x03 +#define CODE_RATE_7_8 0x04 +#define CODE_RATE_UNKNOWN 0xFF + +/* guard interval available values */ +#define GUARD_INT_1_32 0x00 +#define GUARD_INT_1_16 0x01 +#define GUARD_INT_1_8 0x02 +#define GUARD_INT_1_4 0x03 +#define GUARD_UNKNOWN 0xFF + +/* transmission mode available values */ +#define TRANS_MODE_2K 0x00 +#define TRANS_MODE_8K 0x01 +#define TRANS_MODE_4K 0x02 +#define TRANS_MODE_UNKNOWN 0xFF + +/* DVBH signalling available values */ +#define TIMESLICING_PRESENT 0x01 +#define MPE_FEC_PRESENT 0x02 + +/* tune state available */ +#define TUNE_STATUS_NOT_TUNED 0x00 +#define TUNE_STATUS_IDLE 0x01 +#define TUNE_STATUS_LOCKING 0x02 +#define TUNE_STATUS_SIGNAL_DVB_OK 0x03 +#define TUNE_STATUS_STREAM_DETECTED 0x04 +#define TUNE_STATUS_STREAM_TUNED 0x05 +#define TUNE_STATUS_ERROR 0xFF + +/* available TS FID filter types */ +#define TS_PID_TYPE_TS 0 +#define TS_PID_TYPE_PSI_SI 1 +#define TS_PID_TYPE_MPE 2 + +/* number of echos available */ +#define MAX_ECHOS 15 + +/* Context types */ +#define CONTEXT_LNA 1010 +#define CONTEXT_ELNA_HYSTERESIS 4003 +#define CONTEXT_ELNA_GAIN 4004 +#define CONTEXT_MER_THRESHOLD 5005 +#define CONTEXT_MER_OFFSET 5006 +#define CONTEXT_IR_STATE 7000 +#define CONTEXT_TSOUT_MSB_FIRST 7004 +#define CONTEXT_TSOUT_FALLING_EDGE 7005 + +/* Configuration modes */ +#define CFG_MODE_ON 0 +#define CFG_MODE_OFF 1 +#define CFG_MODE_AUTO 2 + +#pragma pack(1) +struct as10x_tps { + uint8_t constellation; + uint8_t hierarchy; + uint8_t interleaving_mode; + uint8_t code_rate_HP; + uint8_t code_rate_LP; + uint8_t guard_interval; + uint8_t transmission_mode; + uint8_t DVBH_mask_HP; + uint8_t DVBH_mask_LP; + uint16_t cell_ID; +}; + +struct as10x_tune_args { + /* frequency */ + uint32_t freq; + /* bandwidth */ + uint8_t bandwidth; + /* hierarchy selection */ + uint8_t hier_select; + /* constellation */ + uint8_t constellation; + /* hierarchy */ + uint8_t hierarchy; + /* interleaving mode */ + uint8_t interleaving_mode; + /* code rate */ + uint8_t code_rate; + /* guard interval */ + uint8_t guard_interval; + /* transmission mode */ + uint8_t transmission_mode; +}; + +struct as10x_tune_status { + /* tune status */ + uint8_t tune_state; + /* signal strength */ + int16_t signal_strength; + /* packet error rate 10^-4 */ + uint16_t PER; + /* bit error rate 10^-4 */ + uint16_t BER; +}; + +struct as10x_demod_stats { + /* frame counter */ + uint32_t frame_count; + /* Bad frame counter */ + uint32_t bad_frame_count; + /* Number of wrong bytes fixed by Reed-Solomon */ + uint32_t bytes_fixed_by_rs; + /* Averaged MER */ + uint16_t mer; + /* statistics calculation state indicator (started or not) */ + uint8_t has_started; +}; + +struct as10x_ts_filter { + uint16_t pid; /** valid PID value 0x00 : 0x2000 */ + uint8_t type; /** Red TS_PID_TYPE_<N> values */ + uint8_t idx; /** index in filtering table */ +}; + +struct as10x_register_value { + uint8_t mode; + union { + uint8_t value8; /* 8 bit value */ + uint16_t value16; /* 16 bit value */ + uint32_t value32; /* 32 bit value */ + }u; +}; + +#pragma pack() + +struct as10x_register_addr { + /* register addr */ + uint32_t addr; + /* register mode access */ + uint8_t mode; +}; + + +#endif diff -Nur linux.clean/drivers/staging/as102/Kconfig linux.as102_initial/drivers/staging/as102/Kconfig --- linux.clean/drivers/staging/as102/Kconfig 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/Kconfig 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,7 @@ +config DVB_AS102 + tristate "Abilis AS102 DVB receiver" + depends on DVB_CORE&& USB&& I2C&& INPUT + help + Choose Y or M here if you have a device containing an AS102 + + To compile this driver as a module, choose M here diff -Nur linux.clean/drivers/staging/as102/Makefile linux.as102_initial/drivers/staging/as102/Makefile --- linux.clean/drivers/staging/as102/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/Makefile 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,5 @@ +dvb-as102-objs := as102_drv.o as102_fw.o as10x_cmd.o as10x_cmd_stream.o as102_fe.o as102_usb_drv.o as10x_cmd_cfg.o + +obj-$(CONFIG_DVB_AS102) += dvb-as102.o + +EXTRA_CFLAGS += -DLINUX -DCONFIG_AS102_USB -Idrivers/media/dvb/dvb-core diff -Nur linux.clean/drivers/staging/Kconfig linux.as102_initial/drivers/staging/Kconfig --- linux.clean/drivers/staging/Kconfig 2011-10-14 15:26:42.000000000 +0200 +++ linux.as102_initial/drivers/staging/Kconfig 2011-10-14 17:21:08.000000000 +0200 @@ -150,4 +150,6 @@ source "drivers/staging/nvec/Kconfig" +source "drivers/staging/as102/Kconfig" + endif # STAGING diff -Nur linux.clean/drivers/staging/Makefile linux.as102_initial/drivers/staging/Makefile --- linux.clean/drivers/staging/Makefile 2011-10-14 15:26:42.000000000 +0200 +++ linux.as102_initial/drivers/staging/Makefile 2011-10-14 17:33:29.000000000 +0200 @@ -66,3 +66,4 @@ obj-$(CONFIG_DRM_PSB) += gma500/ obj-$(CONFIG_INTEL_MEI) += mei/ obj-$(CONFIG_MFD_NVEC) += nvec/ +obj-$(CONFIG_DVB_AS102) += as102/ ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 1/7] Staging submission: PCTV 74e driver (as102) 2011-10-15 20:54 ` [PATCH 1/7] Staging submission: PCTV 74e driver (as102) Piotr Chmura @ 2011-10-16 8:57 ` Stefan Richter 2011-10-16 11:45 ` Devin Heitmueller 0 siblings, 1 reply; 91+ messages in thread From: Stefan Richter @ 2011-10-16 8:57 UTC (permalink / raw) To: Piotr Chmura Cc: Greg KH, Devin Heitmueller, Mauro Carvalho Chehab, Patrick Dickey, LMML, devel On Oct 15 Piotr Chmura wrote: > Staging submission: PCTV 74e driver (as102) > > From: Devin Heitmueller<dheitmueller@kernellabs.com> > > pull as102 driver from > > This is driver for PCTV 74e DVB-T USB tuner, taken from [1], > written by Devin Heitmueller using the GPL reference driver provided by Abilis. > > The only change needed to compile it in current git tree [2] > was changing calls usb_buffer_alloc() and usb_buffer_free() to > usb_alloc_coherent() and usb_free_coherent(). It's included in this patch. > > Patch was tested by me on amd64. > > [1]http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ > [2] git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git kernel-3.1.0-git9+ > > Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> > Cc: Devin Heitmueller<dheitmueller@kernellabs.com> > Cc: Greg HK<gregkh@suse.de> > > diff -Nur linux.clean/drivers/staging/as102/as102_drv.c linux.as102_initial/drivers/staging/as102/as102_drv.c > --- linux.clean/drivers/staging/as102/as102_drv.c 1970-01-01 01:00:00.000000000 +0100 > +++ linux.as102_initial/drivers/staging/as102/as102_drv.c 2011-10-14 17:55:02.000000000 +0200 > @@ -0,0 +1,360 @@ > +/* > + * Abilis Systems Single DVB-T Receiver > + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@abilis.com> > + * Copyright (C) 2010 Devin Heitmueller<dheitmueller@kernellabs.com> Hi Piotr, thanks for getting this going again. - I have not yet looked through the source but have some small remarks on the patch format. - In your changelogs and in the diffs, somehow the space between real name and e-mail address got lost. - The repetition of the Subject: line as first line in the changelog is unnecessary (and would cause an undesired duplication e.g. when git-am is used, last time I checked). - AFAICT, author of patch 1/7 is not Devin but you. Hence the From: line right above the changelog is wrong. - The reference to the source hg tree is very helpful. However, since the as102 related history in there is very well laid out, it may be beneficial to quote some of this prior history. I suggest, include the changelog of "as102: import initial as102 driver", http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/rev/a78bda1e1a0b (but mark it clearly as a quote from the out-of-tree repo), and include a shortlog from this commit inclusive until the head commit inclusive. (Note, the hg author field appears to be wrong; some of the changes apparently need to be attributed to Pierrick Hascoet as author.) This would IMO improve the picture of who contributed what when this goes into mainline git history, even though the hg history needed to be discarded. - A diffstat is always very nice to have in a patch posting. Most tools for patch generation make it easy to add, and it helps the recipients of the patch posting. (Also, a diffstat of all patches combined would be good to have in the introductory PATCH 0/n posting, but not many developers take the time to do so.) Again, thanks for the effort and also thanks to Devin for making it possible. -- Stefan Richter -=====-==-== =-=- =---- http://arcgraph.de/sr/ ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 1/7] Staging submission: PCTV 74e driver (as102) 2011-10-16 8:57 ` Stefan Richter @ 2011-10-16 11:45 ` Devin Heitmueller 2011-10-16 13:44 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 91+ messages in thread From: Devin Heitmueller @ 2011-10-16 11:45 UTC (permalink / raw) To: Stefan Richter Cc: Piotr Chmura, Greg KH, Mauro Carvalho Chehab, Patrick Dickey, LMML, devel On Sun, Oct 16, 2011 at 4:57 AM, Stefan Richter <stefanr@s5r6.in-berlin.de> wrote: > Hi Piotr, > > thanks for getting this going again. - I have not yet looked through the > source but have some small remarks on the patch format. > > - In your changelogs and in the diffs, somehow the space between real > name and e-mail address got lost. > > - The repetition of the Subject: line as first line in the changelog is > unnecessary (and would cause an undesired duplication e.g. when git-am > is used, last time I checked). > > - AFAICT, author of patch 1/7 is not Devin but you. Hence the From: line > right above the changelog is wrong. > > - The reference to the source hg tree is very helpful. However, since > the as102 related history in there is very well laid out, it may be > beneficial to quote some of this prior history. I suggest, include > the changelog of "as102: import initial as102 driver", > http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/rev/a78bda1e1a0b > (but mark it clearly as a quote from the out-of-tree repo), and include > a shortlog from this commit inclusive until the head commit inclusive. > (Note, the hg author field appears to be wrong; some of the changes > apparently need to be attributed to Pierrick Hascoet as author.) > This would IMO improve the picture of who contributed what when this > goes into mainline git history, even though the hg history needed to > be discarded. > > - A diffstat is always very nice to have in a patch posting. Most tools > for patch generation make it easy to add, and it helps the recipients > of the patch posting. > (Also, a diffstat of all patches combined would be good to have in the > introductory PATCH 0/n posting, but not many developers take the time > to do so.) > > Again, thanks for the effort and also thanks to Devin for making it > possible. I think collapsing my entire patch series in to a single patch would not be acceptable, as it loses the entire history of what code was originally delivered by Abilis as well as what changes I made. The fact that it's from multiple authors (including a commercial entity contributing the code) makes this worse. I think the tree does need to be rebased, but I don't think the entire patch series would need to be reworked to be on staging from the beginning. You could probably import the first patch (as102: import initial as102 driver), fix the usb_alloc_coherent() so that it compiles (and put a note in it saying you did), apply the rest of the patch series, and then add a final patch that says something like "moving to staging as code is not production ready". This would allow the history to be preserved without having to rebase every patch to deal with the files being moved to the staging tree. An alternative would be make a minor tweak to my first patch which removes the driver from the makefile. Then every patch in the patch series wouldn't actually have to compile successfully until the very end when you add it back into the Makefile. This is a luxury you can do when it's a brand new driver. When it's a brand new driver there is a bit more flexibility as long as you don't break "git bisect". Both of the approaches described above accomplish that. Mauro, what do you think? Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 1/7] Staging submission: PCTV 74e driver (as102) 2011-10-16 11:45 ` Devin Heitmueller @ 2011-10-16 13:44 ` Mauro Carvalho Chehab 2011-10-18 9:10 ` [PATCH 0/14] staging/media/as102: new driver submission (was " Piotr Chmura [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> 0 siblings, 2 replies; 91+ messages in thread From: Mauro Carvalho Chehab @ 2011-10-16 13:44 UTC (permalink / raw) To: Devin Heitmueller Cc: Stefan Richter, Piotr Chmura, Greg KH, Patrick Dickey, LMML, devel Em 16-10-2011 09:45, Devin Heitmueller escreveu: > On Sun, Oct 16, 2011 at 4:57 AM, Stefan Richter > <stefanr@s5r6.in-berlin.de> wrote: >> Hi Piotr, >> >> thanks for getting this going again. - I have not yet looked through the >> source but have some small remarks on the patch format. >> >> - In your changelogs and in the diffs, somehow the space between real >> name and e-mail address got lost. >> >> - The repetition of the Subject: line as first line in the changelog is >> unnecessary (and would cause an undesired duplication e.g. when git-am >> is used, last time I checked). >> >> - AFAICT, author of patch 1/7 is not Devin but you. Hence the From: line >> right above the changelog is wrong. >> >> - The reference to the source hg tree is very helpful. However, since >> the as102 related history in there is very well laid out, it may be >> beneficial to quote some of this prior history. I suggest, include >> the changelog of "as102: import initial as102 driver", >> http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/rev/a78bda1e1a0b >> (but mark it clearly as a quote from the out-of-tree repo), and include >> a shortlog from this commit inclusive until the head commit inclusive. >> (Note, the hg author field appears to be wrong; some of the changes >> apparently need to be attributed to Pierrick Hascoet as author.) >> This would IMO improve the picture of who contributed what when this >> goes into mainline git history, even though the hg history needed to >> be discarded. >> >> - A diffstat is always very nice to have in a patch posting. Most tools >> for patch generation make it easy to add, and it helps the recipients >> of the patch posting. >> (Also, a diffstat of all patches combined would be good to have in the >> introductory PATCH 0/n posting, but not many developers take the time >> to do so.) >> >> Again, thanks for the effort and also thanks to Devin for making it >> possible. > > I think collapsing my entire patch series in to a single patch would > not be acceptable, as it loses the entire history of what code was > originally delivered by Abilis as well as what changes I made. The > fact that it's from multiple authors (including a commercial entity > contributing the code) makes this worse. > > I think the tree does need to be rebased, but I don't think the entire > patch series would need to be reworked to be on staging from the > beginning. You could probably import the first patch (as102: import > initial as102 driver), fix the usb_alloc_coherent() so that it > compiles (and put a note in it saying you did), apply the rest of the > patch series, and then add a final patch that says something like > "moving to staging as code is not production ready". This would allow > the history to be preserved without having to rebase every patch to > deal with the files being moved to the staging tree. Rebasing a changeset to move it to staging is not as complex as it seems. I did it with tm6000 at the time I merged it. A simple bash script could do that. Something like (untested): $ git export some_base_reference $ for i in 00*.patch; do sed s,/drivers/media/video,/drivers/staging,g <$i >a && mv a $i; done $ mkdir patches/ $ mv 00*.patches patches/ $ (cd patches; ls *.patch > series) $ git quiltimport Of course, the Makefike/Kconfig patch will need changes, but this is as easy as just dropping the hunks that are touching at /drivers/media/video/Makefile and /drivers/media/video/Kconfig, and then adding a final patch adding it to the /drivers/staging/*. > > An alternative would be make a minor tweak to my first patch which > removes the driver from the makefile. Then every patch in the patch > series wouldn't actually have to compile successfully until the very > end when you add it back into the Makefile. This is a luxury you can > do when it's a brand new driver. > > When it's a brand new driver there is a bit more flexibility as long > as you don't break "git bisect". Both of the approaches described > above accomplish that. > > Mauro, what do you think? Didn't actually reviewed the changeset, but let me comment about the submission procedure. Folding patches from different authors generally is not a good idea. As Devin said, things like replacing "foo" by "bar" because "foo" core function were replaced by "bar" upstream is the kind of thing that you could fold, if you properly document it with: [john@john_email.com: replaced "foo" by "bar" to fix compilation] So, you should rebase the patchsets, instead of just folding everything. It is up to you to change the patches on each patch, or to do it only at a final patch. Both ways work for me. I suggest you to remove the Kconfig/Makefile hunks that enables the driver compilation from the original series, and apply it as a final patch at the end. This makes your rebasing work easier, as you won't need to test patch by patch if they are not breaking compilation. In any case, when analyzing a driver submission like that, I generally just apply everything from a quilt series, see the final result and review it, as: 1) the history doesn't matter for me; 2) it is easier to review a new driver as a hole, as the history may be full of things that will later be changed by something else; 3) checkpatch will be happier, especially if you've added some patches to fix checkpatch complains at the end of the series. Btw, I've agreed with Greg that I'll be moving the media staging stuff into a separate directory. I'll prepare the patches later, probably during the next merge window, in order to avoid merge conflicts between Greg's tree and mine, especially since I intend to move some drivers out of staging, as they seem to be ready to be at drivers/media. So, if you're submitting a new driver for staging, I suggest you to put it already into drivers/staging/media. This mean one less driver for me to move on my upcoming changeset ;) I hope that helps. ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 0/14] staging/media/as102: new driver submission (was Re: [PATCH 1/7] Staging submission: PCTV 74e driver (as102) 2011-10-16 13:44 ` Mauro Carvalho Chehab @ 2011-10-18 9:10 ` Piotr Chmura 2011-10-18 15:52 ` Devin Heitmueller [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> 1 sibling, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:10 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel On Sun, 16 Oct 2011 11:44:14 -0200 Mauro Carvalho Chehab <mchehab@redhat.com> wrote: > Em 16-10-2011 09:45, Devin Heitmueller escreveu: > > On Sun, Oct 16, 2011 at 4:57 AM, Stefan Richter > > <stefanr@s5r6.in-berlin.de> wrote: > >> Hi Piotr, > >> > >> thanks for getting this going again. - I have not yet looked through the > >> source but have some small remarks on the patch format. > >> > >> - In your changelogs and in the diffs, somehow the space between real > >> name and e-mail address got lost. > >> > >> - The repetition of the Subject: line as first line in the changelog is > >> unnecessary (and would cause an undesired duplication e.g. when git-am > >> is used, last time I checked). > >> > >> - AFAICT, author of patch 1/7 is not Devin but you. Hence the From: line > >> right above the changelog is wrong. > >> > >> - The reference to the source hg tree is very helpful. However, since > >> the as102 related history in there is very well laid out, it may be > >> beneficial to quote some of this prior history. I suggest, include > >> the changelog of "as102: import initial as102 driver", > >> http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/rev/a78bda1e1a0b > >> (but mark it clearly as a quote from the out-of-tree repo), and include > >> a shortlog from this commit inclusive until the head commit inclusive. > >> (Note, the hg author field appears to be wrong; some of the changes > >> apparently need to be attributed to Pierrick Hascoet as author.) > >> This would IMO improve the picture of who contributed what when this > >> goes into mainline git history, even though the hg history needed to > >> be discarded. > >> > >> - A diffstat is always very nice to have in a patch posting. Most tools > >> for patch generation make it easy to add, and it helps the recipients > >> of the patch posting. > >> (Also, a diffstat of all patches combined would be good to have in the > >> introductory PATCH 0/n posting, but not many developers take the time > >> to do so.) > >> > >> Again, thanks for the effort and also thanks to Devin for making it > >> possible. > > > > I think collapsing my entire patch series in to a single patch would > > not be acceptable, as it loses the entire history of what code was > > originally delivered by Abilis as well as what changes I made. The > > fact that it's from multiple authors (including a commercial entity > > contributing the code) makes this worse. > > > > I think the tree does need to be rebased, but I don't think the entire > > patch series would need to be reworked to be on staging from the > > beginning. You could probably import the first patch (as102: import > > initial as102 driver), fix the usb_alloc_coherent() so that it > > compiles (and put a note in it saying you did), apply the rest of the > > patch series, and then add a final patch that says something like > > "moving to staging as code is not production ready". This would allow > > the history to be preserved without having to rebase every patch to > > deal with the files being moved to the staging tree. > > Rebasing a changeset to move it to staging is not as complex as it seems. > I did it with tm6000 at the time I merged it. A simple bash script could > do that. Something like (untested): > > $ git export some_base_reference > $ for i in 00*.patch; do sed s,/drivers/media/video,/drivers/staging,g <$i >a && mv a $i; done > $ mkdir patches/ > $ mv 00*.patches patches/ > $ (cd patches; ls *.patch > series) > $ git quiltimport > > Of course, the Makefike/Kconfig patch will need changes, but this is as easy > as just dropping the hunks that are touching at /drivers/media/video/Makefile > and /drivers/media/video/Kconfig, and then adding a final patch adding it to > the /drivers/staging/*. > > > > > An alternative would be make a minor tweak to my first patch which > > removes the driver from the makefile. Then every patch in the patch > > series wouldn't actually have to compile successfully until the very > > end when you add it back into the Makefile. This is a luxury you can > > do when it's a brand new driver. > > > > When it's a brand new driver there is a bit more flexibility as long > > as you don't break "git bisect". Both of the approaches described > > above accomplish that. > > > > Mauro, what do you think? > > Didn't actually reviewed the changeset, but let me comment about the > submission procedure. > > Folding patches from different authors generally is not a good idea. > As Devin said, things like replacing "foo" by "bar" because "foo" core > function were replaced by "bar" upstream is the kind of thing that you > could fold, if you properly document it with: > > [john@john_email.com: replaced "foo" by "bar" to fix compilation] > > So, you should rebase the patchsets, instead of just folding everything. > It is up to you to change the patches on each patch, or to do it only at > a final patch. Both ways work for me. > > I suggest you to remove the Kconfig/Makefile hunks that enables the driver > compilation from the original series, and apply it as a final patch at the > end. This makes your rebasing work easier, as you won't need to test patch > by patch if they are not breaking compilation. > > In any case, when analyzing a driver submission like that, I generally just > apply everything from a quilt series, see the final result and review it, > as: > 1) the history doesn't matter for me; > 2) it is easier to review a new driver as a hole, as the history > may be full of things that will later be changed by something else; > 3) checkpatch will be happier, especially if you've added some > patches to fix checkpatch complains at the end of the series. > > Btw, I've agreed with Greg that I'll be moving the media staging stuff into > a separate directory. I'll prepare the patches later, probably during the next > merge window, in order to avoid merge conflicts between Greg's tree and mine, > especially since I intend to move some drivers out of staging, as they seem > to be ready to be at drivers/media. > > So, if you're submitting a new driver for staging, I suggest you to put it already > into drivers/staging/media. This mean one less driver for me to move on my > upcoming changeset ;) > > I hope that helps. > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Thanks for comments for all of you. [PATCH 1-12/14] Following your guidelines i exported all changes from hg one by one. This way we will have all history in kernel tree. I moved driver to staging/media and removed Kconfig/Makefile changes in parent directory in first patch. [PATCH 13/14] Fixes compilation and introduces Kconfig/Makefile changes in staging (which probably you'll need to change anyway in your tree). [PATCH 14/14] Adds nBox tuner I have, so i can test the driver (works fine). I think we can take care of making checkpatch happy when the driver will be in place. I'll resend my previous patches (esp. "[PATCH 4/7] as102: cleanup - formatting code" needs some more work). Stats for package: drivers/staging/Kconfig | 2 drivers/staging/Makefile | 1 drivers/staging/media/as102/Kconfig | 7 drivers/staging/media/as102/Makefile | 5 drivers/staging/media/as102/as102_drv.c | 454 ++++++++-- drivers/staging/media/as102/as102_drv.h | 147 +++ drivers/staging/media/as102/as102_fe.c | 1131 +++++++++++++++++++------ drivers/staging/media/as102/as102_fw.c | 337 ++++++- drivers/staging/media/as102/as102_fw.h | 42 drivers/staging/media/as102/as102_usb_drv.c | 584 +++++++++++- drivers/staging/media/as102/as102_usb_drv.h | 72 + drivers/staging/media/as102/as10x_cmd.c | 983 ++++++++++++++++----- drivers/staging/media/as102/as10x_cmd.h | 540 +++++++++++ drivers/staging/media/as102/as10x_cmd_cfg.c | 492 ++++++++-- drivers/staging/media/as102/as10x_cmd_stream.c | 555 ++++++++---- drivers/staging/media/as102/as10x_handle.h | 58 + drivers/staging/media/as102/as10x_types.h | 198 ++++ 17 files changed, 4705 insertions(+), 903 deletions(-) ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 0/14] staging/media/as102: new driver submission (was Re: [PATCH 1/7] Staging submission: PCTV 74e driver (as102) 2011-10-18 9:10 ` [PATCH 0/14] staging/media/as102: new driver submission (was " Piotr Chmura @ 2011-10-18 15:52 ` Devin Heitmueller 2011-10-18 17:20 ` Piotr Chmura 0 siblings, 1 reply; 91+ messages in thread From: Devin Heitmueller @ 2011-10-18 15:52 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel On Tue, Oct 18, 2011 at 5:10 AM, Piotr Chmura <chmooreck@poczta.onet.pl> wrote: > Thanks for comments for all of you. > > [PATCH 1-12/14] Following your guidelines i exported all changes from hg one by one. This way we will have all history in kernel tree. > I moved driver to staging/media and removed Kconfig/Makefile changes in parent directory in first patch. Hello Piotr, Not that I want to create more work for you, but it would appear that your patches stripped off all the Signed-off-by lines for both myself and Pierrick Hascoet (the developer from the hardware vendor). You have replaced them with "cc:" lines, which breaks the chain of "Developer's Certificate of Origin". When you take somebody else's patches, you need to preserve any existing Signed-off-by lines, adding your own at the bottom of the list. In other words, the first patch should be: Signed-off-by: Pierrick Hascoet <pierrick.hascoet@abilis.com> Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> instead of: Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Cc: Pierrick Hascoet <pierrick.hascoet@abilis.com> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 0/14] staging/media/as102: new driver submission (was Re: [PATCH 1/7] Staging submission: PCTV 74e driver (as102) 2011-10-18 15:52 ` Devin Heitmueller @ 2011-10-18 17:20 ` Piotr Chmura 2011-10-19 11:41 ` Javier Martinez Canillas 0 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 17:20 UTC (permalink / raw) To: Devin Heitmueller Cc: Mauro Carvalho Chehab, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel On Tue, 18 Oct 2011 11:52:17 -0400 Devin Heitmueller <dheitmueller@kernellabs.com> wrote: > On Tue, Oct 18, 2011 at 5:10 AM, Piotr Chmura <chmooreck@poczta.onet.pl> wrote: > > Thanks for comments for all of you. > > > > [PATCH 1-12/14] Following your guidelines i exported all changes from hg one by one. This way we will have all history in kernel tree. > > I moved driver to staging/media and removed Kconfig/Makefile changes in parent directory in first patch. > > Hello Piotr, > > Not that I want to create more work for you, but it would appear that > your patches stripped off all the Signed-off-by lines for both myself > and Pierrick Hascoet (the developer from the hardware vendor). You > have replaced them with "cc:" lines, which breaks the chain of > "Developer's Certificate of Origin". > > When you take somebody else's patches, you need to preserve any > existing Signed-off-by lines, adding your own at the bottom of the > list. > > In other words, the first patch should be: > > Signed-off-by: Pierrick Hascoet <pierrick.hascoet@abilis.com> > Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> > Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> > > instead of: > > Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> > Cc: Pierrick Hascoet <pierrick.hascoet@abilis.com> > Cc: Devin Heitmueller <dheitmueller@kernellabs.com> > > Devin > > -- > Devin J. Heitmueller - Kernel Labs > http://www.kernellabs.com > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Ok, i'll resend them again. Should I replay to every patch with something like [RESEND PATCH nn/mm]..., right ? Peter ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 0/14] staging/media/as102: new driver submission (was Re: [PATCH 1/7] Staging submission: PCTV 74e driver (as102) 2011-10-18 17:20 ` Piotr Chmura @ 2011-10-19 11:41 ` Javier Martinez Canillas 2011-10-19 11:44 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 91+ messages in thread From: Javier Martinez Canillas @ 2011-10-19 11:41 UTC (permalink / raw) To: Piotr Chmura Cc: Devin Heitmueller, Mauro Carvalho Chehab, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel On Tue, Oct 18, 2011 at 7:20 PM, Piotr Chmura <chmooreck@poczta.onet.pl> wrote: > On Tue, 18 Oct 2011 11:52:17 -0400 > Devin Heitmueller <dheitmueller@kernellabs.com> wrote: > >> On Tue, Oct 18, 2011 at 5:10 AM, Piotr Chmura <chmooreck@poczta.onet.pl> wrote: >> > Thanks for comments for all of you. >> > >> > [PATCH 1-12/14] Following your guidelines i exported all changes from hg one by one. This way we will have all history in kernel tree. >> > I moved driver to staging/media and removed Kconfig/Makefile changes in parent directory in first patch. >> >> Hello Piotr, >> >> Not that I want to create more work for you, but it would appear that >> your patches stripped off all the Signed-off-by lines for both myself >> and Pierrick Hascoet (the developer from the hardware vendor). You >> have replaced them with "cc:" lines, which breaks the chain of >> "Developer's Certificate of Origin". >> >> When you take somebody else's patches, you need to preserve any >> existing Signed-off-by lines, adding your own at the bottom of the >> list. >> >> In other words, the first patch should be: >> >> Signed-off-by: Pierrick Hascoet <pierrick.hascoet@abilis.com> >> Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> >> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> >> >> instead of: >> >> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> >> Cc: Pierrick Hascoet <pierrick.hascoet@abilis.com> >> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> >> >> Devin >> >> -- >> Devin J. Heitmueller - Kernel Labs >> http://www.kernellabs.com >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-media" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > Ok, i'll resend them again. > > Should I replay to every patch with something like [RESEND PATCH nn/mm]..., right ? > > Peter Hi Peter, A common convention is to add the version of your patch in the subject like: [PATCH v2 0/14] staging/media/as102: new driver submission That way people can know that is actually a resend of a new patch-set and not a resend of the last one. Anything that is between your Signed-off and the diff get trimmed by Git when applying a patch (that is why Devin and Pierrick Signed-off where stripped in first place). So you can add information about the changes there. Something like: Signed-off-by: Pierrick Hascoet <pierrick.hascoet@abilis.com> Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> ---- v2: preserve any existing Signed-off-by lines so it doesn't get stripped when applied. diff -Nur linux.clean/drivers/staging/as102/as102_drv.c linux.as102_initial/drivers/staging/as102/as102_drv.c --- linux.clean/drivers/staging/as102/as102_drv.c 1970-01-01 01:00:00.000000000 +0100 +++ linux.as102_initial/drivers/staging/as102/as102_drv.c 2011-10-14 17:55:02.000000000 +0200 @@ -0,0 +1,360 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@xxxxxxxxxx> + * Copyright (C) 2010 Devin Heitmueller<dheitmueller@xxxxxxxxxxxxxx> Hope it helps, -- Javier Martínez Canillas (+34) 682 39 81 69 Barcelona, Spain ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 0/14] staging/media/as102: new driver submission (was Re: [PATCH 1/7] Staging submission: PCTV 74e driver (as102) 2011-10-19 11:41 ` Javier Martinez Canillas @ 2011-10-19 11:44 ` Mauro Carvalho Chehab 2011-10-19 13:07 ` Piotr Chmura 0 siblings, 1 reply; 91+ messages in thread From: Mauro Carvalho Chehab @ 2011-10-19 11:44 UTC (permalink / raw) To: Javier Martinez Canillas Cc: Piotr Chmura, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Em 19-10-2011 09:41, Javier Martinez Canillas escreveu: > On Tue, Oct 18, 2011 at 7:20 PM, Piotr Chmura <chmooreck@poczta.onet.pl> wrote: >> On Tue, 18 Oct 2011 11:52:17 -0400 >> Devin Heitmueller <dheitmueller@kernellabs.com> wrote: >> >>> On Tue, Oct 18, 2011 at 5:10 AM, Piotr Chmura <chmooreck@poczta.onet.pl> wrote: >>>> Thanks for comments for all of you. >>>> >>>> [PATCH 1-12/14] Following your guidelines i exported all changes from hg one by one. This way we will have all history in kernel tree. >>>> I moved driver to staging/media and removed Kconfig/Makefile changes in parent directory in first patch. >>> >>> Hello Piotr, >>> >>> Not that I want to create more work for you, but it would appear that >>> your patches stripped off all the Signed-off-by lines for both myself >>> and Pierrick Hascoet (the developer from the hardware vendor). You >>> have replaced them with "cc:" lines, which breaks the chain of >>> "Developer's Certificate of Origin". >>> >>> When you take somebody else's patches, you need to preserve any >>> existing Signed-off-by lines, adding your own at the bottom of the >>> list. >>> >>> In other words, the first patch should be: >>> >>> Signed-off-by: Pierrick Hascoet <pierrick.hascoet@abilis.com> >>> Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> >>> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> >>> >>> instead of: >>> >>> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> >>> Cc: Pierrick Hascoet <pierrick.hascoet@abilis.com> >>> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> >>> >>> Devin >>> >>> -- >>> Devin J. Heitmueller - Kernel Labs >>> http://www.kernellabs.com >>> -- >>> To unsubscribe from this list: send the line "unsubscribe linux-media" in >>> the body of a message to majordomo@vger.kernel.org >>> More majordomo info at http://vger.kernel.org/majordomo-info.html >> >> Ok, i'll resend them again. >> >> Should I replay to every patch with something like [RESEND PATCH nn/mm]..., right ? >> >> Peter > > Hi Peter, > > A common convention is to add the version of your patch in the subject like: > > [PATCH v2 0/14] staging/media/as102: new driver submission > > That way people can know that is actually a resend of a new patch-set > and not a resend of the last one. Yes. Also, it seems that you've submitted only 12 patches of this 14 patch series. Where are the other two missing patches? > > Anything that is between your Signed-off and the diff get trimmed by > Git when applying a patch (that is why Devin and Pierrick Signed-off > where stripped in first place). So you can add information about the > changes there. Something like: > > Signed-off-by: Pierrick Hascoet <pierrick.hascoet@abilis.com> > Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> > Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> > ---- > > v2: preserve any existing Signed-off-by lines so it doesn't get > stripped when applied. > > diff -Nur linux.clean/drivers/staging/as102/as102_drv.c > linux.as102_initial/drivers/staging/as102/as102_drv.c > --- linux.clean/drivers/staging/as102/as102_drv.c 1970-01-01 > 01:00:00.000000000 +0100 > +++ linux.as102_initial/drivers/staging/as102/as102_drv.c 2011-10-14 > 17:55:02.000000000 +0200 > @@ -0,0 +1,360 @@ > +/* > + * Abilis Systems Single DVB-T Receiver > + * Copyright (C) 2008 Pierrick Hascoet<pierrick.hascoet@xxxxxxxxxx> > + * Copyright (C) 2010 Devin Heitmueller<dheitmueller@xxxxxxxxxxxxxx> > > Hope it helps, > ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 0/14] staging/media/as102: new driver submission (was Re: [PATCH 1/7] Staging submission: PCTV 74e driver (as102) 2011-10-19 11:44 ` Mauro Carvalho Chehab @ 2011-10-19 13:07 ` Piotr Chmura 0 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-19 13:07 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Javier Martinez Canillas, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel W dniu 19.10.2011 13:44, Mauro Carvalho Chehab pisze: > Em 19-10-2011 09:41, Javier Martinez Canillas escreveu: >> On Tue, Oct 18, 2011 at 7:20 PM, Piotr Chmura<chmooreck@poczta.onet.pl> wrote: >>> On Tue, 18 Oct 2011 11:52:17 -0400 >>> Devin Heitmueller<dheitmueller@kernellabs.com> wrote: >>> >>>> On Tue, Oct 18, 2011 at 5:10 AM, Piotr Chmura<chmooreck@poczta.onet.pl> wrote: >>>>> Thanks for comments for all of you. >>>>> >>>>> [PATCH 1-12/14] Following your guidelines i exported all changes from hg one by one. This way we will have all history in kernel tree. >>>>> I moved driver to staging/media and removed Kconfig/Makefile changes in parent directory in first patch. >>>> Hello Piotr, >>>> >>>> Not that I want to create more work for you, but it would appear that >>>> your patches stripped off all the Signed-off-by lines for both myself >>>> and Pierrick Hascoet (the developer from the hardware vendor). You >>>> have replaced them with "cc:" lines, which breaks the chain of >>>> "Developer's Certificate of Origin". >>>> >>>> When you take somebody else's patches, you need to preserve any >>>> existing Signed-off-by lines, adding your own at the bottom of the >>>> list. >>>> >>>> In other words, the first patch should be: >>>> >>>> Signed-off-by: Pierrick Hascoet<pierrick.hascoet@abilis.com> >>>> Signed-off-by: Devin Heitmueller<dheitmueller@kernellabs.com> >>>> Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> >>>> >>>> instead of: >>>> >>>> Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> >>>> Cc: Pierrick Hascoet<pierrick.hascoet@abilis.com> >>>> Cc: Devin Heitmueller<dheitmueller@kernellabs.com> >>>> >>>> Devin >>>> >>>> -- >>>> Devin J. Heitmueller - Kernel Labs >>>> http://www.kernellabs.com >>>> -- >>>> To unsubscribe from this list: send the line "unsubscribe linux-media" in >>>> the body of a message to majordomo@vger.kernel.org >>>> More majordomo info at http://vger.kernel.org/majordomo-info.html >>> Ok, i'll resend them again. >>> >>> Should I replay to every patch with something like [RESEND PATCH nn/mm]..., right ? >>> >>> Peter >> Hi Peter, >> >> A common convention is to add the version of your patch in the subject like: >> >> [PATCH v2 0/14] staging/media/as102: new driver submission >> >> That way people can know that is actually a resend of a new patch-set >> and not a resend of the last one. Thanks, I'll do it this way next time. > Yes. Also, it seems that you've submitted only 12 patches of this 14 patch > series. Where are the other two missing patches? 13 and 14 were written by me, so they didn't suffer "signed-off-by" mistake. Do I need resend them too ? Peter ^ permalink raw reply [flat|nested] 91+ messages in thread
[parent not found: <20111018094647.d4982eb2.chmooreck@poczta.onet.pl>]
* [PATCH 1/14] staging/media/as102: initial import from Abilis [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> @ 2011-10-18 9:11 ` Piotr Chmura 2011-10-18 16:24 ` Dan Carpenter 2011-10-18 19:46 ` [RESEND PATCH " Piotr Chmura 2011-10-18 9:11 ` [PATCH 2/14] staging/media/as102: checkpatch fixes Piotr Chmura ` (12 subsequent siblings) 13 siblings, 2 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:11 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Changes made by me: 1. Driver moved from media/dvb to staging/media 2. Removed Makefile/Kconfig - it doesn't compile in current tree Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318322 18000 # Node ID a78bda1e1a0badc4a1296be958f1f8a49014ae18 # Parent 37581bb7e6f1c5ba92c9b6934b4bf21e0e01cb2b as102: import initial as102 driver From: Pierrick Hascoet <pierrick.hascoet@abilis.com> Import the original Abilis Systems as102 driver. The source is unmodified, with the only changes I've made so far were that I created a Kconfig and Makefile so that the code builds in a standard v4l-dvb tree. This driver requires firmware (which Abilis has provided with redistribution terms which will allow it to be bundled in the Linux distributions). The firmware can be downloaded from here: http://www.kernellabs.com/firmware/as102/ Thanks to Rainer Miethling from PCTV Systems for working to get the driver released (for use with the PCTV 74e) and Pierrick Hascoet from Abilis for authoring the driver. Priority: normal Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Cc: Pierrick Hascoet <pierrick.hascoet@abilis.com> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> diff --git linux/drivers/staging/media/as102/Kconfig linuxb/drivers/media/dvb/as102/Kconfig new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/Kconfig @@ -0,0 +1,7 @@ +config DVB_AS102 + tristate "Abilis AS102 DVB receiver" + depends on DVB_CORE && USB && I2C && INPUT + help + Choose Y or M here if you have a device containing an AS102 + + To compile this driver as a module, choose M here diff --git linux/drivers/staging/media/as102/Makefile linuxb/drivers/media/dvb/as102/Makefile new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/Makefile @@ -0,0 +1,5 @@ +dvb-as102-objs := as102_drv.o as102_fw.o as10x_cmd.o as10x_cmd_stream.o as102_fe.o as102_usb_drv.o as10x_cmd_cfg.o + +obj-$(CONFIG_DVB_AS102) += dvb-as102.o + +EXTRA_CFLAGS += -DLINUX -DCONFIG_AS102_USB -Idrivers/media/dvb/dvb-core diff --git linux/drivers/staging/media/as102/as102_drv.c linuxb/drivers/media/dvb/as102/as102_drv.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_drv.c @@ -0,0 +1,356 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/slab.h> +#include <linux/module.h> +#include <linux/mm.h> +#include <linux/kref.h> +#include <asm/uaccess.h> +#include <linux/usb.h> + +/* header file for Usb device driver*/ +#include "as102_drv.h" +#include "as102_fw.h" + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +#include "dvbdev.h" +#else +#warning >>> DVB_CORE not defined !!! <<< +#endif + +int debug = 0; +module_param_named(debug, debug, int, 0644); +MODULE_PARM_DESC(debug, "Turn on/off debugging (default: off)"); + +int dual_tuner = 0; +module_param_named(dual_tuner, dual_tuner, int, 0644); +MODULE_PARM_DESC(dual_tuner, "Activate Dual-Tuner configuration (default: off)"); + +static int fw_upload = 1; +module_param_named(fw_upload, fw_upload, int, 0644); +MODULE_PARM_DESC(fw_upload, "Turn on/off default FW upload (default: on)"); + +static int pid_filtering = 0; +module_param_named(pid_filtering, pid_filtering, int, 0644); +MODULE_PARM_DESC(pid_filtering, "Activate HW PID filtering (default: off)"); + +static int ts_auto_disable = 0; +module_param_named(ts_auto_disable, ts_auto_disable, int, 0644); +MODULE_PARM_DESC(ts_auto_disable, "Stream Auto Enable on FW (default: off)"); + +int elna_enable = 1; +module_param_named(elna_enable, elna_enable, int, 0644); +MODULE_PARM_DESC(elna_enable, "Activate eLNA (default: on)"); + +#ifdef DVB_DEFINE_MOD_OPT_ADAPTER_NR +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); +#endif + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +static void as102_stop_stream(struct as102_dev_t *dev) { + struct as102_bus_adapter_t *bus_adap; + + if (dev != NULL) + bus_adap = &dev->bus_adap; + else + return; + + if (bus_adap->ops->stop_stream != NULL) + bus_adap->ops->stop_stream(dev); + + if (ts_auto_disable) { + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return; + + if (as10x_cmd_stop_streaming(bus_adap) < 0) { + dprintk(debug, "as10x_cmd_stop_streaming failed\n"); + } + + mutex_unlock(&dev->bus_adap.lock); + } +} + +static int as102_start_stream(struct as102_dev_t *dev) { + + struct as102_bus_adapter_t *bus_adap; + int ret = -EFAULT; + + if (dev != NULL) + bus_adap = &dev->bus_adap; + else + return ret; + + if (bus_adap->ops->start_stream != NULL) { + ret = bus_adap->ops->start_stream(dev); + } + + if (ts_auto_disable) { + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EFAULT; + + ret = as10x_cmd_start_streaming(bus_adap); + + mutex_unlock(&dev->bus_adap.lock); + } + + return ret; +} + +static int as10x_pid_filter(struct as102_dev_t *dev, + int index, u16 pid, int onoff) { + + struct as102_bus_adapter_t *bus_adap = &dev->bus_adap; + int ret = -EFAULT; + + ENTER(); + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) { + dprintk(debug, "mutex_lock_interruptible(lock) failed !\n"); + return -EBUSY; + } + + switch(onoff) { + case 0: + ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) pid); + dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = %d\n", + index, pid, ret); + break; + case 1: + { + struct as10x_ts_filter filter; + + filter.type = TS_PID_TYPE_TS; + filter.idx = 0xFF; + filter.pid = pid; + + ret = as10x_cmd_add_PID_filter(bus_adap, &filter); + dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n", + index, filter.idx, filter.pid, ret); + break; + } + } + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return ret; +} + +static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed) { + int ret = 0; + struct dvb_demux *demux = dvbdmxfeed->demux; + struct as102_dev_t *as102_dev = demux->priv; + + ENTER(); + + if (mutex_lock_interruptible(&as102_dev->sem)) + return -ERESTARTSYS; + + if (pid_filtering) { + as10x_pid_filter(as102_dev, + dvbdmxfeed->index, dvbdmxfeed->pid, 1); + } + + if (as102_dev->streaming++ == 0) { + ret = as102_start_stream(as102_dev); + } + + mutex_unlock(&as102_dev->sem); + LEAVE(); + return ret; +} + +static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed) { + struct dvb_demux *demux = dvbdmxfeed->demux; + struct as102_dev_t *as102_dev = demux->priv; + + ENTER(); + + if (mutex_lock_interruptible(&as102_dev->sem)) + return -ERESTARTSYS; + + if (--as102_dev->streaming == 0) { + as102_stop_stream(as102_dev); + } + + if (pid_filtering) { + as10x_pid_filter(as102_dev, + dvbdmxfeed->index, dvbdmxfeed->pid, 0); + } + + mutex_unlock(&as102_dev->sem); + LEAVE(); + return 0; +} +#endif + +int as102_dvb_register(struct as102_dev_t *as102_dev) { + int ret = 0; + ENTER(); + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) + ret = dvb_register_adapter(&as102_dev->dvb_adap, + DEVICE_FULL_NAME, + THIS_MODULE, +#if defined(CONFIG_AS102_USB) + &as102_dev->bus_adap.usb_dev->dev +#elif defined(CONFIG_AS102_SPI) + &as102_dev->bus_adap.spi_dev->dev +#else +#error >>> dvb_register_adapter <<< +#endif +#ifdef DVB_DEFINE_MOD_OPT_ADAPTER_NR + , adapter_nr +#endif + ); + if (ret < 0) { + err("%s: dvb_register_adapter() failed (errno = %d)", + __FUNCTION__, ret); + goto failed; + } + + as102_dev->dvb_dmx.priv = as102_dev; + as102_dev->dvb_dmx.filternum = pid_filtering ? 16 : 256; + as102_dev->dvb_dmx.feednum = 256; + as102_dev->dvb_dmx.start_feed = as102_dvb_dmx_start_feed; + as102_dev->dvb_dmx.stop_feed = as102_dvb_dmx_stop_feed; + + as102_dev->dvb_dmx.dmx.capabilities = DMX_TS_FILTERING | + DMX_SECTION_FILTERING; + + as102_dev->dvb_dmxdev.filternum = as102_dev->dvb_dmx.filternum; + as102_dev->dvb_dmxdev.demux = &as102_dev->dvb_dmx.dmx; + as102_dev->dvb_dmxdev.capabilities = 0; + + if ((ret = dvb_dmx_init(&as102_dev->dvb_dmx)) < 0) { + err("%s: dvb_dmx_init() failed (errno = %d)", + __FUNCTION__, ret); + goto failed; + } + + ret = dvb_dmxdev_init(&as102_dev->dvb_dmxdev, &as102_dev->dvb_adap); + if (ret < 0) { + err("%s: dvb_dmxdev_init() failed (errno = %d)", + __FUNCTION__, ret); + goto failed; + } + + ret = as102_dvb_register_fe(as102_dev, &as102_dev->dvb_fe); + if (ret < 0) { + err("%s: as102_dvb_register_frontend() failed (errno = %d)", + __FUNCTION__, ret); + goto failed; + } +#endif + + /* init bus mutex for token locking */ + mutex_init(&as102_dev->bus_adap.lock); + + /* init start / stop stream mutex */ + mutex_init(&as102_dev->sem); + +#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) + /* + * try to load as102 firmware. If firmware upload failed, we'll be + * able to upload it later. + */ + if (fw_upload) + try_then_request_module(as102_fw_upload(&as102_dev->bus_adap), + "firmware_class"); +#endif + +failed: + LEAVE(); + /* FIXME: free dvb_XXX */ + return ret; +} + +void as102_dvb_unregister(struct as102_dev_t *as102_dev) { + ENTER(); + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) + /* unregister as102 frontend */ + as102_dvb_unregister_fe(&as102_dev->dvb_fe); + + /* unregister demux device */ + dvb_dmxdev_release(&as102_dev->dvb_dmxdev); + dvb_dmx_release(&as102_dev->dvb_dmx); + + /* unregister dvb adapter */ + dvb_unregister_adapter(&as102_dev->dvb_adap); +#endif + LEAVE(); +} + +static int __init as102_driver_init(void) { + int ret = 0; + + ENTER(); + + /* register this driver with the low level subsystem */ +#if defined(CONFIG_AS102_USB) + ret = usb_register(&as102_usb_driver); + if (ret) + err("usb_register failed (ret = %d)", ret); +#endif +#if defined(CONFIG_AS102_SPI) + ret = spi_register_driver(&as102_spi_driver); + if (ret) + printk(KERN_ERR "spi_register failed (ret = %d)", ret); +#endif + + LEAVE(); + return ret; +} + +/* + * Mandatory function : Adds a special section to the module indicating + * where initialisation function is defined + */ +module_init(as102_driver_init); + +/** + * \brief as102 driver exit point. This function is called when device has + * to be removed. + */ +static void __exit as102_driver_exit(void) { + ENTER(); + /* deregister this driver with the low level bus subsystem */ +#if defined(CONFIG_AS102_USB) + usb_deregister(&as102_usb_driver); +#endif +#if defined(CONFIG_AS102_SPI) + spi_unregister_driver(&as102_spi_driver); +#endif + LEAVE(); +} + +/* + * required function for unload: Adds a special section to the module + * indicating where unload function is defined + */ +module_exit(as102_driver_exit); +/* modinfo details */ +MODULE_DESCRIPTION(DRIVER_FULL_NAME); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Pierrick Hascoet <pierrick.hascoet@abilis.com>"); + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as102_drv.h linuxb/drivers/media/dvb/as102/as102_drv.h new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_drv.h @@ -0,0 +1,146 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if defined(CONFIG_AS102_USB) +#include <linux/usb.h> +extern struct usb_driver as102_usb_driver; +#endif + +#if defined(CONFIG_AS102_SPI) +#include <linux/platform_device.h> +#include <linux/spi/spi.h> +#include <linux/cdev.h> + +extern struct spi_driver as102_spi_driver; +#endif + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +#include "dvb_demux.h" +#include "dvb_frontend.h" +#include "dmxdev.h" +#endif + +#define DRIVER_FULL_NAME "Abilis Systems as10x usb driver" +#define DRIVER_NAME "as10x_usb" + +extern int debug; + +#define dprintk(debug, args...) \ + do { if (debug) { \ + printk(KERN_DEBUG "%s: ",__FUNCTION__); \ + printk(args); \ + } } while (0) + +#ifdef TRACE +#define ENTER() printk(">> enter %s\n", __FUNCTION__) +#define LEAVE() printk("<< leave %s\n", __FUNCTION__) +#else +#define ENTER() +#define LEAVE() +#endif + +#define AS102_DEVICE_MAJOR 192 + +#define AS102_USB_BUF_SIZE 512 +#define MAX_STREAM_URB 32 + +#include "as10x_cmd.h" + +#if defined(CONFIG_AS102_USB) +#include "as102_usb_drv.h" +#endif + +#if defined(CONFIG_AS102_SPI) +#include "as10x_spi_drv.h" +#endif + + +struct as102_bus_adapter_t { +#if defined(CONFIG_AS102_USB) + struct usb_device *usb_dev; +#elif defined(CONFIG_AS102_SPI) + struct spi_device *spi_dev; + struct cdev cdev; /* spidev raw device */ + + struct timer_list timer; + struct completion xfer_done; +#endif + /* bus token lock */ + struct mutex lock; + /* low level interface for bus adapter */ + union as10x_bus_token_t { +#if defined(CONFIG_AS102_USB) + /* usb token */ + struct as10x_usb_token_cmd_t usb; +#endif +#if defined(CONFIG_AS102_SPI) + /* spi token */ + struct as10x_spi_token_cmd_t spi; +#endif + } token; + + /* token cmd xfer id */ + uint16_t cmd_xid; + + /* as10x command and response for dvb interface*/ + struct as10x_cmd_t *cmd, *rsp; + + /* bus adapter private ops callback */ + struct as102_priv_ops_t *ops; +}; + +struct as102_dev_t { + struct as102_bus_adapter_t bus_adap; + struct list_head device_entry; + struct kref kref; + unsigned long minor; + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) + struct dvb_adapter dvb_adap; + struct dvb_frontend dvb_fe; + struct dvb_demux dvb_dmx; + struct dmxdev dvb_dmxdev; +#endif + + /* demodulator stats */ + struct as10x_demod_stats demod_stats; + /* signal strength */ + uint16_t signal_strength; + /* bit error rate */ + uint32_t ber; + + /* timer handle to trig ts stream download */ + struct timer_list timer_handle; + + struct mutex sem; + dma_addr_t dma_addr; + void *stream; + int streaming; + struct urb *stream_urb[MAX_STREAM_URB]; +}; + +int as102_dvb_register(struct as102_dev_t *dev); +void as102_dvb_unregister(struct as102_dev_t *dev); + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +int as102_dvb_register_fe(struct as102_dev_t *dev, struct dvb_frontend *fe); +int as102_dvb_unregister_fe(struct dvb_frontend *dev); +#endif + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as102_fe.c linuxb/drivers/media/dvb/as102/as102_fe.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_fe.c @@ -0,0 +1,647 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <linux/version.h> + +#include "as102_drv.h" +#include "as10x_types.h" +#include "as10x_cmd.h" + +extern int elna_enable; + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst, + struct as10x_tps *src); + +static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst, + struct dvb_frontend_parameters *src); + +static void as102_fe_release(struct dvb_frontend *fe) { + struct as102_dev_t *dev; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return; + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return; + + /* send abilis command: TURN_OFF */ + as10x_cmd_turn_off(&dev->bus_adap); + + mutex_unlock(&dev->bus_adap.lock); +#endif + + /* release frontend callback ops */ + memset(&fe->ops, 0, sizeof(struct dvb_frontend_ops)); + + /* flush statistics */ + memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); + dev->signal_strength = 0; + dev->ber = -1; + + /* reset tuner private data */ +/* fe->tuner_priv = NULL; */ + + LEAVE(); +} + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) +static int as102_fe_init(struct dvb_frontend *fe) { + int ret = 0; + struct as102_dev_t *dev; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + if (elna_enable) + ret = as10x_cmd_set_context(&dev->bus_adap, 1010, 0xC0); + + /* send abilis command: TURN_ON */ + ret = as10x_cmd_turn_on(&dev->bus_adap); + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return (ret < 0) ? -EINVAL : 0; +} +#endif + +static int as102_fe_set_frontend(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params) { + int ret = 0; + struct as102_dev_t *dev; + struct as10x_tune_args tune_args = { 0 }; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + as102_fe_copy_tune_parameters(&tune_args, params); + + /* send abilis command: SET_TUNE */ + ret = as10x_cmd_set_tune(&dev->bus_adap, &tune_args); + if(ret != 0) { + dprintk(debug, "as10x_cmd_set_tune failed. (err = %d)\n", ret); + } + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return (ret < 0) ? -EINVAL : 0; +} + +static int as102_fe_get_frontend(struct dvb_frontend* fe, + struct dvb_frontend_parameters *p) { + int ret = 0; + struct as102_dev_t *dev; + struct as10x_tps tps = { 0 }; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -EINVAL; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + /* send abilis command: GET_TPS */ + ret = as10x_cmd_get_tps(&dev->bus_adap, &tps); + + if (ret == 0) + as10x_fe_copy_tps_parameters(p, &tps); + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return (ret < 0) ? -EINVAL : 0; +} + +static int as102_fe_get_tune_settings(struct dvb_frontend *fe, + struct dvb_frontend_tune_settings *settings) { + ENTER(); + +#if 0 + dprintk(debug, "step_size = %d\n", settings->step_size); + dprintk(debug, "max_drift = %d\n", settings->max_drift); + dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms, 1000); +#endif + + settings->min_delay_ms = 1000; + + LEAVE(); + return 0; +} + + +static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) { + int ret = 0; + struct as102_dev_t *dev; + struct as10x_tune_status tstate = { 0 }; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + /* send abilis command: GET_TUNE_STATUS */ + ret = as10x_cmd_get_tune_status(&dev->bus_adap, &tstate); + if (ret < 0) { + dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n", ret); + goto out; + } + + dev->signal_strength = tstate.signal_strength; + dev->ber = tstate.BER; + + switch(tstate.tune_state) { + case TUNE_STATUS_SIGNAL_DVB_OK: + *status = FE_HAS_SIGNAL | + FE_HAS_CARRIER; + break; + case TUNE_STATUS_STREAM_DETECTED: + *status = FE_HAS_SIGNAL | + FE_HAS_CARRIER | + FE_HAS_SYNC; + break; + case TUNE_STATUS_STREAM_TUNED: + *status = FE_HAS_SIGNAL | + FE_HAS_CARRIER | + FE_HAS_SYNC | + FE_HAS_LOCK; + break; + default: + *status = TUNE_STATUS_NOT_TUNED; + } + + dprintk(debug, "tuner status: 0x%02x , strength %d , per: %d , ber: %d\n", + tstate.tune_state, tstate.signal_strength, + tstate.PER, tstate.BER); + + if (*status & FE_HAS_LOCK) { + if (as10x_cmd_get_demod_stats(&dev->bus_adap, + (struct as10x_demod_stats *) &dev->demod_stats) < 0) { + memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); + dprintk(debug, "as10x_cmd_get_demod_stats failed (probably not tuned)\n"); + } else { + dprintk(debug, "demod status: fc: 0x%08x , bad fc: 0x%08x , bytes corrected: 0x%08x , MER: 0x%04x\n", + dev->demod_stats.frame_count, + dev->demod_stats.bad_frame_count, + dev->demod_stats.bytes_fixed_by_rs, + dev->demod_stats.mer); + } + } else { + memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); + } + +out: + mutex_unlock(&dev->bus_adap.lock); + LEAVE(); + return ret; +} + +/* + * Note: + * - in AS102 SNR=MER + * - the SNR will be returned in linear terms, i.e. not in dB + * - the accuracy equals ±2dB for a SNR range from 4dB to 30dB + * - the accuracy is >2dB for SNR values outside this range + */ +static int as102_fe_read_snr(struct dvb_frontend* fe, u16* snr) { + struct as102_dev_t *dev; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + *snr = dev->demod_stats.mer; + + LEAVE(); + return 0; +} + +static int as102_fe_read_ber(struct dvb_frontend* fe, u32* ber) { + struct as102_dev_t *dev; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + *ber = dev->ber; + + LEAVE(); + return 0; +} + +static int as102_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength) { + struct as102_dev_t *dev; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + *strength = (((0xffff * 400) * dev->signal_strength + 41000) * 2); + + LEAVE(); + return 0; +} + +static int as102_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) { + struct as102_dev_t *dev; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + if (dev->demod_stats.has_started) + *ucblocks = dev->demod_stats.bad_frame_count; + else + *ucblocks = 0; + + LEAVE(); + return 0; +} + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) +static int as102_fe_ts_bus_ctrl(struct dvb_frontend* fe, int acquire) { + struct as102_dev_t *dev; + int ret; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + if (acquire) { + if (elna_enable) + as10x_cmd_set_context(&dev->bus_adap, 1010, 0xC0); + + ret = as10x_cmd_turn_on(&dev->bus_adap); + } else { + ret = as10x_cmd_turn_off(&dev->bus_adap); + } + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return ret; +} +#endif + +static struct dvb_frontend_ops as102_fe_ops = { + .info = { + .name = DEVICE_FULL_NAME, + .type = FE_OFDM, + .frequency_min = 174000000, + .frequency_max = 862000000, + .frequency_stepsize = 166667, + .caps = FE_CAN_INVERSION_AUTO + | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 + | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO + | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QPSK + | FE_CAN_QAM_AUTO + | FE_CAN_TRANSMISSION_MODE_AUTO + | FE_CAN_GUARD_INTERVAL_AUTO + | FE_CAN_HIERARCHY_AUTO + | FE_CAN_RECOVER + | FE_CAN_MUTE_TS + }, + + .set_frontend = as102_fe_set_frontend, + .get_frontend = as102_fe_get_frontend, + .get_tune_settings = as102_fe_get_tune_settings, + + + .read_status = as102_fe_read_status, + .read_snr = as102_fe_read_snr, + .read_ber = as102_fe_read_ber, + .read_signal_strength = as102_fe_read_signal_strength, + .read_ucblocks = as102_fe_read_ucblocks, + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) + .ts_bus_ctrl = as102_fe_ts_bus_ctrl, +#else + .release = as102_fe_release, + .init = as102_fe_init, +#endif +}; + +int as102_dvb_unregister_fe(struct dvb_frontend *fe) { + + /* unregister frontend */ + dvb_unregister_frontend(fe); + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) + /* detach frontend */ + dvb_frontend_detach(fe); +#endif + return 0; +} + +int as102_dvb_register_fe(struct as102_dev_t *as102_dev, struct dvb_frontend *dvb_fe) { + int errno; + struct dvb_adapter *dvb_adap; + + if(as102_dev == NULL) + return -EINVAL; + + /* extract dvb_adapter */ + dvb_adap = &as102_dev->dvb_adap; + + /* init frontend callback ops */ + memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops)); + + /* register dbvb frontend */ + errno = dvb_register_frontend(dvb_adap, dvb_fe); + if(errno == 0) + dvb_fe->tuner_priv = as102_dev; + + return errno; +} + +static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst, + struct as10x_tps *as10x_tps) { + + struct dvb_ofdm_parameters *fe_tps = &dst->u.ofdm; + + /* extract consteallation */ + switch(as10x_tps->constellation) { + case CONST_QPSK: + fe_tps->constellation = QPSK; + break; + case CONST_QAM16: + fe_tps->constellation = QAM_16; + break; + case CONST_QAM64: + fe_tps->constellation = QAM_64; + break; + } + + /* extract hierarchy */ + switch(as10x_tps->hierarchy) { + case HIER_NONE: + fe_tps->hierarchy_information = HIERARCHY_NONE; + break; + case HIER_ALPHA_1: + fe_tps->hierarchy_information = HIERARCHY_1; + break; + case HIER_ALPHA_2: + fe_tps->hierarchy_information = HIERARCHY_2; + break; + case HIER_ALPHA_4: + fe_tps->hierarchy_information = HIERARCHY_4; + break; + } + + /* extract code rate HP */ + switch(as10x_tps->code_rate_HP) { + case CODE_RATE_1_2: + fe_tps->code_rate_HP = FEC_1_2; + break; + case CODE_RATE_2_3: + fe_tps->code_rate_HP = FEC_2_3; + break; + case CODE_RATE_3_4: + fe_tps->code_rate_HP = FEC_3_4; + break; + case CODE_RATE_5_6: + fe_tps->code_rate_HP = FEC_5_6; + break; + case CODE_RATE_7_8: + fe_tps->code_rate_HP = FEC_7_8; + break; + } + + /* extract code rate LP */ + switch(as10x_tps->code_rate_LP) { + case CODE_RATE_1_2: + fe_tps->code_rate_LP = FEC_1_2; + break; + case CODE_RATE_2_3: + fe_tps->code_rate_LP = FEC_2_3; + break; + case CODE_RATE_3_4: + fe_tps->code_rate_LP = FEC_3_4; + break; + case CODE_RATE_5_6: + fe_tps->code_rate_LP = FEC_5_6; + break; + case CODE_RATE_7_8: + fe_tps->code_rate_LP = FEC_7_8; + break; + } + + /* extract guard interval */ + switch(as10x_tps->guard_interval) { + case GUARD_INT_1_32: + fe_tps->guard_interval = GUARD_INTERVAL_1_32; + break; + case GUARD_INT_1_16: + fe_tps->guard_interval = GUARD_INTERVAL_1_16; + break; + case GUARD_INT_1_8: + fe_tps->guard_interval = GUARD_INTERVAL_1_8; + break; + case GUARD_INT_1_4: + fe_tps->guard_interval = GUARD_INTERVAL_1_4; + break; + } + + /* extract transmission mode */ + switch(as10x_tps->transmission_mode) { + case TRANS_MODE_2K: + fe_tps->transmission_mode = TRANSMISSION_MODE_2K; + break; + case TRANS_MODE_8K: + fe_tps->transmission_mode = TRANSMISSION_MODE_8K; + break; + } +} + +static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg) { + uint8_t c; + + switch(arg) { + case FEC_1_2: + c = CODE_RATE_1_2; + break; + case FEC_2_3: + c = CODE_RATE_2_3; + break; + case FEC_3_4: + c = CODE_RATE_3_4; + break; + case FEC_5_6: + c = CODE_RATE_5_6; + break; + case FEC_7_8: + c = CODE_RATE_7_8; + break; + default: + c = CODE_RATE_UNKNOWN; + break; + } + + return c; +} + +static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args, + struct dvb_frontend_parameters *params) { + + /* set frequency */ + tune_args->freq = params->frequency / 1000; + + /* fix interleaving_mode */ + tune_args->interleaving_mode = INTLV_NATIVE; + + switch(params->u.ofdm.bandwidth) { + case BANDWIDTH_8_MHZ: + tune_args->bandwidth = BW_8_MHZ; + break; + case BANDWIDTH_7_MHZ: + tune_args->bandwidth = BW_7_MHZ; + break; + case BANDWIDTH_6_MHZ: + tune_args->bandwidth = BW_6_MHZ; + break; + default: + tune_args->bandwidth = BW_8_MHZ; + } + + switch(params->u.ofdm.guard_interval) { + case GUARD_INTERVAL_1_32: + tune_args->guard_interval = GUARD_INT_1_32; + break; + case GUARD_INTERVAL_1_16: + tune_args->guard_interval = GUARD_INT_1_16; + break; + case GUARD_INTERVAL_1_8: + tune_args->guard_interval = GUARD_INT_1_8; + break; + case GUARD_INTERVAL_1_4: + tune_args->guard_interval = GUARD_INT_1_4; + break; + case GUARD_INTERVAL_AUTO: + default: + tune_args->guard_interval = GUARD_UNKNOWN; + break; + } + + switch(params->u.ofdm.constellation) { + case QPSK: + tune_args->constellation = CONST_QPSK; + break; + case QAM_16: + tune_args->constellation = CONST_QAM16; + break; + case QAM_64: + tune_args->constellation = CONST_QAM64; + break; + default: + tune_args->constellation = CONST_UNKNOWN; + break; + } + + switch(params->u.ofdm.transmission_mode) { + case TRANSMISSION_MODE_2K: + tune_args->transmission_mode = TRANS_MODE_2K; + break; + case TRANSMISSION_MODE_8K: + tune_args->transmission_mode = TRANS_MODE_8K; + break; + default: + tune_args->transmission_mode = TRANS_MODE_UNKNOWN; + } + + switch(params->u.ofdm.hierarchy_information) { + case HIERARCHY_NONE: + tune_args->hierarchy = HIER_NONE; + break; + case HIERARCHY_1: + tune_args->hierarchy = HIER_ALPHA_1; + break; + case HIERARCHY_2: + tune_args->hierarchy = HIER_ALPHA_2; + break; + case HIERARCHY_4: + tune_args->hierarchy = HIER_ALPHA_4; + break; + case HIERARCHY_AUTO: + tune_args->hierarchy = HIER_UNKNOWN; + break; + } + + dprintk(debug, "tuner parameters: freq: %d bw: 0x%02x gi: 0x%02x\n", + params->frequency, + tune_args->bandwidth, + tune_args->guard_interval); + + /* + * Detect a hierarchy selection + * if HP/LP are both set to FEC_NONE, HP will be selected. + */ + if ((tune_args->hierarchy != HIER_NONE) && + ((params->u.ofdm.code_rate_LP == FEC_NONE) || + (params->u.ofdm.code_rate_HP == FEC_NONE))) { + + if (params->u.ofdm.code_rate_LP == FEC_NONE) { + tune_args->hier_select = HIER_HIGH_PRIORITY; + tune_args->code_rate = + as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); + } + + if (params->u.ofdm.code_rate_HP == FEC_NONE) { + tune_args->hier_select = HIER_LOW_PRIORITY; + tune_args->code_rate = + as102_fe_get_code_rate(params->u.ofdm.code_rate_LP); + } + + dprintk(debug, "\thierarchy: 0x%02x " + "selected: %s code_rate_%s: 0x%02x\n", + tune_args->hierarchy, + tune_args->hier_select == HIER_HIGH_PRIORITY ? "HP" : "LP", + tune_args->hier_select == HIER_HIGH_PRIORITY ? "HP" : "LP", + tune_args->code_rate); + } else { + tune_args->code_rate = as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); + } +} +#endif + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as102_fw.c linuxb/drivers/media/dvb/as102/as102_fw.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_fw.c @@ -0,0 +1,236 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/ctype.h> +#include <linux/delay.h> +#include <linux/firmware.h> + +#include "as102_drv.h" +#include "as102_fw.h" + +#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) +char as102_st_fw1[] = "as102_data1_st.hex"; +char as102_st_fw2[] = "as102_data2_st.hex"; +char as102_dt_fw1[] = "as102_data1_dt.hex"; +char as102_dt_fw2[] = "as102_data2_dt.hex"; + +static unsigned char atohx(unsigned char *dst, char *src) { + unsigned char value = 0; + + char msb = tolower(*src) - '0'; + char lsb = tolower(*(src +1)) - '0'; + + if (msb > 9 ) + msb -= 7; + if (lsb > 9 ) + lsb -= 7; + + *dst = value = ((msb & 0xF) << 4) | (lsb & 0xF); + return value; +} + +/* + * Parse INTEL HEX firmware file to extract address and data. + */ +static int parse_hex_line(unsigned char *fw_data, unsigned char *addr, + unsigned char *data, int *dataLength, + unsigned char *addr_has_changed) { + + int count = 0; + unsigned char *src, dst; + + if (*fw_data++ != ':') { + printk(KERN_ERR "invalid firmware file\n"); + return -EFAULT; + } + + /* locate end of line */ + for (src=fw_data; *src != '\n'; src += 2) { + atohx(&dst, src); + /* parse line to split addr / data */ + switch (count) { + case 0: + *dataLength = dst; + break; + case 1: + addr[2] = dst; + break; + case 2: + addr[3] = dst; + break; + case 3: + /* check if data is an address */ + if (dst == 0x04) + *addr_has_changed = 1; + else + *addr_has_changed = 0; + break; + case 4: + case 5: + if (*addr_has_changed) { + addr[(count - 4)] = dst; + } else { + data[(count - 4)] = dst; + } + break; + default: + data[(count - 4)] = dst; + break; + } + count++; + } + + /* return read value + ':' + '\n' */ + return ((count * 2) + 2); +} + +static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap, + unsigned char *cmd, + const struct firmware *firmware) { + + struct as10x_fw_pkt_t fw_pkt; + int total_read_bytes = 0, errno = 0; + unsigned char addr_has_changed = 0; + + ENTER(); + + for (total_read_bytes = 0; total_read_bytes < firmware->size; ) { + int read_bytes = 0, data_len = 0; + + /* parse intel hex line */ + read_bytes = parse_hex_line( + (u8 *) (firmware->data + total_read_bytes), + fw_pkt.raw.address, + fw_pkt.raw.data, + &data_len, + &addr_has_changed); + + if (read_bytes <= 0) { + goto error; + } + + /* detect the end of file */ + if ((total_read_bytes += read_bytes) == firmware->size) { + fw_pkt.u.request[0] = 0x00; + fw_pkt.u.request[1] = 0x03; + + /* send EOF command */ + if ((errno = bus_adap->ops->upload_fw_pkt(bus_adap,(uint8_t *) &fw_pkt, 2, 0)) < 0) + goto error; + } else { + if (!addr_has_changed) { + /* prepare command to send */ + fw_pkt.u.request[0] = 0x00; + fw_pkt.u.request[1] = 0x01; + + data_len += sizeof(fw_pkt.u.request); + data_len += sizeof(fw_pkt.raw.address); + + /* send cmd to device */ + if ((errno = bus_adap->ops->upload_fw_pkt(bus_adap, (uint8_t *) &fw_pkt, data_len, 0)) < 0) + goto error; + } + } + } +error: + LEAVE(); + return (errno == 0) ? total_read_bytes : errno; +} + +int as102_fw_upload(struct as102_bus_adapter_t *bus_adap) { + int errno = -EFAULT; + const struct firmware *firmware; + unsigned char *cmd_buf = NULL; + char *fw1, *fw2; + +#if defined(CONFIG_AS102_USB) + struct usb_device *dev = bus_adap->usb_dev; +#endif +#if defined(CONFIG_AS102_SPI) + struct spi_device *dev = bus_adap->spi_dev; +#endif + ENTER(); + + /* select fw file to upload */ + if (dual_tuner) { + fw1 = as102_dt_fw1; + fw2 = as102_dt_fw2; + } else { + fw1 = as102_st_fw1; + fw2 = as102_st_fw2; + } + +#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) + /* allocate buffer to store firmware upload command and data */ + if ((cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL)) == NULL) { + errno = -ENOMEM; + goto error; + } + + /* request kernel to locate firmware file: part1 */ + if ((errno = request_firmware(&firmware, fw1, &dev->dev)) < 0) { + printk(KERN_ERR "%s: unable to locate firmware file: %s\n", + DRIVER_NAME, fw1); + goto error; + } + + /* initiate firmware upload */ + if ((errno = as102_firmware_upload(bus_adap, cmd_buf, firmware)) < 0) { + printk(KERN_ERR "%s: error during firmware upload part1\n", + DRIVER_NAME); + goto error; + } + + printk(KERN_INFO "%s: fimrware: %s loaded with success\n", + DRIVER_NAME, fw1); + release_firmware(firmware); + + /* wait for boot to complete */ + mdelay(100); + + /* request kernel to locate firmware file: part2 */ + if ((errno = request_firmware(&firmware, fw2, &dev->dev)) < 0) { + printk(KERN_ERR "%s: unable to locate firmware file: %s\n", + DRIVER_NAME, fw2); + goto error; + } + + /* initiate firmware upload */ + if ((errno = as102_firmware_upload(bus_adap, cmd_buf, firmware)) < 0) { + printk(KERN_ERR "%s: error during firmware upload part2\n", + DRIVER_NAME); + goto error; + } + + printk(KERN_INFO "%s: fimrware: %s loaded with success\n", + DRIVER_NAME, fw2); +error: + /* free data buffer */ + kfree(cmd_buf); + /* release firmware if needed */ + if (firmware != NULL) + release_firmware(firmware); +#endif + LEAVE(); + return errno; +} +#endif + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as102_fw.h linuxb/drivers/media/dvb/as102/as102_fw.h new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_fw.h @@ -0,0 +1,42 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#define MAX_FW_PKT_SIZE 64 + +extern int dual_tuner; + +#pragma pack(1) +struct as10x_raw_fw_pkt { + unsigned char address[4]; + unsigned char data[MAX_FW_PKT_SIZE - 6]; +}; + +struct as10x_fw_pkt_t { + union { + unsigned char request[2]; + unsigned char length[2]; + } u; + struct as10x_raw_fw_pkt raw; +}; +#pragma pack() + +#ifdef __KERNEL__ +int as102_fw_upload(struct as102_bus_adapter_t *bus_adap); +#endif + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as102_usb_drv.c linuxb/drivers/media/dvb/as102/as102_usb_drv.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_usb_drv.c @@ -0,0 +1,432 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/slab.h> +#include <linux/mm.h> +#include <linux/usb.h> + +#include "as102_drv.h" +#include "as102_usb_drv.h" +#include "as102_fw.h" + +static void as102_usb_disconnect(struct usb_interface *interface); +static int as102_usb_probe(struct usb_interface *interface, + const struct usb_device_id *id); + +static int as102_usb_start_stream(struct as102_dev_t *dev); +static void as102_usb_stop_stream(struct as102_dev_t *dev); + +static int as102_open(struct inode *inode, struct file *file); +static int as102_release(struct inode *inode, struct file *file); + +static struct usb_device_id as102_usb_id_table[] = { + { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) }, + { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) }, + { } /* Terminating entry */ +}; + +struct usb_driver as102_usb_driver = { + .name = DRIVER_FULL_NAME, + .probe = as102_usb_probe, + .disconnect = as102_usb_disconnect, + .id_table = as102_usb_id_table +}; + +struct file_operations as102_dev_fops = { + .owner = THIS_MODULE, + .open = as102_open, + .release = as102_release, +}; + +static struct usb_class_driver as102_usb_class_driver = { + .name = "aton2-%d", + .fops = &as102_dev_fops, + .minor_base = AS102_DEVICE_MAJOR, +}; + +static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap, + unsigned char *send_buf, int send_buf_len, + unsigned char *recv_buf, int recv_buf_len) { + + int ret = 0; + ENTER(); + + if(send_buf != NULL) { + ret = usb_control_msg(bus_adap->usb_dev, + usb_sndctrlpipe(bus_adap->usb_dev, 0), + AS102_USB_DEVICE_TX_CTRL_CMD, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + bus_adap->cmd_xid, /* value */ + 0, /* index */ + send_buf, send_buf_len, + USB_CTRL_SET_TIMEOUT /* 200 */); + if(ret < 0) { + dprintk(debug, "usb_control_msg(send) failed, err %i\n", + ret); + return ret; + } + + if(ret != send_buf_len) { + dprintk(debug, "only wrote %d of %d bytes\n", + ret, send_buf_len); + return -1; + } + } + + if(recv_buf != NULL) { +#ifdef TRACE + dprintk(debug, "want to read: %d bytes\n", recv_buf_len); +#endif + ret = usb_control_msg(bus_adap->usb_dev, + usb_rcvctrlpipe(bus_adap->usb_dev, 0), + AS102_USB_DEVICE_RX_CTRL_CMD, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + bus_adap->cmd_xid, /* value */ + 0, /* index */ + recv_buf, recv_buf_len, + USB_CTRL_GET_TIMEOUT /* 200 */); + if(ret < 0) { + dprintk(debug, "usb_control_msg(recv) failed, err %i\n", + ret); + return ret; + } +#ifdef TRACE + dprintk(debug, "read %d bytes\n", recv_buf_len); +#endif + } + + LEAVE(); + return ret; +} + +static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap, + unsigned char *send_buf, + int send_buf_len, + int swap32) { + + int ret = 0, actual_len; + + ret = usb_bulk_msg(bus_adap->usb_dev, usb_sndbulkpipe(bus_adap->usb_dev, 1), + send_buf, send_buf_len, &actual_len, 200); + if(ret) { + dprintk(debug, "usb_bulk_msg(send) failed, err %i\n", ret); + return ret; + } + + if(actual_len != send_buf_len) { + dprintk(debug, "only wrote %d of %d bytes\n", + actual_len, send_buf_len); + return -1; + } + return ret ? ret : actual_len; +} + +static int as102_read_ep2(struct as102_bus_adapter_t *bus_adap, + unsigned char *recv_buf, int recv_buf_len) { + + int ret = 0, actual_len; + + if(recv_buf == NULL) + return -EINVAL; + + ret = usb_bulk_msg(bus_adap->usb_dev, usb_rcvbulkpipe(bus_adap->usb_dev, 2), + recv_buf, recv_buf_len, &actual_len, 200); + if(ret) { + dprintk(debug, "usb_bulk_msg(recv) failed, err %i\n", ret); + return ret; + } + + if(actual_len != recv_buf_len) { + dprintk(debug, "only read %d of %d bytes\n", + actual_len, recv_buf_len); + return -1; + } + return ret ? ret : actual_len; +} + +struct as102_priv_ops_t as102_priv_ops = { + .upload_fw_pkt = as102_send_ep1, + .xfer_cmd = as102_usb_xfer_cmd, + .as102_read_ep2 = as102_read_ep2, + .start_stream = as102_usb_start_stream, + .stop_stream = as102_usb_stop_stream, +}; + +static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb) { + int err; + + usb_fill_bulk_urb(urb, + dev->bus_adap.usb_dev, + usb_rcvbulkpipe(dev->bus_adap.usb_dev, 0x2), + urb->transfer_buffer, + AS102_USB_BUF_SIZE, + as102_urb_stream_irq, + dev); + + if ((err = usb_submit_urb(urb, GFP_ATOMIC))) + dprintk(debug, "%s: usb_submit_urb failed\n", __FUNCTION__); + + return err; +} + +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)) +void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs) +#else +void as102_urb_stream_irq(struct urb *urb) +#endif +{ + struct as102_dev_t *as102_dev = urb->context; + + if (urb->actual_length > 0) { +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) + dvb_dmx_swfilter(&as102_dev->dvb_dmx, + urb->transfer_buffer, + urb->actual_length); +#else + /* do nothing ? */ +#endif + } else { + if(urb->actual_length == 0) + memset(urb->transfer_buffer, 0, AS102_USB_BUF_SIZE); + } + + /* is not stopped, re-submit urb */ + if (as102_dev->streaming) + as102_submit_urb_stream(as102_dev, urb); +} + +static void as102_free_usb_stream_buffer(struct as102_dev_t *dev) { + int i; + + ENTER(); + + for (i = 0; i < MAX_STREAM_URB; i++) + usb_free_urb(dev->stream_urb[i]); + + usb_buffer_free(dev->bus_adap.usb_dev, + MAX_STREAM_URB * AS102_USB_BUF_SIZE, + dev->stream, + dev->dma_addr); + LEAVE(); +} + +static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) { + int i, ret = 0; + + ENTER(); + + dev->stream = usb_buffer_alloc(dev->bus_adap.usb_dev, + MAX_STREAM_URB * AS102_USB_BUF_SIZE, + GFP_KERNEL, + &dev->dma_addr); + if (!dev->stream) { + dprintk(debug, "%s: usb_buffer_alloc failed\n", __FUNCTION__); + return -ENOMEM; + } + + memset(dev->stream, 0, MAX_STREAM_URB * AS102_USB_BUF_SIZE); + + /* init urb buffers */ + for (i = 0; i < MAX_STREAM_URB; i++) { + struct urb *urb; + + if (!(urb = usb_alloc_urb(0, GFP_ATOMIC))) { + dprintk(debug, "%s: usb_alloc_urb failed\n", __FUNCTION__); + as102_free_usb_stream_buffer(dev); + return -ENOMEM; + } + + urb->transfer_buffer = dev->stream + (i * AS102_USB_BUF_SIZE); + urb->transfer_buffer_length = AS102_USB_BUF_SIZE; + + dev->stream_urb[i] = urb; + } + LEAVE(); + return ret; +} + +static void as102_usb_stop_stream(struct as102_dev_t *dev) { + int i; + + for (i = 0; i < MAX_STREAM_URB; i++) + usb_kill_urb(dev->stream_urb[i]); +} + +static int as102_usb_start_stream(struct as102_dev_t *dev) { + int i, ret = 0; + + for (i = 0; i < MAX_STREAM_URB; i++) { + if ((ret = as102_submit_urb_stream(dev, dev->stream_urb[i]))) { + as102_usb_stop_stream(dev); + return ret; + } + } + + return 0; +} + +static void as102_usb_release(struct kref *kref) { + struct as102_dev_t *as102_dev; + + ENTER(); + + as102_dev = container_of(kref, struct as102_dev_t, kref); + if (as102_dev != NULL) { + usb_put_dev(as102_dev->bus_adap.usb_dev); + kfree(as102_dev); + } + + LEAVE(); +} + +static void as102_usb_disconnect(struct usb_interface *intf) { + struct as102_dev_t *as102_dev; + + ENTER(); + + /* extract as102_dev_t from usb_device private data */ + as102_dev = usb_get_intfdata(intf); + + /* unregister dvb layer */ + as102_dvb_unregister(as102_dev); + + /* free usb buffers */ + as102_free_usb_stream_buffer(as102_dev); + + usb_set_intfdata(intf, NULL); + + /* usb unregister device */ + usb_deregister_dev(intf, &as102_usb_class_driver); + + /* decrement usage counter */ + kref_put(&as102_dev->kref, as102_usb_release); + + printk(KERN_INFO "%s: device has been disconnected\n", DRIVER_NAME); + + LEAVE(); +} + +static int as102_usb_probe(struct usb_interface *intf, + const struct usb_device_id *id) { + int ret; + struct as102_dev_t *as102_dev; + + ENTER(); + + if(!(as102_dev = kzalloc(sizeof(struct as102_dev_t), GFP_KERNEL))) { + err("%s: kzalloc failed", __FUNCTION__); + return -ENOMEM; + } + + /* set private callback functions */ + as102_dev->bus_adap.ops = &as102_priv_ops; + + /* init cmd token for usb bus */ + as102_dev->bus_adap.cmd = &as102_dev->bus_adap.token.usb.c; + as102_dev->bus_adap.rsp = &as102_dev->bus_adap.token.usb.r; + + /* init kernel device reference */ + kref_init(&as102_dev->kref); + + /* store as102 device to usb_device private data */ + usb_set_intfdata(intf, (void *) as102_dev); + + /* store in as102 device the usb_device pointer */ + as102_dev->bus_adap.usb_dev = usb_get_dev(interface_to_usbdev(intf)); + + /* we can register the device now, as it is ready */ + if((ret = usb_register_dev(intf, &as102_usb_class_driver)) < 0) {; + /* something prevented us from registering this driver */ + err("%s: usb_register_dev() failed (errno = %d)", + __FUNCTION__, ret); + goto failed; + } + + printk(KERN_INFO "%s: device has been detected\n", DRIVER_NAME); + + /* request buffer allocation for streaming */ + if ((ret = as102_alloc_usb_stream_buffer(as102_dev)) != 0) + goto failed; + + /* register dvb layer */ + ret = as102_dvb_register(as102_dev); + + LEAVE(); + return ret; + +failed: + usb_set_intfdata(intf, NULL); + kfree(as102_dev); + return ret; +} + +static int as102_open(struct inode *inode, struct file *file) { + int ret = 0, minor = 0; + struct usb_interface *intf = NULL; + struct as102_dev_t *dev = NULL; + + ENTER(); + + /* read minor from inode */ + minor = iminor(inode); + + /* fetch device from usb interface */ + if((intf = usb_find_interface(&as102_usb_driver, minor)) == NULL) { + printk(KERN_ERR "%s: can't find device for minor %d\n", + __FUNCTION__, minor); + ret = -ENODEV; + goto exit; + } + + /* get our device */ + if((dev = usb_get_intfdata(intf)) == NULL) { + ret = -EFAULT; + goto exit; + } + + /* save our device object in the file's private structure */ + file->private_data = dev; + + /* increment our usage count for the device */ + kref_get(&dev->kref); + +exit: + LEAVE(); + return ret; +} + +static int as102_release(struct inode *inode, struct file *file) { + int ret = 0; + struct as102_dev_t *dev = NULL; + + ENTER(); + + if((dev = file->private_data) != NULL ) { + /* decrement the count on our device */ + kref_put(&dev->kref, as102_usb_release); + } + + LEAVE(); + return ret; +} + +MODULE_DEVICE_TABLE(usb, as102_usb_id_table); + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as102_usb_drv.h linuxb/drivers/media/dvb/as102/as102_usb_drv.h new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_usb_drv.h @@ -0,0 +1,54 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <linux/version.h> + +#ifndef _AS102_USB_DRV_H_ +#define _AS102_USB_DRV_H_ + +#define AS102_USB_DEVICE_TX_CTRL_CMD 0xF1 +#define AS102_USB_DEVICE_RX_CTRL_CMD 0xF2 + +/* define these values to match the supported devices */ + +/* Abilis system: "TITAN" */ +#define AS102_USB_DEVICE_VENDOR_ID 0x1BA6 +#define AS102_USB_DEVICE_PID_0001 0x0001 + +/* PCTV Systems: PCTV picoStick (74e) */ +#define DEVICE_FULL_NAME "PCTV Systems : PCTV picoStick (74e)" +#define PCTV_74E_USB_VID 0x2013 +#define PCTV_74E_USB_PID 0x0246 + +extern struct file_operations as102_dev_fops; + +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)) +void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs); +#else +void as102_urb_stream_irq(struct urb *urb); +#endif + + +struct as10x_usb_token_cmd_t { + /* token cmd */ + struct as10x_cmd_t c; + /* token response */ + struct as10x_cmd_t r; +}; +#endif +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as10x_cmd.c linuxb/drivers/media/dvb/as102/as10x_cmd.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as10x_cmd.c @@ -0,0 +1,478 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */ +#include <linux/kernel.h> +#include "as102_drv.h" +#elif defined(WIN32) + #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) /* win32 ddk implementation */ + #include "wdm.h" + #include "Device.h" + #include "endian_mgmt.h" /* FIXME */ + #else /* win32 sdk implementation */ + #include <windows.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" + #endif +#else /* all other cases */ + #include <string.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" /* FIXME */ +#endif /* __KERNEL__ */ + +#include "as10x_types.h" +#include "as10x_cmd.h" + +/** + \brief send turn on command to AS10x + \param phandle: pointer to AS10x handle + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_turn_on(as10x_handle_t *phandle) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd,(++phandle->cmd_xid), sizeof(pcmd->body.turn_on.req)); + + /* fill command */ + pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON); + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( + phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.turn_on.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.turn_on.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief send turn off command to AS10x + \param phandle: pointer to AS10x handle + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_turn_off(as10x_handle_t *phandle) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.turn_off.req)); + + /* fill command */ + pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF); + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( + phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.turn_off.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief send set tune command to AS10x + \param phandle: pointer to AS10x handle + \param ptune: tune parameters + \return 0 when no error, < 0 in case of error. + \callgraph + */ +int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune) +{ + int error; + struct as10x_cmd_t *preq, *prsp; + + ENTER(); + + preq = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(preq,(++phandle->cmd_xid),sizeof(preq->body.set_tune.req)); + + /* fill command */ + preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE); + preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq); + preq->body.set_tune.req.args.bandwidth = ptune->bandwidth; + preq->body.set_tune.req.args.hier_select = ptune->hier_select; + preq->body.set_tune.req.args.constellation = ptune->constellation; + preq->body.set_tune.req.args.hierarchy = ptune->hierarchy; + preq->body.set_tune.req.args.interleaving_mode = ptune->interleaving_mode; + preq->body.set_tune.req.args.code_rate = ptune->code_rate; + preq->body.set_tune.req.args.guard_interval = ptune->guard_interval; + preq->body.set_tune.req.args.transmission_mode = ptune->transmission_mode; + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) preq, + sizeof(preq->body.set_tune.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.set_tune.rsp) + HEADER_SIZE); + } else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief send get tune status command to AS10x + \param phandle: pointer to AS10x handle + \param pstatus: pointer to updated status structure of the current tune + \return 0 when no error, < 0 in case of error. + \callgraph + */ +int as10x_cmd_get_tune_status(as10x_handle_t *phandle, struct as10x_tune_status *pstatus) +{ + int error; + struct as10x_cmd_t *preq, *prsp; + + ENTER(); + + preq = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(preq,(++phandle->cmd_xid), + sizeof(preq->body.get_tune_status.req)); + + /* fill command */ + preq->body.get_tune_status.req.proc_id = + cpu_to_le16(CONTROL_PROC_GETTUNESTAT); + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( + phandle, + (uint8_t *) preq, + sizeof(preq->body.get_tune_status.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if (error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP); + if (error < 0) { + goto out; + } + + /* Response OK -> get response data */ + pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state; + pstatus->signal_strength = + le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength); + pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER); + pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER); + +out: + LEAVE(); + return(error); +} + +/** + \brief send get TPS command to AS10x + \param phandle: pointer to AS10x handle + \param ptps: pointer to TPS parameters structure + \return 0 when no error, < 0 in case of error. + \callgraph + */ +int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps) +{ + + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid),sizeof(pcmd->body.get_tps.req)); + + /* fill command */ + pcmd->body.get_tune_status.req.proc_id = cpu_to_le16(CONTROL_PROC_GETTPS); + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, sizeof(pcmd->body.get_tps.req) + HEADER_SIZE, + (uint8_t *) prsp, sizeof(prsp->body.get_tps.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP); + if (error < 0) { + goto out; + } + + /* Response OK -> get response data */ + ptps->constellation = prsp->body.get_tps.rsp.tps.constellation; + ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy; + ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode; + ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP; + ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP; + ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval; + ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode; + ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP; + ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP; + ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID); + +out: + LEAVE(); + return(error); +} + +/** + \brief send get demod stats command to AS10x + \param phandle: pointer to AS10x handle + \param pdemod_stats: pointer to demod stats parameters structure + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, + struct as10x_demod_stats *pdemod_stats) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_demod_stats.req)); + + /* fill command */ + pcmd->body.get_demod_stats.req.proc_id = + cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_demod_stats.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_demod_stats.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_DEMOD_STATS_RSP); + if (error < 0) { + goto out; + } + + /* Response OK -> get response data */ + pdemod_stats->frame_count = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count); + pdemod_stats->bad_frame_count = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count); + pdemod_stats->bytes_fixed_by_rs = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs); + pdemod_stats->mer = + le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer); + pdemod_stats->has_started = + prsp->body.get_demod_stats.rsp.stats.has_started; + +out: + LEAVE(); + return(error); +} + +/** + \brief send get impulse response command to AS10x + \param phandle: pointer to AS10x handle + \param is_ready: pointer to value indicating when impulse + response data is ready + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, + uint8_t *is_ready) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_impulse_rsp.req)); + + /* fill command */ + pcmd->body.get_impulse_rsp.req.proc_id = + cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_impulse_rsp.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_impulse_rsp.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_IMPULSE_RESP_RSP); + if (error < 0) { + goto out; + } + + /* Response OK -> get response data */ + *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready; + +out: + LEAVE(); + return(error); +} + + + +/** + \brief build AS10x command header + \param pcmd: pointer to AS10x command buffer + \param xid: sequence id of the command + \param cmd_len: lenght of the command + \return - + \callgraph +*/ +void as10x_cmd_build(struct as10x_cmd_t *pcmd, + uint16_t xid, uint16_t cmd_len) +{ + pcmd->header.req_id = cpu_to_le16(xid); + pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID); + pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION); + pcmd->header.data_len = cpu_to_le16(cmd_len); +} + +/** + \brief Parse command response + \param pcmd: pointer to AS10x command buffer + \param cmd_seqid: sequence id of the command + \param cmd_len: lenght of the command + \return 0 when no error, < 0 in case of error + \callgraph +*/ +int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) +{ + int error; + + /* extract command error code */ + error = prsp->body.common.rsp.error; + + if((error == 0) && (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) { + return 0; + } + + return AS10X_CMD_ERROR; +} + + diff --git linux/drivers/staging/media/as102/as10x_cmd.h linuxb/drivers/media/dvb/as102/as10x_cmd.h new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as10x_cmd.h @@ -0,0 +1,540 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifndef _AS10X_CMD_H_ +#define _AS10X_CMD_H_ + +#ifdef __KERNEL__ +#include <linux/kernel.h> +#endif + +#include "as10x_types.h" + +/*********************************/ +/* MACRO DEFINITIONS */ +/*********************************/ +#define AS10X_CMD_ERROR -1 + +#define SERVICE_PROG_ID 0x0002 +#define SERVICE_PROG_VERSION 0x0001 + +#define HIER_NONE 0x00 +#define HIER_LOW_PRIORITY 0x01 + +#define HEADER_SIZE (sizeof(struct as10x_cmd_header_t)) + +/* context request types */ +#define GET_CONTEXT_DATA 1 +#define SET_CONTEXT_DATA 2 + +/* ODSP suspend modes */ +#define CFG_MODE_ODSP_RESUME 0 +#define CFG_MODE_ODSP_SUSPEND 1 + +/* Dump memory size */ +#define DUMP_BLOCK_SIZE_MAX 0x20 + +/*********************************/ +/* TYPE DEFINITION */ +/*********************************/ +typedef enum { + CONTROL_PROC_TURNON = 0x0001, + CONTROL_PROC_TURNON_RSP = 0x0100, + CONTROL_PROC_SET_REGISTER = 0x0002, + CONTROL_PROC_SET_REGISTER_RSP = 0x0200, + CONTROL_PROC_GET_REGISTER = 0x0003, + CONTROL_PROC_GET_REGISTER_RSP = 0x0300, + CONTROL_PROC_SETTUNE = 0x000A, + CONTROL_PROC_SETTUNE_RSP = 0x0A00, + CONTROL_PROC_GETTUNESTAT = 0x000B, + CONTROL_PROC_GETTUNESTAT_RSP = 0x0B00, + CONTROL_PROC_GETTPS = 0x000D, + CONTROL_PROC_GETTPS_RSP = 0x0D00, + CONTROL_PROC_SETFILTER = 0x000E, + CONTROL_PROC_SETFILTER_RSP = 0x0E00, + CONTROL_PROC_REMOVEFILTER = 0x000F, + CONTROL_PROC_REMOVEFILTER_RSP = 0x0F00, + CONTROL_PROC_GET_IMPULSE_RESP = 0x0012, + CONTROL_PROC_GET_IMPULSE_RESP_RSP = 0x1200, + CONTROL_PROC_START_STREAMING = 0x0013, + CONTROL_PROC_START_STREAMING_RSP = 0x1300, + CONTROL_PROC_STOP_STREAMING = 0x0014, + CONTROL_PROC_STOP_STREAMING_RSP = 0x1400, + CONTROL_PROC_GET_DEMOD_STATS = 0x0015, + CONTROL_PROC_GET_DEMOD_STATS_RSP = 0x1500, + CONTROL_PROC_ELNA_CHANGE_MODE = 0x0016, + CONTROL_PROC_ELNA_CHANGE_MODE_RSP = 0x1600, + CONTROL_PROC_ODSP_CHANGE_MODE = 0x0017, + CONTROL_PROC_ODSP_CHANGE_MODE_RSP = 0x1700, + CONTROL_PROC_AGC_CHANGE_MODE = 0x0018, + CONTROL_PROC_AGC_CHANGE_MODE_RSP = 0x1800, + + CONTROL_PROC_CONTEXT = 0x00FC, + CONTROL_PROC_CONTEXT_RSP = 0xFC00, + CONTROL_PROC_DUMP_MEMORY = 0x00FD, + CONTROL_PROC_DUMP_MEMORY_RSP = 0xFD00, + CONTROL_PROC_DUMPLOG_MEMORY = 0x00FE, + CONTROL_PROC_DUMPLOG_MEMORY_RSP = 0xFE00, + CONTROL_PROC_TURNOFF = 0x00FF, + CONTROL_PROC_TURNOFF_RSP = 0xFF00 +} control_proc; + + +#pragma pack(1) +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} TURN_ON; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t err; + } rsp; +} TURN_OFF; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* tune params */ + struct as10x_tune_args args; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + } rsp; +} SET_TUNE; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + /* tune status */ + struct as10x_tune_status sts; + } rsp; +} GET_TUNE_STATUS; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + /* tps details */ + struct as10x_tps tps; + } rsp; +} GET_TPS; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + } rsp; +} COMMON; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* PID to filter */ + uint16_t pid; + /* stream type (MPE, PSI/SI or PES )*/ + uint8_t stream_type; + /* PID index in filter table */ + uint8_t idx; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + /* Filter id */ + uint8_t filter_id; + } rsp; +} ADD_PID_FILTER; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* PID to remove */ + uint16_t pid; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + } rsp; +} DEL_PID_FILTER; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} START_STREAMING; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} STOP_STREAMING; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* demod stats */ + struct as10x_demod_stats stats; + } rsp; +} GET_DEMOD_STATS; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* impulse response ready */ + uint8_t is_ready; + } rsp; +} GET_IMPULSE_RESP; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* value to write (for set context)*/ + struct as10x_register_value reg_val; + /* context tag */ + uint16_t tag; + /* context request type */ + uint16_t type; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* value read (for get context) */ + struct as10x_register_value reg_val; + /* context request type */ + uint16_t type; + /* error */ + uint8_t error; + } rsp; +} FW_CONTEXT; + +typedef union { + /* request */ + struct { + /* response identifier */ + uint16_t proc_id; + /* register description */ + struct as10x_register_addr reg_addr; + /* register content */ + struct as10x_register_value reg_val; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} SET_REGISTER; + +typedef union { + /* request */ + struct { + /* response identifier */ + uint16_t proc_id; + /* register description */ + struct as10x_register_addr reg_addr; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* register content */ + struct as10x_register_value reg_val; + } rsp; +} GET_REGISTER; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* mode */ + uint8_t mode; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} CFG_CHANGE_MODE; + +struct as10x_cmd_header_t { + uint16_t req_id; + uint16_t prog; + uint16_t version; + uint16_t data_len; +}; + +#define DUMP_BLOCK_SIZE 16 +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* dump memory type request */ + uint8_t dump_req; + /* register description */ + struct as10x_register_addr reg_addr; + /* nb blocks to read */ + uint16_t num_blocks; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* dump response */ + uint8_t dump_rsp; + /* data */ + union { + uint8_t data8[DUMP_BLOCK_SIZE]; + uint16_t data16[DUMP_BLOCK_SIZE / sizeof(uint16_t)]; + uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)]; + } u; + } rsp; +} DUMP_MEMORY; + +typedef union { + struct { + /* request identifier */ + uint16_t proc_id; + /* dump memory type request */ + uint8_t dump_req; + } req; + struct { + /* request identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* dump response */ + uint8_t dump_rsp; + /* dump data */ + uint8_t data[DUMP_BLOCK_SIZE]; + } rsp; +} DUMPLOG_MEMORY; + +typedef union { + /* request */ + struct { + uint16_t proc_id; + uint8_t data[64 - sizeof(struct as10x_cmd_header_t) -2 /* proc_id */]; + } req; + /* response */ + struct { + uint16_t proc_id; + uint8_t error; + uint8_t data[64 - sizeof(struct as10x_cmd_header_t) /* header */ + - 2 /* proc_id */ - 1 /* rc */]; + } rsp; +} RAW_DATA; + +struct as10x_cmd_t { + /* header */ + struct as10x_cmd_header_t header; + /* body */ + union { + TURN_ON turn_on; + TURN_OFF turn_off; + SET_TUNE set_tune; + GET_TUNE_STATUS get_tune_status; + GET_TPS get_tps; + COMMON common; + ADD_PID_FILTER add_pid_filter; + DEL_PID_FILTER del_pid_filter; + START_STREAMING start_streaming; + STOP_STREAMING stop_streaming; + GET_DEMOD_STATS get_demod_stats; + GET_IMPULSE_RESP get_impulse_rsp; + FW_CONTEXT context; + SET_REGISTER set_register; + GET_REGISTER get_register; + CFG_CHANGE_MODE cfg_change_mode; + DUMP_MEMORY dump_memory; + DUMPLOG_MEMORY dumplog_memory; + RAW_DATA raw_data; + } body; +}; + +struct as10x_token_cmd_t { + /* token cmd */ + struct as10x_cmd_t c; + /* token response */ + struct as10x_cmd_t r; +}; +#pragma pack() + + +/**************************/ +/* FUNCTION DECLARATION */ +/**************************/ + +void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id, + uint16_t cmd_len); +int as10x_rsp_parse(struct as10x_cmd_t *r, uint16_t proc_id); + +#ifdef __cplusplus +extern "C" { +#endif + +/* as10x cmd */ +int as10x_cmd_turn_on(as10x_handle_t *phandle); +int as10x_cmd_turn_off(as10x_handle_t *phandle); + +int as10x_cmd_set_tune(as10x_handle_t *phandle, + struct as10x_tune_args *ptune); + +int as10x_cmd_get_tune_status(as10x_handle_t *phandle, + struct as10x_tune_status *pstatus); + +int as10x_cmd_get_tps(as10x_handle_t *phandle, + struct as10x_tps *ptps); + +int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, + struct as10x_demod_stats *pdemod_stats); + +int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, + uint8_t *is_ready); + +/* as10x cmd stream */ +int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, + struct as10x_ts_filter *filter); +int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, + uint16_t pid_value); + +int as10x_cmd_start_streaming(as10x_handle_t *phandle); +int as10x_cmd_stop_streaming(as10x_handle_t *phandle); + +/* as10x cmd cfg */ +int as10x_cmd_set_context(as10x_handle_t *phandle, + uint16_t tag, + uint32_t value); +int as10x_cmd_get_context(as10x_handle_t *phandle, + uint16_t tag, + uint32_t *pvalue); + +int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode); +int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id); +#ifdef __cplusplus +} +#endif +#endif +/* EOF - vim: set textwidth=80 ts=3 sw=3 sts=3 et: */ diff --git linux/drivers/staging/media/as102/as10x_cmd_cfg.c linuxb/drivers/media/dvb/as102/as10x_cmd_cfg.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c @@ -0,0 +1,239 @@ +/** + + \file as10x_cmd_cfg.c + + \version $Id$ + + \author: S. Martinelli + + ----------------------------------------------------------------------------\n + (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n + www.abilis.com \n + ----------------------------------------------------------------------------\n + + \brief AS10x API, configuration services + + AS10x cmd management: build command buffer, send command through + selected port and wait for the response when required. + +*/ + +#if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */ +#include <linux/kernel.h> +#include "as102_drv.h" +#elif defined(WIN32) + #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) /* win32 ddk implementation */ + #include "wdm.h" + #include "Device.h" + #include "endian_mgmt.h" /* FIXME */ + #else /* win32 sdk implementation */ + #include <windows.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" + #endif +#else /* all other cases */ + #include <string.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" /* FIXME */ +#endif /* __KERNEL__ */ + +#include "as10x_types.h" +#include "as10x_cmd.h" + +/***************************/ +/* FUNCTION DEFINITION */ +/***************************/ + +/** + \brief send get context command to AS10x + \param phandle: pointer to AS10x handle + \param tag: context tag + \param pvalue: pointer where to store context value read + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag, + uint32_t *pvalue) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.context.req)); + + /* fill command */ + pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); + pcmd->body.context.req.tag = cpu_to_le16(tag); + pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA); + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.context.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.context.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response: context command do not follow the common response */ + /* structure -> specific handling response parse required */ + error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); + + if(error == 0) { + /* Response OK -> get response data */ + *pvalue = le32_to_cpu(prsp->body.context.rsp.reg_val.u.value32); + /* value returned is always a 32-bit value */ + } + +out: + LEAVE(); + return(error); +} + +/** + \brief send set context command to AS10x + \param phandle: pointer to AS10x handle + \param tag: context tag + \param value: value to set in context + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag, + uint32_t value) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.context.req)); + + /* fill command */ + pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); + /* pcmd->body.context.req.reg_val.mode initialization is not required */ + pcmd->body.context.req.reg_val.u.value32 = cpu_to_le32(value); + pcmd->body.context.req.tag = cpu_to_le16(tag); + pcmd->body.context.req.type = cpu_to_le16(SET_CONTEXT_DATA); + + /* send command */ + if(phandle->ops->xfer_cmd){ + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.context.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.context.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response: context command do not follow the common response */ + /* structure -> specific handling response parse required */ + error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief send eLNA change mode command to AS10x + \param phandle: pointer to AS10x handle + \param tag: context tag + \param mode: mode selected: + - ON : 0x0 => eLNA always ON + - OFF : 0x1 => eLNA always OFF + - AUTO : 0x2 => eLNA follow hysteresis parameters to be + ON or OFF + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.cfg_change_mode.req)); + + /* fill command */ + pcmd->body.cfg_change_mode.req.proc_id = + cpu_to_le16(CONTROL_PROC_ELNA_CHANGE_MODE); + pcmd->body.cfg_change_mode.req.mode = mode; + + /* send command */ + if(phandle->ops->xfer_cmd){ + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.cfg_change_mode.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.cfg_change_mode.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_ELNA_CHANGE_MODE_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief Parse context command response. Since this command does not follow + the common response, a specific parse function is required. + \param prsp: pointer to AS10x command response buffer + \param proc_id: id of the command + \return 0 when no error, < 0 in case of error. + ABILIS_RC_NOK + \callgraph +*/ +int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) { + + int err; + + err = prsp->body.context.rsp.error; + + if((err == 0) && + (le16_to_cpu(prsp->body.context.rsp.proc_id) == proc_id)) { + return 0; + } + return AS10X_CMD_ERROR; +} diff --git linux/drivers/staging/media/as102/as10x_cmd_stream.c linuxb/drivers/media/dvb/as102/as10x_cmd_stream.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as10x_cmd_stream.c @@ -0,0 +1,256 @@ +/** + + \file as10x_cmd_stream.c + + \version $Id$ + + \author: S. Martinelli + + ----------------------------------------------------------------------------\n + (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n + www.abilis.com \n + ----------------------------------------------------------------------------\n + + \brief AS10x CMD, stream services + + AS10x CMD management: build command buffer, send command through + selected port and wait for the response when required. + +*/ + + +#if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */ +#include <linux/kernel.h> +#include "as102_drv.h" +#elif defined(WIN32) + #if defined(DDK) /* win32 ddk implementation */ + #include "wdm.h" + #include "Device.h" + #include "endian_mgmt.h" /* FIXME */ + #else /* win32 sdk implementation */ + #include <windows.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" + #endif +#else /* all other cases */ + #include <string.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" /* FIXME */ +#endif /* __KERNEL__ */ + +#include "as10x_cmd.h" + + +/** + \brief send add filter command to AS10x + \param phandle: pointer to AS10x handle + \param filter: TSFilter filter for DVB-T + \param pfilter_handle: pointer where to store filter handle + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_add_PID_filter(as10x_handle_t* phandle, + struct as10x_ts_filter *filter) { + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.add_pid_filter.req)); + + /* fill command */ + pcmd->body.add_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_SETFILTER); + pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid); + pcmd->body.add_pid_filter.req.stream_type = filter->type; + + if(filter->idx < 16) + pcmd->body.add_pid_filter.req.idx = filter->idx; + else + pcmd->body.add_pid_filter.req.idx = 0xFF; + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.add_pid_filter.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.add_pid_filter.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP); + + if(error == 0) { + /* Response OK -> get response data */ + filter->idx = prsp->body.add_pid_filter.rsp.filter_id; + } + +out: + LEAVE(); + return(error); +} + +/** + \brief Send delete filter command to AS10x + \param phandle: pointer to AS10x handle + \param filter_handle: filter handle + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_del_PID_filter(as10x_handle_t* phandle, + uint16_t pid_value) +{ + + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.del_pid_filter.req)); + + /* fill command */ + pcmd->body.del_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_REMOVEFILTER); + pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value); + + /* send command */ + if(phandle->ops->xfer_cmd){ + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.del_pid_filter.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.del_pid_filter.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_REMOVEFILTER_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief Send start streaming command to AS10x + \param phandle: pointer to AS10x handle + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_start_streaming(as10x_handle_t* phandle) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.start_streaming.req)); + + /* fill command */ + pcmd->body.start_streaming.req.proc_id = + cpu_to_le16(CONTROL_PROC_START_STREAMING); + + /* send command */ + if(phandle->ops->xfer_cmd){ + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.start_streaming.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.start_streaming.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_START_STREAMING_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief Send stop streaming command to AS10x + \param phandle: pointer to AS10x handle + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_stop_streaming(as10x_handle_t* phandle) +{ + int8_t error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.stop_streaming.req)); + + /* fill command */ + pcmd->body.stop_streaming.req.proc_id = + cpu_to_le16(CONTROL_PROC_STOP_STREAMING); + + /* send command */ + if(phandle->ops->xfer_cmd){ + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.stop_streaming.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.stop_streaming.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_STOP_STREAMING_RSP); + +out: + LEAVE(); + return(error); +} + + diff --git linux/drivers/staging/media/as102/as10x_handle.h linuxb/drivers/media/dvb/as102/as10x_handle.h new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as10x_handle.h @@ -0,0 +1,58 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifdef __KERNEL__ +struct as102_bus_adapter_t; +struct as102_dev_t; + +#define as10x_handle_t struct as102_bus_adapter_t +#include "as10x_cmd.h" + +/* values for "mode" field */ +#define REGMODE8 8 +#define REGMODE16 16 +#define REGMODE32 32 + +struct as102_priv_ops_t { + int (*upload_fw_pkt) (struct as102_bus_adapter_t *bus_adap, + unsigned char *buf, int buflen, int swap32); + + int (*send_cmd) (struct as102_bus_adapter_t *bus_adap, + unsigned char *buf, int buflen); + + int (*xfer_cmd) (struct as102_bus_adapter_t *bus_adap, + unsigned char *send_buf, int send_buf_len, + unsigned char *recv_buf, int recv_buf_len); +/* + int (*pid_filter) (struct as102_bus_adapter_t *bus_adap, + int index, u16 pid, int onoff); +*/ + int (*start_stream) (struct as102_dev_t *dev); + void (*stop_stream) (struct as102_dev_t *dev); + + int (*reset_target) (struct as102_bus_adapter_t *bus_adap); + + int (*read_write)(struct as102_bus_adapter_t *bus_adap, uint8_t mode, + uint32_t rd_addr, uint16_t rd_len, + uint32_t wr_addr, uint16_t wr_len); + + int (*as102_read_ep2) (struct as102_bus_adapter_t *bus_adap, + unsigned char *recv_buf, + int recv_buf_len); +}; +#endif diff --git linux/drivers/staging/media/as102/as10x_types.h linuxb/drivers/media/dvb/as102/as10x_types.h new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as10x_types.h @@ -0,0 +1,198 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifndef _AS10X_TYPES_H_ +#define _AS10X_TYPES_H_ + +#include "as10x_handle.h" + +/*********************************/ +/* MACRO DEFINITIONS */ +/*********************************/ + +/* bandwidth constant values */ +#define BW_5_MHZ 0x00 +#define BW_6_MHZ 0x01 +#define BW_7_MHZ 0x02 +#define BW_8_MHZ 0x03 + +/* hierarchy priority selection values */ +#define HIER_NO_PRIORITY 0x00 +#define HIER_LOW_PRIORITY 0x01 +#define HIER_HIGH_PRIORITY 0x02 + +/* constellation available values */ +#define CONST_QPSK 0x00 +#define CONST_QAM16 0x01 +#define CONST_QAM64 0x02 +#define CONST_UNKNOWN 0xFF + +/* hierarchy available values */ +#define HIER_NONE 0x00 +#define HIER_ALPHA_1 0x01 +#define HIER_ALPHA_2 0x02 +#define HIER_ALPHA_4 0x03 +#define HIER_UNKNOWN 0xFF + +/* interleaving available values */ +#define INTLV_NATIVE 0x00 +#define INTLV_IN_DEPTH 0x01 +#define INTLV_UNKNOWN 0xFF + +/* code rate available values */ +#define CODE_RATE_1_2 0x00 +#define CODE_RATE_2_3 0x01 +#define CODE_RATE_3_4 0x02 +#define CODE_RATE_5_6 0x03 +#define CODE_RATE_7_8 0x04 +#define CODE_RATE_UNKNOWN 0xFF + +/* guard interval available values */ +#define GUARD_INT_1_32 0x00 +#define GUARD_INT_1_16 0x01 +#define GUARD_INT_1_8 0x02 +#define GUARD_INT_1_4 0x03 +#define GUARD_UNKNOWN 0xFF + +/* transmission mode available values */ +#define TRANS_MODE_2K 0x00 +#define TRANS_MODE_8K 0x01 +#define TRANS_MODE_4K 0x02 +#define TRANS_MODE_UNKNOWN 0xFF + +/* DVBH signalling available values */ +#define TIMESLICING_PRESENT 0x01 +#define MPE_FEC_PRESENT 0x02 + +/* tune state available */ +#define TUNE_STATUS_NOT_TUNED 0x00 +#define TUNE_STATUS_IDLE 0x01 +#define TUNE_STATUS_LOCKING 0x02 +#define TUNE_STATUS_SIGNAL_DVB_OK 0x03 +#define TUNE_STATUS_STREAM_DETECTED 0x04 +#define TUNE_STATUS_STREAM_TUNED 0x05 +#define TUNE_STATUS_ERROR 0xFF + +/* available TS FID filter types */ +#define TS_PID_TYPE_TS 0 +#define TS_PID_TYPE_PSI_SI 1 +#define TS_PID_TYPE_MPE 2 + +/* number of echos available */ +#define MAX_ECHOS 15 + +/* Context types */ +#define CONTEXT_LNA 1010 +#define CONTEXT_ELNA_HYSTERESIS 4003 +#define CONTEXT_ELNA_GAIN 4004 +#define CONTEXT_MER_THRESHOLD 5005 +#define CONTEXT_MER_OFFSET 5006 +#define CONTEXT_IR_STATE 7000 +#define CONTEXT_TSOUT_MSB_FIRST 7004 +#define CONTEXT_TSOUT_FALLING_EDGE 7005 + +/* Configuration modes */ +#define CFG_MODE_ON 0 +#define CFG_MODE_OFF 1 +#define CFG_MODE_AUTO 2 + +#pragma pack(1) +struct as10x_tps { + uint8_t constellation; + uint8_t hierarchy; + uint8_t interleaving_mode; + uint8_t code_rate_HP; + uint8_t code_rate_LP; + uint8_t guard_interval; + uint8_t transmission_mode; + uint8_t DVBH_mask_HP; + uint8_t DVBH_mask_LP; + uint16_t cell_ID; +}; + +struct as10x_tune_args { + /* frequency */ + uint32_t freq; + /* bandwidth */ + uint8_t bandwidth; + /* hierarchy selection */ + uint8_t hier_select; + /* constellation */ + uint8_t constellation; + /* hierarchy */ + uint8_t hierarchy; + /* interleaving mode */ + uint8_t interleaving_mode; + /* code rate */ + uint8_t code_rate; + /* guard interval */ + uint8_t guard_interval; + /* transmission mode */ + uint8_t transmission_mode; +}; + +struct as10x_tune_status { + /* tune status */ + uint8_t tune_state; + /* signal strength */ + int16_t signal_strength; + /* packet error rate 10^-4 */ + uint16_t PER; + /* bit error rate 10^-4 */ + uint16_t BER; +}; + +struct as10x_demod_stats { + /* frame counter */ + uint32_t frame_count; + /* Bad frame counter */ + uint32_t bad_frame_count; + /* Number of wrong bytes fixed by Reed-Solomon */ + uint32_t bytes_fixed_by_rs; + /* Averaged MER */ + uint16_t mer; + /* statistics calculation state indicator (started or not) */ + uint8_t has_started; +}; + +struct as10x_ts_filter { + uint16_t pid; /** valid PID value 0x00 : 0x2000 */ + uint8_t type; /** Red TS_PID_TYPE_<N> values */ + uint8_t idx; /** index in filtering table */ +}; + +struct as10x_register_value { + uint8_t mode; + union { + uint8_t value8; /* 8 bit value */ + uint16_t value16; /* 16 bit value */ + uint32_t value32; /* 32 bit value */ + }u; +}; + +#pragma pack() + +struct as10x_register_addr { + /* register addr */ + uint32_t addr; + /* register mode access */ + uint8_t mode; +}; + + +#endif ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 1/14] staging/media/as102: initial import from Abilis 2011-10-18 9:11 ` [PATCH 1/14] staging/media/as102: initial import from Abilis Piotr Chmura @ 2011-10-18 16:24 ` Dan Carpenter 2011-10-18 16:38 ` Mauro Carvalho Chehab 2011-10-18 19:46 ` [RESEND PATCH " Piotr Chmura 1 sibling, 1 reply; 91+ messages in thread From: Dan Carpenter @ 2011-10-18 16:24 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, devel, Devin Heitmueller, Patrick Dickey, Greg KH, Stefan Richter, LMML On Tue, Oct 18, 2011 at 11:11:34AM +0200, Piotr Chmura wrote: > diff --git linux/drivers/staging/media/as102/Kconfig linuxb/drivers/media/dvb/as102/Kconfig > new file mode 100644 > --- /dev/null > +++ linuxb/drivers/staging/media/as102/Kconfig > @@ -0,0 +1,7 @@ > +config DVB_AS102 > + tristate "Abilis AS102 DVB receiver" > + depends on DVB_CORE && USB && I2C && INPUT > + help > + Choose Y or M here if you have a device containing an AS102 > + > + To compile this driver as a module, choose M here > diff --git linux/drivers/staging/media/as102/Makefile linuxb/drivers/media/dvb/as102/Makefile > new file mode 100644 > --- /dev/null > +++ linuxb/drivers/staging/media/as102/Makefile > @@ -0,0 +1,5 @@ > +dvb-as102-objs := as102_drv.o as102_fw.o as10x_cmd.o as10x_cmd_stream.o as102_fe.o as102_usb_drv.o as10x_cmd_cfg.o > + > +obj-$(CONFIG_DVB_AS102) += dvb-as102.o > + > +EXTRA_CFLAGS += -DLINUX -DCONFIG_AS102_USB -Idrivers/media/dvb/dvb-core It sounds like you're going to do a resend to add in the Signed-off-by lines? It would be better to separate these two chunks out and put them at the end after you've fixed the compile errors in [PATCH 13/14]. regards, dan carpenter ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 1/14] staging/media/as102: initial import from Abilis 2011-10-18 16:24 ` Dan Carpenter @ 2011-10-18 16:38 ` Mauro Carvalho Chehab 2011-10-18 22:33 ` Dan Carpenter 0 siblings, 1 reply; 91+ messages in thread From: Mauro Carvalho Chehab @ 2011-10-18 16:38 UTC (permalink / raw) To: Dan Carpenter Cc: Piotr Chmura, devel, Devin Heitmueller, Patrick Dickey, Greg KH, Stefan Richter, LMML Em 18-10-2011 14:24, Dan Carpenter escreveu: > On Tue, Oct 18, 2011 at 11:11:34AM +0200, Piotr Chmura wrote: >> diff --git linux/drivers/staging/media/as102/Kconfig linuxb/drivers/media/dvb/as102/Kconfig >> new file mode 100644 >> --- /dev/null >> +++ linuxb/drivers/staging/media/as102/Kconfig >> @@ -0,0 +1,7 @@ >> +config DVB_AS102 >> + tristate "Abilis AS102 DVB receiver" >> + depends on DVB_CORE && USB && I2C && INPUT >> + help >> + Choose Y or M here if you have a device containing an AS102 >> + >> + To compile this driver as a module, choose M here >> diff --git linux/drivers/staging/media/as102/Makefile linuxb/drivers/media/dvb/as102/Makefile >> new file mode 100644 >> --- /dev/null >> +++ linuxb/drivers/staging/media/as102/Makefile >> @@ -0,0 +1,5 @@ >> +dvb-as102-objs := as102_drv.o as102_fw.o as10x_cmd.o as10x_cmd_stream.o as102_fe.o as102_usb_drv.o as10x_cmd_cfg.o >> + >> +obj-$(CONFIG_DVB_AS102) += dvb-as102.o >> + >> +EXTRA_CFLAGS += -DLINUX -DCONFIG_AS102_USB -Idrivers/media/dvb/dvb-core > > It sounds like you're going to do a resend to add in the > Signed-off-by lines? > > It would be better to separate these two chunks out and put them at > the end after you've fixed the compile errors in [PATCH 13/14]. This doesn't really matter, as the driver won't be added to the Kernel building system before patch 13/14, as drivers/staging/Makefile wasn't touch on patch 1/14. > > regards, > dan carpenter ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH 1/14] staging/media/as102: initial import from Abilis 2011-10-18 16:38 ` Mauro Carvalho Chehab @ 2011-10-18 22:33 ` Dan Carpenter 0 siblings, 0 replies; 91+ messages in thread From: Dan Carpenter @ 2011-10-18 22:33 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: devel, Devin Heitmueller, Patrick Dickey, Greg KH, Stefan Richter, Piotr Chmura, LMML On Tue, Oct 18, 2011 at 02:38:59PM -0200, Mauro Carvalho Chehab wrote: > > It would be better to separate these two chunks out and put them at > > the end after you've fixed the compile errors in [PATCH 13/14]. > > This doesn't really matter, as the driver won't be added to the Kernel building system > before patch 13/14, as drivers/staging/Makefile wasn't touch on patch 1/14. Ah sorry. My bad. regards, dan carpenter ^ permalink raw reply [flat|nested] 91+ messages in thread
* [RESEND PATCH 1/14] staging/media/as102: initial import from Abilis 2011-10-18 9:11 ` [PATCH 1/14] staging/media/as102: initial import from Abilis Piotr Chmura 2011-10-18 16:24 ` Dan Carpenter @ 2011-10-18 19:46 ` Piotr Chmura 2011-10-30 21:03 ` Piotr Chmura 1 sibling, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 19:46 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Changes made by me: 1. Driver moved from media/dvb to staging/media 2. Removed Makefile/Kconfig - it doesn't compile in current tree Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318322 18000 # Node ID a78bda1e1a0badc4a1296be958f1f8a49014ae18 # Parent 37581bb7e6f1c5ba92c9b6934b4bf21e0e01cb2b as102: import initial as102 driver From: Pierrick Hascoet <pierrick.hascoet@abilis.com> Import the original Abilis Systems as102 driver. The source is unmodified, with the only changes I've made so far were that I created a Kconfig and Makefile so that the code builds in a standard v4l-dvb tree. This driver requires firmware (which Abilis has provided with redistribution terms which will allow it to be bundled in the Linux distributions). The firmware can be downloaded from here: http://www.kernellabs.com/firmware/as102/ Thanks to Rainer Miethling from PCTV Systems for working to get the driver released (for use with the PCTV 74e) and Pierrick Hascoet from Abilis for authoring the driver. Priority: normal Signed-off-by: Pierrick Hascoet <pierrick.hascoet@abilis.com> Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff --git linux/drivers/staging/media/as102/Kconfig linuxb/drivers/media/dvb/as102/Kconfig new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/Kconfig @@ -0,0 +1,7 @@ +config DVB_AS102 + tristate "Abilis AS102 DVB receiver" + depends on DVB_CORE && USB && I2C && INPUT + help + Choose Y or M here if you have a device containing an AS102 + + To compile this driver as a module, choose M here diff --git linux/drivers/staging/media/as102/Makefile linuxb/drivers/media/dvb/as102/Makefile new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/Makefile @@ -0,0 +1,5 @@ +dvb-as102-objs := as102_drv.o as102_fw.o as10x_cmd.o as10x_cmd_stream.o as102_fe.o as102_usb_drv.o as10x_cmd_cfg.o + +obj-$(CONFIG_DVB_AS102) += dvb-as102.o + +EXTRA_CFLAGS += -DLINUX -DCONFIG_AS102_USB -Idrivers/media/dvb/dvb-core diff --git linux/drivers/staging/media/as102/as102_drv.c linuxb/drivers/media/dvb/as102/as102_drv.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_drv.c @@ -0,0 +1,356 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/slab.h> +#include <linux/module.h> +#include <linux/mm.h> +#include <linux/kref.h> +#include <asm/uaccess.h> +#include <linux/usb.h> + +/* header file for Usb device driver*/ +#include "as102_drv.h" +#include "as102_fw.h" + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +#include "dvbdev.h" +#else +#warning >>> DVB_CORE not defined !!! <<< +#endif + +int debug = 0; +module_param_named(debug, debug, int, 0644); +MODULE_PARM_DESC(debug, "Turn on/off debugging (default: off)"); + +int dual_tuner = 0; +module_param_named(dual_tuner, dual_tuner, int, 0644); +MODULE_PARM_DESC(dual_tuner, "Activate Dual-Tuner configuration (default: off)"); + +static int fw_upload = 1; +module_param_named(fw_upload, fw_upload, int, 0644); +MODULE_PARM_DESC(fw_upload, "Turn on/off default FW upload (default: on)"); + +static int pid_filtering = 0; +module_param_named(pid_filtering, pid_filtering, int, 0644); +MODULE_PARM_DESC(pid_filtering, "Activate HW PID filtering (default: off)"); + +static int ts_auto_disable = 0; +module_param_named(ts_auto_disable, ts_auto_disable, int, 0644); +MODULE_PARM_DESC(ts_auto_disable, "Stream Auto Enable on FW (default: off)"); + +int elna_enable = 1; +module_param_named(elna_enable, elna_enable, int, 0644); +MODULE_PARM_DESC(elna_enable, "Activate eLNA (default: on)"); + +#ifdef DVB_DEFINE_MOD_OPT_ADAPTER_NR +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); +#endif + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +static void as102_stop_stream(struct as102_dev_t *dev) { + struct as102_bus_adapter_t *bus_adap; + + if (dev != NULL) + bus_adap = &dev->bus_adap; + else + return; + + if (bus_adap->ops->stop_stream != NULL) + bus_adap->ops->stop_stream(dev); + + if (ts_auto_disable) { + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return; + + if (as10x_cmd_stop_streaming(bus_adap) < 0) { + dprintk(debug, "as10x_cmd_stop_streaming failed\n"); + } + + mutex_unlock(&dev->bus_adap.lock); + } +} + +static int as102_start_stream(struct as102_dev_t *dev) { + + struct as102_bus_adapter_t *bus_adap; + int ret = -EFAULT; + + if (dev != NULL) + bus_adap = &dev->bus_adap; + else + return ret; + + if (bus_adap->ops->start_stream != NULL) { + ret = bus_adap->ops->start_stream(dev); + } + + if (ts_auto_disable) { + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EFAULT; + + ret = as10x_cmd_start_streaming(bus_adap); + + mutex_unlock(&dev->bus_adap.lock); + } + + return ret; +} + +static int as10x_pid_filter(struct as102_dev_t *dev, + int index, u16 pid, int onoff) { + + struct as102_bus_adapter_t *bus_adap = &dev->bus_adap; + int ret = -EFAULT; + + ENTER(); + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) { + dprintk(debug, "mutex_lock_interruptible(lock) failed !\n"); + return -EBUSY; + } + + switch(onoff) { + case 0: + ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) pid); + dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = %d\n", + index, pid, ret); + break; + case 1: + { + struct as10x_ts_filter filter; + + filter.type = TS_PID_TYPE_TS; + filter.idx = 0xFF; + filter.pid = pid; + + ret = as10x_cmd_add_PID_filter(bus_adap, &filter); + dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n", + index, filter.idx, filter.pid, ret); + break; + } + } + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return ret; +} + +static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed) { + int ret = 0; + struct dvb_demux *demux = dvbdmxfeed->demux; + struct as102_dev_t *as102_dev = demux->priv; + + ENTER(); + + if (mutex_lock_interruptible(&as102_dev->sem)) + return -ERESTARTSYS; + + if (pid_filtering) { + as10x_pid_filter(as102_dev, + dvbdmxfeed->index, dvbdmxfeed->pid, 1); + } + + if (as102_dev->streaming++ == 0) { + ret = as102_start_stream(as102_dev); + } + + mutex_unlock(&as102_dev->sem); + LEAVE(); + return ret; +} + +static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed) { + struct dvb_demux *demux = dvbdmxfeed->demux; + struct as102_dev_t *as102_dev = demux->priv; + + ENTER(); + + if (mutex_lock_interruptible(&as102_dev->sem)) + return -ERESTARTSYS; + + if (--as102_dev->streaming == 0) { + as102_stop_stream(as102_dev); + } + + if (pid_filtering) { + as10x_pid_filter(as102_dev, + dvbdmxfeed->index, dvbdmxfeed->pid, 0); + } + + mutex_unlock(&as102_dev->sem); + LEAVE(); + return 0; +} +#endif + +int as102_dvb_register(struct as102_dev_t *as102_dev) { + int ret = 0; + ENTER(); + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) + ret = dvb_register_adapter(&as102_dev->dvb_adap, + DEVICE_FULL_NAME, + THIS_MODULE, +#if defined(CONFIG_AS102_USB) + &as102_dev->bus_adap.usb_dev->dev +#elif defined(CONFIG_AS102_SPI) + &as102_dev->bus_adap.spi_dev->dev +#else +#error >>> dvb_register_adapter <<< +#endif +#ifdef DVB_DEFINE_MOD_OPT_ADAPTER_NR + , adapter_nr +#endif + ); + if (ret < 0) { + err("%s: dvb_register_adapter() failed (errno = %d)", + __FUNCTION__, ret); + goto failed; + } + + as102_dev->dvb_dmx.priv = as102_dev; + as102_dev->dvb_dmx.filternum = pid_filtering ? 16 : 256; + as102_dev->dvb_dmx.feednum = 256; + as102_dev->dvb_dmx.start_feed = as102_dvb_dmx_start_feed; + as102_dev->dvb_dmx.stop_feed = as102_dvb_dmx_stop_feed; + + as102_dev->dvb_dmx.dmx.capabilities = DMX_TS_FILTERING | + DMX_SECTION_FILTERING; + + as102_dev->dvb_dmxdev.filternum = as102_dev->dvb_dmx.filternum; + as102_dev->dvb_dmxdev.demux = &as102_dev->dvb_dmx.dmx; + as102_dev->dvb_dmxdev.capabilities = 0; + + if ((ret = dvb_dmx_init(&as102_dev->dvb_dmx)) < 0) { + err("%s: dvb_dmx_init() failed (errno = %d)", + __FUNCTION__, ret); + goto failed; + } + + ret = dvb_dmxdev_init(&as102_dev->dvb_dmxdev, &as102_dev->dvb_adap); + if (ret < 0) { + err("%s: dvb_dmxdev_init() failed (errno = %d)", + __FUNCTION__, ret); + goto failed; + } + + ret = as102_dvb_register_fe(as102_dev, &as102_dev->dvb_fe); + if (ret < 0) { + err("%s: as102_dvb_register_frontend() failed (errno = %d)", + __FUNCTION__, ret); + goto failed; + } +#endif + + /* init bus mutex for token locking */ + mutex_init(&as102_dev->bus_adap.lock); + + /* init start / stop stream mutex */ + mutex_init(&as102_dev->sem); + +#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) + /* + * try to load as102 firmware. If firmware upload failed, we'll be + * able to upload it later. + */ + if (fw_upload) + try_then_request_module(as102_fw_upload(&as102_dev->bus_adap), + "firmware_class"); +#endif + +failed: + LEAVE(); + /* FIXME: free dvb_XXX */ + return ret; +} + +void as102_dvb_unregister(struct as102_dev_t *as102_dev) { + ENTER(); + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) + /* unregister as102 frontend */ + as102_dvb_unregister_fe(&as102_dev->dvb_fe); + + /* unregister demux device */ + dvb_dmxdev_release(&as102_dev->dvb_dmxdev); + dvb_dmx_release(&as102_dev->dvb_dmx); + + /* unregister dvb adapter */ + dvb_unregister_adapter(&as102_dev->dvb_adap); +#endif + LEAVE(); +} + +static int __init as102_driver_init(void) { + int ret = 0; + + ENTER(); + + /* register this driver with the low level subsystem */ +#if defined(CONFIG_AS102_USB) + ret = usb_register(&as102_usb_driver); + if (ret) + err("usb_register failed (ret = %d)", ret); +#endif +#if defined(CONFIG_AS102_SPI) + ret = spi_register_driver(&as102_spi_driver); + if (ret) + printk(KERN_ERR "spi_register failed (ret = %d)", ret); +#endif + + LEAVE(); + return ret; +} + +/* + * Mandatory function : Adds a special section to the module indicating + * where initialisation function is defined + */ +module_init(as102_driver_init); + +/** + * \brief as102 driver exit point. This function is called when device has + * to be removed. + */ +static void __exit as102_driver_exit(void) { + ENTER(); + /* deregister this driver with the low level bus subsystem */ +#if defined(CONFIG_AS102_USB) + usb_deregister(&as102_usb_driver); +#endif +#if defined(CONFIG_AS102_SPI) + spi_unregister_driver(&as102_spi_driver); +#endif + LEAVE(); +} + +/* + * required function for unload: Adds a special section to the module + * indicating where unload function is defined + */ +module_exit(as102_driver_exit); +/* modinfo details */ +MODULE_DESCRIPTION(DRIVER_FULL_NAME); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Pierrick Hascoet <pierrick.hascoet@abilis.com>"); + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as102_drv.h linuxb/drivers/media/dvb/as102/as102_drv.h new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_drv.h @@ -0,0 +1,146 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if defined(CONFIG_AS102_USB) +#include <linux/usb.h> +extern struct usb_driver as102_usb_driver; +#endif + +#if defined(CONFIG_AS102_SPI) +#include <linux/platform_device.h> +#include <linux/spi/spi.h> +#include <linux/cdev.h> + +extern struct spi_driver as102_spi_driver; +#endif + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +#include "dvb_demux.h" +#include "dvb_frontend.h" +#include "dmxdev.h" +#endif + +#define DRIVER_FULL_NAME "Abilis Systems as10x usb driver" +#define DRIVER_NAME "as10x_usb" + +extern int debug; + +#define dprintk(debug, args...) \ + do { if (debug) { \ + printk(KERN_DEBUG "%s: ",__FUNCTION__); \ + printk(args); \ + } } while (0) + +#ifdef TRACE +#define ENTER() printk(">> enter %s\n", __FUNCTION__) +#define LEAVE() printk("<< leave %s\n", __FUNCTION__) +#else +#define ENTER() +#define LEAVE() +#endif + +#define AS102_DEVICE_MAJOR 192 + +#define AS102_USB_BUF_SIZE 512 +#define MAX_STREAM_URB 32 + +#include "as10x_cmd.h" + +#if defined(CONFIG_AS102_USB) +#include "as102_usb_drv.h" +#endif + +#if defined(CONFIG_AS102_SPI) +#include "as10x_spi_drv.h" +#endif + + +struct as102_bus_adapter_t { +#if defined(CONFIG_AS102_USB) + struct usb_device *usb_dev; +#elif defined(CONFIG_AS102_SPI) + struct spi_device *spi_dev; + struct cdev cdev; /* spidev raw device */ + + struct timer_list timer; + struct completion xfer_done; +#endif + /* bus token lock */ + struct mutex lock; + /* low level interface for bus adapter */ + union as10x_bus_token_t { +#if defined(CONFIG_AS102_USB) + /* usb token */ + struct as10x_usb_token_cmd_t usb; +#endif +#if defined(CONFIG_AS102_SPI) + /* spi token */ + struct as10x_spi_token_cmd_t spi; +#endif + } token; + + /* token cmd xfer id */ + uint16_t cmd_xid; + + /* as10x command and response for dvb interface*/ + struct as10x_cmd_t *cmd, *rsp; + + /* bus adapter private ops callback */ + struct as102_priv_ops_t *ops; +}; + +struct as102_dev_t { + struct as102_bus_adapter_t bus_adap; + struct list_head device_entry; + struct kref kref; + unsigned long minor; + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) + struct dvb_adapter dvb_adap; + struct dvb_frontend dvb_fe; + struct dvb_demux dvb_dmx; + struct dmxdev dvb_dmxdev; +#endif + + /* demodulator stats */ + struct as10x_demod_stats demod_stats; + /* signal strength */ + uint16_t signal_strength; + /* bit error rate */ + uint32_t ber; + + /* timer handle to trig ts stream download */ + struct timer_list timer_handle; + + struct mutex sem; + dma_addr_t dma_addr; + void *stream; + int streaming; + struct urb *stream_urb[MAX_STREAM_URB]; +}; + +int as102_dvb_register(struct as102_dev_t *dev); +void as102_dvb_unregister(struct as102_dev_t *dev); + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +int as102_dvb_register_fe(struct as102_dev_t *dev, struct dvb_frontend *fe); +int as102_dvb_unregister_fe(struct dvb_frontend *dev); +#endif + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as102_fe.c linuxb/drivers/media/dvb/as102/as102_fe.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_fe.c @@ -0,0 +1,647 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <linux/version.h> + +#include "as102_drv.h" +#include "as10x_types.h" +#include "as10x_cmd.h" + +extern int elna_enable; + +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) +static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst, + struct as10x_tps *src); + +static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst, + struct dvb_frontend_parameters *src); + +static void as102_fe_release(struct dvb_frontend *fe) { + struct as102_dev_t *dev; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return; + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return; + + /* send abilis command: TURN_OFF */ + as10x_cmd_turn_off(&dev->bus_adap); + + mutex_unlock(&dev->bus_adap.lock); +#endif + + /* release frontend callback ops */ + memset(&fe->ops, 0, sizeof(struct dvb_frontend_ops)); + + /* flush statistics */ + memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); + dev->signal_strength = 0; + dev->ber = -1; + + /* reset tuner private data */ +/* fe->tuner_priv = NULL; */ + + LEAVE(); +} + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) +static int as102_fe_init(struct dvb_frontend *fe) { + int ret = 0; + struct as102_dev_t *dev; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + if (elna_enable) + ret = as10x_cmd_set_context(&dev->bus_adap, 1010, 0xC0); + + /* send abilis command: TURN_ON */ + ret = as10x_cmd_turn_on(&dev->bus_adap); + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return (ret < 0) ? -EINVAL : 0; +} +#endif + +static int as102_fe_set_frontend(struct dvb_frontend *fe, + struct dvb_frontend_parameters *params) { + int ret = 0; + struct as102_dev_t *dev; + struct as10x_tune_args tune_args = { 0 }; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + as102_fe_copy_tune_parameters(&tune_args, params); + + /* send abilis command: SET_TUNE */ + ret = as10x_cmd_set_tune(&dev->bus_adap, &tune_args); + if(ret != 0) { + dprintk(debug, "as10x_cmd_set_tune failed. (err = %d)\n", ret); + } + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return (ret < 0) ? -EINVAL : 0; +} + +static int as102_fe_get_frontend(struct dvb_frontend* fe, + struct dvb_frontend_parameters *p) { + int ret = 0; + struct as102_dev_t *dev; + struct as10x_tps tps = { 0 }; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -EINVAL; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + /* send abilis command: GET_TPS */ + ret = as10x_cmd_get_tps(&dev->bus_adap, &tps); + + if (ret == 0) + as10x_fe_copy_tps_parameters(p, &tps); + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return (ret < 0) ? -EINVAL : 0; +} + +static int as102_fe_get_tune_settings(struct dvb_frontend *fe, + struct dvb_frontend_tune_settings *settings) { + ENTER(); + +#if 0 + dprintk(debug, "step_size = %d\n", settings->step_size); + dprintk(debug, "max_drift = %d\n", settings->max_drift); + dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms, 1000); +#endif + + settings->min_delay_ms = 1000; + + LEAVE(); + return 0; +} + + +static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) { + int ret = 0; + struct as102_dev_t *dev; + struct as10x_tune_status tstate = { 0 }; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + /* send abilis command: GET_TUNE_STATUS */ + ret = as10x_cmd_get_tune_status(&dev->bus_adap, &tstate); + if (ret < 0) { + dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n", ret); + goto out; + } + + dev->signal_strength = tstate.signal_strength; + dev->ber = tstate.BER; + + switch(tstate.tune_state) { + case TUNE_STATUS_SIGNAL_DVB_OK: + *status = FE_HAS_SIGNAL | + FE_HAS_CARRIER; + break; + case TUNE_STATUS_STREAM_DETECTED: + *status = FE_HAS_SIGNAL | + FE_HAS_CARRIER | + FE_HAS_SYNC; + break; + case TUNE_STATUS_STREAM_TUNED: + *status = FE_HAS_SIGNAL | + FE_HAS_CARRIER | + FE_HAS_SYNC | + FE_HAS_LOCK; + break; + default: + *status = TUNE_STATUS_NOT_TUNED; + } + + dprintk(debug, "tuner status: 0x%02x , strength %d , per: %d , ber: %d\n", + tstate.tune_state, tstate.signal_strength, + tstate.PER, tstate.BER); + + if (*status & FE_HAS_LOCK) { + if (as10x_cmd_get_demod_stats(&dev->bus_adap, + (struct as10x_demod_stats *) &dev->demod_stats) < 0) { + memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); + dprintk(debug, "as10x_cmd_get_demod_stats failed (probably not tuned)\n"); + } else { + dprintk(debug, "demod status: fc: 0x%08x , bad fc: 0x%08x , bytes corrected: 0x%08x , MER: 0x%04x\n", + dev->demod_stats.frame_count, + dev->demod_stats.bad_frame_count, + dev->demod_stats.bytes_fixed_by_rs, + dev->demod_stats.mer); + } + } else { + memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); + } + +out: + mutex_unlock(&dev->bus_adap.lock); + LEAVE(); + return ret; +} + +/* + * Note: + * - in AS102 SNR=MER + * - the SNR will be returned in linear terms, i.e. not in dB + * - the accuracy equals ±2dB for a SNR range from 4dB to 30dB + * - the accuracy is >2dB for SNR values outside this range + */ +static int as102_fe_read_snr(struct dvb_frontend* fe, u16* snr) { + struct as102_dev_t *dev; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + *snr = dev->demod_stats.mer; + + LEAVE(); + return 0; +} + +static int as102_fe_read_ber(struct dvb_frontend* fe, u32* ber) { + struct as102_dev_t *dev; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + *ber = dev->ber; + + LEAVE(); + return 0; +} + +static int as102_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength) { + struct as102_dev_t *dev; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + *strength = (((0xffff * 400) * dev->signal_strength + 41000) * 2); + + LEAVE(); + return 0; +} + +static int as102_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) { + struct as102_dev_t *dev; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + if (dev->demod_stats.has_started) + *ucblocks = dev->demod_stats.bad_frame_count; + else + *ucblocks = 0; + + LEAVE(); + return 0; +} + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) +static int as102_fe_ts_bus_ctrl(struct dvb_frontend* fe, int acquire) { + struct as102_dev_t *dev; + int ret; + + ENTER(); + + if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + return -ENODEV; + + if (mutex_lock_interruptible(&dev->bus_adap.lock)) + return -EBUSY; + + if (acquire) { + if (elna_enable) + as10x_cmd_set_context(&dev->bus_adap, 1010, 0xC0); + + ret = as10x_cmd_turn_on(&dev->bus_adap); + } else { + ret = as10x_cmd_turn_off(&dev->bus_adap); + } + + mutex_unlock(&dev->bus_adap.lock); + + LEAVE(); + return ret; +} +#endif + +static struct dvb_frontend_ops as102_fe_ops = { + .info = { + .name = DEVICE_FULL_NAME, + .type = FE_OFDM, + .frequency_min = 174000000, + .frequency_max = 862000000, + .frequency_stepsize = 166667, + .caps = FE_CAN_INVERSION_AUTO + | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 + | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO + | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QPSK + | FE_CAN_QAM_AUTO + | FE_CAN_TRANSMISSION_MODE_AUTO + | FE_CAN_GUARD_INTERVAL_AUTO + | FE_CAN_HIERARCHY_AUTO + | FE_CAN_RECOVER + | FE_CAN_MUTE_TS + }, + + .set_frontend = as102_fe_set_frontend, + .get_frontend = as102_fe_get_frontend, + .get_tune_settings = as102_fe_get_tune_settings, + + + .read_status = as102_fe_read_status, + .read_snr = as102_fe_read_snr, + .read_ber = as102_fe_read_ber, + .read_signal_strength = as102_fe_read_signal_strength, + .read_ucblocks = as102_fe_read_ucblocks, + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) + .ts_bus_ctrl = as102_fe_ts_bus_ctrl, +#else + .release = as102_fe_release, + .init = as102_fe_init, +#endif +}; + +int as102_dvb_unregister_fe(struct dvb_frontend *fe) { + + /* unregister frontend */ + dvb_unregister_frontend(fe); + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) + /* detach frontend */ + dvb_frontend_detach(fe); +#endif + return 0; +} + +int as102_dvb_register_fe(struct as102_dev_t *as102_dev, struct dvb_frontend *dvb_fe) { + int errno; + struct dvb_adapter *dvb_adap; + + if(as102_dev == NULL) + return -EINVAL; + + /* extract dvb_adapter */ + dvb_adap = &as102_dev->dvb_adap; + + /* init frontend callback ops */ + memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops)); + + /* register dbvb frontend */ + errno = dvb_register_frontend(dvb_adap, dvb_fe); + if(errno == 0) + dvb_fe->tuner_priv = as102_dev; + + return errno; +} + +static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst, + struct as10x_tps *as10x_tps) { + + struct dvb_ofdm_parameters *fe_tps = &dst->u.ofdm; + + /* extract consteallation */ + switch(as10x_tps->constellation) { + case CONST_QPSK: + fe_tps->constellation = QPSK; + break; + case CONST_QAM16: + fe_tps->constellation = QAM_16; + break; + case CONST_QAM64: + fe_tps->constellation = QAM_64; + break; + } + + /* extract hierarchy */ + switch(as10x_tps->hierarchy) { + case HIER_NONE: + fe_tps->hierarchy_information = HIERARCHY_NONE; + break; + case HIER_ALPHA_1: + fe_tps->hierarchy_information = HIERARCHY_1; + break; + case HIER_ALPHA_2: + fe_tps->hierarchy_information = HIERARCHY_2; + break; + case HIER_ALPHA_4: + fe_tps->hierarchy_information = HIERARCHY_4; + break; + } + + /* extract code rate HP */ + switch(as10x_tps->code_rate_HP) { + case CODE_RATE_1_2: + fe_tps->code_rate_HP = FEC_1_2; + break; + case CODE_RATE_2_3: + fe_tps->code_rate_HP = FEC_2_3; + break; + case CODE_RATE_3_4: + fe_tps->code_rate_HP = FEC_3_4; + break; + case CODE_RATE_5_6: + fe_tps->code_rate_HP = FEC_5_6; + break; + case CODE_RATE_7_8: + fe_tps->code_rate_HP = FEC_7_8; + break; + } + + /* extract code rate LP */ + switch(as10x_tps->code_rate_LP) { + case CODE_RATE_1_2: + fe_tps->code_rate_LP = FEC_1_2; + break; + case CODE_RATE_2_3: + fe_tps->code_rate_LP = FEC_2_3; + break; + case CODE_RATE_3_4: + fe_tps->code_rate_LP = FEC_3_4; + break; + case CODE_RATE_5_6: + fe_tps->code_rate_LP = FEC_5_6; + break; + case CODE_RATE_7_8: + fe_tps->code_rate_LP = FEC_7_8; + break; + } + + /* extract guard interval */ + switch(as10x_tps->guard_interval) { + case GUARD_INT_1_32: + fe_tps->guard_interval = GUARD_INTERVAL_1_32; + break; + case GUARD_INT_1_16: + fe_tps->guard_interval = GUARD_INTERVAL_1_16; + break; + case GUARD_INT_1_8: + fe_tps->guard_interval = GUARD_INTERVAL_1_8; + break; + case GUARD_INT_1_4: + fe_tps->guard_interval = GUARD_INTERVAL_1_4; + break; + } + + /* extract transmission mode */ + switch(as10x_tps->transmission_mode) { + case TRANS_MODE_2K: + fe_tps->transmission_mode = TRANSMISSION_MODE_2K; + break; + case TRANS_MODE_8K: + fe_tps->transmission_mode = TRANSMISSION_MODE_8K; + break; + } +} + +static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg) { + uint8_t c; + + switch(arg) { + case FEC_1_2: + c = CODE_RATE_1_2; + break; + case FEC_2_3: + c = CODE_RATE_2_3; + break; + case FEC_3_4: + c = CODE_RATE_3_4; + break; + case FEC_5_6: + c = CODE_RATE_5_6; + break; + case FEC_7_8: + c = CODE_RATE_7_8; + break; + default: + c = CODE_RATE_UNKNOWN; + break; + } + + return c; +} + +static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args, + struct dvb_frontend_parameters *params) { + + /* set frequency */ + tune_args->freq = params->frequency / 1000; + + /* fix interleaving_mode */ + tune_args->interleaving_mode = INTLV_NATIVE; + + switch(params->u.ofdm.bandwidth) { + case BANDWIDTH_8_MHZ: + tune_args->bandwidth = BW_8_MHZ; + break; + case BANDWIDTH_7_MHZ: + tune_args->bandwidth = BW_7_MHZ; + break; + case BANDWIDTH_6_MHZ: + tune_args->bandwidth = BW_6_MHZ; + break; + default: + tune_args->bandwidth = BW_8_MHZ; + } + + switch(params->u.ofdm.guard_interval) { + case GUARD_INTERVAL_1_32: + tune_args->guard_interval = GUARD_INT_1_32; + break; + case GUARD_INTERVAL_1_16: + tune_args->guard_interval = GUARD_INT_1_16; + break; + case GUARD_INTERVAL_1_8: + tune_args->guard_interval = GUARD_INT_1_8; + break; + case GUARD_INTERVAL_1_4: + tune_args->guard_interval = GUARD_INT_1_4; + break; + case GUARD_INTERVAL_AUTO: + default: + tune_args->guard_interval = GUARD_UNKNOWN; + break; + } + + switch(params->u.ofdm.constellation) { + case QPSK: + tune_args->constellation = CONST_QPSK; + break; + case QAM_16: + tune_args->constellation = CONST_QAM16; + break; + case QAM_64: + tune_args->constellation = CONST_QAM64; + break; + default: + tune_args->constellation = CONST_UNKNOWN; + break; + } + + switch(params->u.ofdm.transmission_mode) { + case TRANSMISSION_MODE_2K: + tune_args->transmission_mode = TRANS_MODE_2K; + break; + case TRANSMISSION_MODE_8K: + tune_args->transmission_mode = TRANS_MODE_8K; + break; + default: + tune_args->transmission_mode = TRANS_MODE_UNKNOWN; + } + + switch(params->u.ofdm.hierarchy_information) { + case HIERARCHY_NONE: + tune_args->hierarchy = HIER_NONE; + break; + case HIERARCHY_1: + tune_args->hierarchy = HIER_ALPHA_1; + break; + case HIERARCHY_2: + tune_args->hierarchy = HIER_ALPHA_2; + break; + case HIERARCHY_4: + tune_args->hierarchy = HIER_ALPHA_4; + break; + case HIERARCHY_AUTO: + tune_args->hierarchy = HIER_UNKNOWN; + break; + } + + dprintk(debug, "tuner parameters: freq: %d bw: 0x%02x gi: 0x%02x\n", + params->frequency, + tune_args->bandwidth, + tune_args->guard_interval); + + /* + * Detect a hierarchy selection + * if HP/LP are both set to FEC_NONE, HP will be selected. + */ + if ((tune_args->hierarchy != HIER_NONE) && + ((params->u.ofdm.code_rate_LP == FEC_NONE) || + (params->u.ofdm.code_rate_HP == FEC_NONE))) { + + if (params->u.ofdm.code_rate_LP == FEC_NONE) { + tune_args->hier_select = HIER_HIGH_PRIORITY; + tune_args->code_rate = + as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); + } + + if (params->u.ofdm.code_rate_HP == FEC_NONE) { + tune_args->hier_select = HIER_LOW_PRIORITY; + tune_args->code_rate = + as102_fe_get_code_rate(params->u.ofdm.code_rate_LP); + } + + dprintk(debug, "\thierarchy: 0x%02x " + "selected: %s code_rate_%s: 0x%02x\n", + tune_args->hierarchy, + tune_args->hier_select == HIER_HIGH_PRIORITY ? "HP" : "LP", + tune_args->hier_select == HIER_HIGH_PRIORITY ? "HP" : "LP", + tune_args->code_rate); + } else { + tune_args->code_rate = as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); + } +} +#endif + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as102_fw.c linuxb/drivers/media/dvb/as102/as102_fw.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_fw.c @@ -0,0 +1,236 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/ctype.h> +#include <linux/delay.h> +#include <linux/firmware.h> + +#include "as102_drv.h" +#include "as102_fw.h" + +#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) +char as102_st_fw1[] = "as102_data1_st.hex"; +char as102_st_fw2[] = "as102_data2_st.hex"; +char as102_dt_fw1[] = "as102_data1_dt.hex"; +char as102_dt_fw2[] = "as102_data2_dt.hex"; + +static unsigned char atohx(unsigned char *dst, char *src) { + unsigned char value = 0; + + char msb = tolower(*src) - '0'; + char lsb = tolower(*(src +1)) - '0'; + + if (msb > 9 ) + msb -= 7; + if (lsb > 9 ) + lsb -= 7; + + *dst = value = ((msb & 0xF) << 4) | (lsb & 0xF); + return value; +} + +/* + * Parse INTEL HEX firmware file to extract address and data. + */ +static int parse_hex_line(unsigned char *fw_data, unsigned char *addr, + unsigned char *data, int *dataLength, + unsigned char *addr_has_changed) { + + int count = 0; + unsigned char *src, dst; + + if (*fw_data++ != ':') { + printk(KERN_ERR "invalid firmware file\n"); + return -EFAULT; + } + + /* locate end of line */ + for (src=fw_data; *src != '\n'; src += 2) { + atohx(&dst, src); + /* parse line to split addr / data */ + switch (count) { + case 0: + *dataLength = dst; + break; + case 1: + addr[2] = dst; + break; + case 2: + addr[3] = dst; + break; + case 3: + /* check if data is an address */ + if (dst == 0x04) + *addr_has_changed = 1; + else + *addr_has_changed = 0; + break; + case 4: + case 5: + if (*addr_has_changed) { + addr[(count - 4)] = dst; + } else { + data[(count - 4)] = dst; + } + break; + default: + data[(count - 4)] = dst; + break; + } + count++; + } + + /* return read value + ':' + '\n' */ + return ((count * 2) + 2); +} + +static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap, + unsigned char *cmd, + const struct firmware *firmware) { + + struct as10x_fw_pkt_t fw_pkt; + int total_read_bytes = 0, errno = 0; + unsigned char addr_has_changed = 0; + + ENTER(); + + for (total_read_bytes = 0; total_read_bytes < firmware->size; ) { + int read_bytes = 0, data_len = 0; + + /* parse intel hex line */ + read_bytes = parse_hex_line( + (u8 *) (firmware->data + total_read_bytes), + fw_pkt.raw.address, + fw_pkt.raw.data, + &data_len, + &addr_has_changed); + + if (read_bytes <= 0) { + goto error; + } + + /* detect the end of file */ + if ((total_read_bytes += read_bytes) == firmware->size) { + fw_pkt.u.request[0] = 0x00; + fw_pkt.u.request[1] = 0x03; + + /* send EOF command */ + if ((errno = bus_adap->ops->upload_fw_pkt(bus_adap,(uint8_t *) &fw_pkt, 2, 0)) < 0) + goto error; + } else { + if (!addr_has_changed) { + /* prepare command to send */ + fw_pkt.u.request[0] = 0x00; + fw_pkt.u.request[1] = 0x01; + + data_len += sizeof(fw_pkt.u.request); + data_len += sizeof(fw_pkt.raw.address); + + /* send cmd to device */ + if ((errno = bus_adap->ops->upload_fw_pkt(bus_adap, (uint8_t *) &fw_pkt, data_len, 0)) < 0) + goto error; + } + } + } +error: + LEAVE(); + return (errno == 0) ? total_read_bytes : errno; +} + +int as102_fw_upload(struct as102_bus_adapter_t *bus_adap) { + int errno = -EFAULT; + const struct firmware *firmware; + unsigned char *cmd_buf = NULL; + char *fw1, *fw2; + +#if defined(CONFIG_AS102_USB) + struct usb_device *dev = bus_adap->usb_dev; +#endif +#if defined(CONFIG_AS102_SPI) + struct spi_device *dev = bus_adap->spi_dev; +#endif + ENTER(); + + /* select fw file to upload */ + if (dual_tuner) { + fw1 = as102_dt_fw1; + fw2 = as102_dt_fw2; + } else { + fw1 = as102_st_fw1; + fw2 = as102_st_fw2; + } + +#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) + /* allocate buffer to store firmware upload command and data */ + if ((cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL)) == NULL) { + errno = -ENOMEM; + goto error; + } + + /* request kernel to locate firmware file: part1 */ + if ((errno = request_firmware(&firmware, fw1, &dev->dev)) < 0) { + printk(KERN_ERR "%s: unable to locate firmware file: %s\n", + DRIVER_NAME, fw1); + goto error; + } + + /* initiate firmware upload */ + if ((errno = as102_firmware_upload(bus_adap, cmd_buf, firmware)) < 0) { + printk(KERN_ERR "%s: error during firmware upload part1\n", + DRIVER_NAME); + goto error; + } + + printk(KERN_INFO "%s: fimrware: %s loaded with success\n", + DRIVER_NAME, fw1); + release_firmware(firmware); + + /* wait for boot to complete */ + mdelay(100); + + /* request kernel to locate firmware file: part2 */ + if ((errno = request_firmware(&firmware, fw2, &dev->dev)) < 0) { + printk(KERN_ERR "%s: unable to locate firmware file: %s\n", + DRIVER_NAME, fw2); + goto error; + } + + /* initiate firmware upload */ + if ((errno = as102_firmware_upload(bus_adap, cmd_buf, firmware)) < 0) { + printk(KERN_ERR "%s: error during firmware upload part2\n", + DRIVER_NAME); + goto error; + } + + printk(KERN_INFO "%s: fimrware: %s loaded with success\n", + DRIVER_NAME, fw2); +error: + /* free data buffer */ + kfree(cmd_buf); + /* release firmware if needed */ + if (firmware != NULL) + release_firmware(firmware); +#endif + LEAVE(); + return errno; +} +#endif + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as102_fw.h linuxb/drivers/media/dvb/as102/as102_fw.h new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_fw.h @@ -0,0 +1,42 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#define MAX_FW_PKT_SIZE 64 + +extern int dual_tuner; + +#pragma pack(1) +struct as10x_raw_fw_pkt { + unsigned char address[4]; + unsigned char data[MAX_FW_PKT_SIZE - 6]; +}; + +struct as10x_fw_pkt_t { + union { + unsigned char request[2]; + unsigned char length[2]; + } u; + struct as10x_raw_fw_pkt raw; +}; +#pragma pack() + +#ifdef __KERNEL__ +int as102_fw_upload(struct as102_bus_adapter_t *bus_adap); +#endif + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as102_usb_drv.c linuxb/drivers/media/dvb/as102/as102_usb_drv.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_usb_drv.c @@ -0,0 +1,432 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/slab.h> +#include <linux/mm.h> +#include <linux/usb.h> + +#include "as102_drv.h" +#include "as102_usb_drv.h" +#include "as102_fw.h" + +static void as102_usb_disconnect(struct usb_interface *interface); +static int as102_usb_probe(struct usb_interface *interface, + const struct usb_device_id *id); + +static int as102_usb_start_stream(struct as102_dev_t *dev); +static void as102_usb_stop_stream(struct as102_dev_t *dev); + +static int as102_open(struct inode *inode, struct file *file); +static int as102_release(struct inode *inode, struct file *file); + +static struct usb_device_id as102_usb_id_table[] = { + { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) }, + { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) }, + { } /* Terminating entry */ +}; + +struct usb_driver as102_usb_driver = { + .name = DRIVER_FULL_NAME, + .probe = as102_usb_probe, + .disconnect = as102_usb_disconnect, + .id_table = as102_usb_id_table +}; + +struct file_operations as102_dev_fops = { + .owner = THIS_MODULE, + .open = as102_open, + .release = as102_release, +}; + +static struct usb_class_driver as102_usb_class_driver = { + .name = "aton2-%d", + .fops = &as102_dev_fops, + .minor_base = AS102_DEVICE_MAJOR, +}; + +static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap, + unsigned char *send_buf, int send_buf_len, + unsigned char *recv_buf, int recv_buf_len) { + + int ret = 0; + ENTER(); + + if(send_buf != NULL) { + ret = usb_control_msg(bus_adap->usb_dev, + usb_sndctrlpipe(bus_adap->usb_dev, 0), + AS102_USB_DEVICE_TX_CTRL_CMD, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + bus_adap->cmd_xid, /* value */ + 0, /* index */ + send_buf, send_buf_len, + USB_CTRL_SET_TIMEOUT /* 200 */); + if(ret < 0) { + dprintk(debug, "usb_control_msg(send) failed, err %i\n", + ret); + return ret; + } + + if(ret != send_buf_len) { + dprintk(debug, "only wrote %d of %d bytes\n", + ret, send_buf_len); + return -1; + } + } + + if(recv_buf != NULL) { +#ifdef TRACE + dprintk(debug, "want to read: %d bytes\n", recv_buf_len); +#endif + ret = usb_control_msg(bus_adap->usb_dev, + usb_rcvctrlpipe(bus_adap->usb_dev, 0), + AS102_USB_DEVICE_RX_CTRL_CMD, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + bus_adap->cmd_xid, /* value */ + 0, /* index */ + recv_buf, recv_buf_len, + USB_CTRL_GET_TIMEOUT /* 200 */); + if(ret < 0) { + dprintk(debug, "usb_control_msg(recv) failed, err %i\n", + ret); + return ret; + } +#ifdef TRACE + dprintk(debug, "read %d bytes\n", recv_buf_len); +#endif + } + + LEAVE(); + return ret; +} + +static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap, + unsigned char *send_buf, + int send_buf_len, + int swap32) { + + int ret = 0, actual_len; + + ret = usb_bulk_msg(bus_adap->usb_dev, usb_sndbulkpipe(bus_adap->usb_dev, 1), + send_buf, send_buf_len, &actual_len, 200); + if(ret) { + dprintk(debug, "usb_bulk_msg(send) failed, err %i\n", ret); + return ret; + } + + if(actual_len != send_buf_len) { + dprintk(debug, "only wrote %d of %d bytes\n", + actual_len, send_buf_len); + return -1; + } + return ret ? ret : actual_len; +} + +static int as102_read_ep2(struct as102_bus_adapter_t *bus_adap, + unsigned char *recv_buf, int recv_buf_len) { + + int ret = 0, actual_len; + + if(recv_buf == NULL) + return -EINVAL; + + ret = usb_bulk_msg(bus_adap->usb_dev, usb_rcvbulkpipe(bus_adap->usb_dev, 2), + recv_buf, recv_buf_len, &actual_len, 200); + if(ret) { + dprintk(debug, "usb_bulk_msg(recv) failed, err %i\n", ret); + return ret; + } + + if(actual_len != recv_buf_len) { + dprintk(debug, "only read %d of %d bytes\n", + actual_len, recv_buf_len); + return -1; + } + return ret ? ret : actual_len; +} + +struct as102_priv_ops_t as102_priv_ops = { + .upload_fw_pkt = as102_send_ep1, + .xfer_cmd = as102_usb_xfer_cmd, + .as102_read_ep2 = as102_read_ep2, + .start_stream = as102_usb_start_stream, + .stop_stream = as102_usb_stop_stream, +}; + +static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb) { + int err; + + usb_fill_bulk_urb(urb, + dev->bus_adap.usb_dev, + usb_rcvbulkpipe(dev->bus_adap.usb_dev, 0x2), + urb->transfer_buffer, + AS102_USB_BUF_SIZE, + as102_urb_stream_irq, + dev); + + if ((err = usb_submit_urb(urb, GFP_ATOMIC))) + dprintk(debug, "%s: usb_submit_urb failed\n", __FUNCTION__); + + return err; +} + +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)) +void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs) +#else +void as102_urb_stream_irq(struct urb *urb) +#endif +{ + struct as102_dev_t *as102_dev = urb->context; + + if (urb->actual_length > 0) { +#if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) + dvb_dmx_swfilter(&as102_dev->dvb_dmx, + urb->transfer_buffer, + urb->actual_length); +#else + /* do nothing ? */ +#endif + } else { + if(urb->actual_length == 0) + memset(urb->transfer_buffer, 0, AS102_USB_BUF_SIZE); + } + + /* is not stopped, re-submit urb */ + if (as102_dev->streaming) + as102_submit_urb_stream(as102_dev, urb); +} + +static void as102_free_usb_stream_buffer(struct as102_dev_t *dev) { + int i; + + ENTER(); + + for (i = 0; i < MAX_STREAM_URB; i++) + usb_free_urb(dev->stream_urb[i]); + + usb_buffer_free(dev->bus_adap.usb_dev, + MAX_STREAM_URB * AS102_USB_BUF_SIZE, + dev->stream, + dev->dma_addr); + LEAVE(); +} + +static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) { + int i, ret = 0; + + ENTER(); + + dev->stream = usb_buffer_alloc(dev->bus_adap.usb_dev, + MAX_STREAM_URB * AS102_USB_BUF_SIZE, + GFP_KERNEL, + &dev->dma_addr); + if (!dev->stream) { + dprintk(debug, "%s: usb_buffer_alloc failed\n", __FUNCTION__); + return -ENOMEM; + } + + memset(dev->stream, 0, MAX_STREAM_URB * AS102_USB_BUF_SIZE); + + /* init urb buffers */ + for (i = 0; i < MAX_STREAM_URB; i++) { + struct urb *urb; + + if (!(urb = usb_alloc_urb(0, GFP_ATOMIC))) { + dprintk(debug, "%s: usb_alloc_urb failed\n", __FUNCTION__); + as102_free_usb_stream_buffer(dev); + return -ENOMEM; + } + + urb->transfer_buffer = dev->stream + (i * AS102_USB_BUF_SIZE); + urb->transfer_buffer_length = AS102_USB_BUF_SIZE; + + dev->stream_urb[i] = urb; + } + LEAVE(); + return ret; +} + +static void as102_usb_stop_stream(struct as102_dev_t *dev) { + int i; + + for (i = 0; i < MAX_STREAM_URB; i++) + usb_kill_urb(dev->stream_urb[i]); +} + +static int as102_usb_start_stream(struct as102_dev_t *dev) { + int i, ret = 0; + + for (i = 0; i < MAX_STREAM_URB; i++) { + if ((ret = as102_submit_urb_stream(dev, dev->stream_urb[i]))) { + as102_usb_stop_stream(dev); + return ret; + } + } + + return 0; +} + +static void as102_usb_release(struct kref *kref) { + struct as102_dev_t *as102_dev; + + ENTER(); + + as102_dev = container_of(kref, struct as102_dev_t, kref); + if (as102_dev != NULL) { + usb_put_dev(as102_dev->bus_adap.usb_dev); + kfree(as102_dev); + } + + LEAVE(); +} + +static void as102_usb_disconnect(struct usb_interface *intf) { + struct as102_dev_t *as102_dev; + + ENTER(); + + /* extract as102_dev_t from usb_device private data */ + as102_dev = usb_get_intfdata(intf); + + /* unregister dvb layer */ + as102_dvb_unregister(as102_dev); + + /* free usb buffers */ + as102_free_usb_stream_buffer(as102_dev); + + usb_set_intfdata(intf, NULL); + + /* usb unregister device */ + usb_deregister_dev(intf, &as102_usb_class_driver); + + /* decrement usage counter */ + kref_put(&as102_dev->kref, as102_usb_release); + + printk(KERN_INFO "%s: device has been disconnected\n", DRIVER_NAME); + + LEAVE(); +} + +static int as102_usb_probe(struct usb_interface *intf, + const struct usb_device_id *id) { + int ret; + struct as102_dev_t *as102_dev; + + ENTER(); + + if(!(as102_dev = kzalloc(sizeof(struct as102_dev_t), GFP_KERNEL))) { + err("%s: kzalloc failed", __FUNCTION__); + return -ENOMEM; + } + + /* set private callback functions */ + as102_dev->bus_adap.ops = &as102_priv_ops; + + /* init cmd token for usb bus */ + as102_dev->bus_adap.cmd = &as102_dev->bus_adap.token.usb.c; + as102_dev->bus_adap.rsp = &as102_dev->bus_adap.token.usb.r; + + /* init kernel device reference */ + kref_init(&as102_dev->kref); + + /* store as102 device to usb_device private data */ + usb_set_intfdata(intf, (void *) as102_dev); + + /* store in as102 device the usb_device pointer */ + as102_dev->bus_adap.usb_dev = usb_get_dev(interface_to_usbdev(intf)); + + /* we can register the device now, as it is ready */ + if((ret = usb_register_dev(intf, &as102_usb_class_driver)) < 0) {; + /* something prevented us from registering this driver */ + err("%s: usb_register_dev() failed (errno = %d)", + __FUNCTION__, ret); + goto failed; + } + + printk(KERN_INFO "%s: device has been detected\n", DRIVER_NAME); + + /* request buffer allocation for streaming */ + if ((ret = as102_alloc_usb_stream_buffer(as102_dev)) != 0) + goto failed; + + /* register dvb layer */ + ret = as102_dvb_register(as102_dev); + + LEAVE(); + return ret; + +failed: + usb_set_intfdata(intf, NULL); + kfree(as102_dev); + return ret; +} + +static int as102_open(struct inode *inode, struct file *file) { + int ret = 0, minor = 0; + struct usb_interface *intf = NULL; + struct as102_dev_t *dev = NULL; + + ENTER(); + + /* read minor from inode */ + minor = iminor(inode); + + /* fetch device from usb interface */ + if((intf = usb_find_interface(&as102_usb_driver, minor)) == NULL) { + printk(KERN_ERR "%s: can't find device for minor %d\n", + __FUNCTION__, minor); + ret = -ENODEV; + goto exit; + } + + /* get our device */ + if((dev = usb_get_intfdata(intf)) == NULL) { + ret = -EFAULT; + goto exit; + } + + /* save our device object in the file's private structure */ + file->private_data = dev; + + /* increment our usage count for the device */ + kref_get(&dev->kref); + +exit: + LEAVE(); + return ret; +} + +static int as102_release(struct inode *inode, struct file *file) { + int ret = 0; + struct as102_dev_t *dev = NULL; + + ENTER(); + + if((dev = file->private_data) != NULL ) { + /* decrement the count on our device */ + kref_put(&dev->kref, as102_usb_release); + } + + LEAVE(); + return ret; +} + +MODULE_DEVICE_TABLE(usb, as102_usb_id_table); + +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as102_usb_drv.h linuxb/drivers/media/dvb/as102/as102_usb_drv.h new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as102_usb_drv.h @@ -0,0 +1,54 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <linux/version.h> + +#ifndef _AS102_USB_DRV_H_ +#define _AS102_USB_DRV_H_ + +#define AS102_USB_DEVICE_TX_CTRL_CMD 0xF1 +#define AS102_USB_DEVICE_RX_CTRL_CMD 0xF2 + +/* define these values to match the supported devices */ + +/* Abilis system: "TITAN" */ +#define AS102_USB_DEVICE_VENDOR_ID 0x1BA6 +#define AS102_USB_DEVICE_PID_0001 0x0001 + +/* PCTV Systems: PCTV picoStick (74e) */ +#define DEVICE_FULL_NAME "PCTV Systems : PCTV picoStick (74e)" +#define PCTV_74E_USB_VID 0x2013 +#define PCTV_74E_USB_PID 0x0246 + +extern struct file_operations as102_dev_fops; + +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)) +void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs); +#else +void as102_urb_stream_irq(struct urb *urb); +#endif + + +struct as10x_usb_token_cmd_t { + /* token cmd */ + struct as10x_cmd_t c; + /* token response */ + struct as10x_cmd_t r; +}; +#endif +/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff --git linux/drivers/staging/media/as102/as10x_cmd.c linuxb/drivers/media/dvb/as102/as10x_cmd.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as10x_cmd.c @@ -0,0 +1,478 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */ +#include <linux/kernel.h> +#include "as102_drv.h" +#elif defined(WIN32) + #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) /* win32 ddk implementation */ + #include "wdm.h" + #include "Device.h" + #include "endian_mgmt.h" /* FIXME */ + #else /* win32 sdk implementation */ + #include <windows.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" + #endif +#else /* all other cases */ + #include <string.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" /* FIXME */ +#endif /* __KERNEL__ */ + +#include "as10x_types.h" +#include "as10x_cmd.h" + +/** + \brief send turn on command to AS10x + \param phandle: pointer to AS10x handle + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_turn_on(as10x_handle_t *phandle) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd,(++phandle->cmd_xid), sizeof(pcmd->body.turn_on.req)); + + /* fill command */ + pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON); + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( + phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.turn_on.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.turn_on.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief send turn off command to AS10x + \param phandle: pointer to AS10x handle + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_turn_off(as10x_handle_t *phandle) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.turn_off.req)); + + /* fill command */ + pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF); + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( + phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.turn_off.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief send set tune command to AS10x + \param phandle: pointer to AS10x handle + \param ptune: tune parameters + \return 0 when no error, < 0 in case of error. + \callgraph + */ +int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune) +{ + int error; + struct as10x_cmd_t *preq, *prsp; + + ENTER(); + + preq = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(preq,(++phandle->cmd_xid),sizeof(preq->body.set_tune.req)); + + /* fill command */ + preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE); + preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq); + preq->body.set_tune.req.args.bandwidth = ptune->bandwidth; + preq->body.set_tune.req.args.hier_select = ptune->hier_select; + preq->body.set_tune.req.args.constellation = ptune->constellation; + preq->body.set_tune.req.args.hierarchy = ptune->hierarchy; + preq->body.set_tune.req.args.interleaving_mode = ptune->interleaving_mode; + preq->body.set_tune.req.args.code_rate = ptune->code_rate; + preq->body.set_tune.req.args.guard_interval = ptune->guard_interval; + preq->body.set_tune.req.args.transmission_mode = ptune->transmission_mode; + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) preq, + sizeof(preq->body.set_tune.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.set_tune.rsp) + HEADER_SIZE); + } else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief send get tune status command to AS10x + \param phandle: pointer to AS10x handle + \param pstatus: pointer to updated status structure of the current tune + \return 0 when no error, < 0 in case of error. + \callgraph + */ +int as10x_cmd_get_tune_status(as10x_handle_t *phandle, struct as10x_tune_status *pstatus) +{ + int error; + struct as10x_cmd_t *preq, *prsp; + + ENTER(); + + preq = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(preq,(++phandle->cmd_xid), + sizeof(preq->body.get_tune_status.req)); + + /* fill command */ + preq->body.get_tune_status.req.proc_id = + cpu_to_le16(CONTROL_PROC_GETTUNESTAT); + + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( + phandle, + (uint8_t *) preq, + sizeof(preq->body.get_tune_status.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if (error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP); + if (error < 0) { + goto out; + } + + /* Response OK -> get response data */ + pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state; + pstatus->signal_strength = + le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength); + pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER); + pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER); + +out: + LEAVE(); + return(error); +} + +/** + \brief send get TPS command to AS10x + \param phandle: pointer to AS10x handle + \param ptps: pointer to TPS parameters structure + \return 0 when no error, < 0 in case of error. + \callgraph + */ +int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps) +{ + + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid),sizeof(pcmd->body.get_tps.req)); + + /* fill command */ + pcmd->body.get_tune_status.req.proc_id = cpu_to_le16(CONTROL_PROC_GETTPS); + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, sizeof(pcmd->body.get_tps.req) + HEADER_SIZE, + (uint8_t *) prsp, sizeof(prsp->body.get_tps.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP); + if (error < 0) { + goto out; + } + + /* Response OK -> get response data */ + ptps->constellation = prsp->body.get_tps.rsp.tps.constellation; + ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy; + ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode; + ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP; + ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP; + ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval; + ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode; + ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP; + ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP; + ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID); + +out: + LEAVE(); + return(error); +} + +/** + \brief send get demod stats command to AS10x + \param phandle: pointer to AS10x handle + \param pdemod_stats: pointer to demod stats parameters structure + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, + struct as10x_demod_stats *pdemod_stats) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_demod_stats.req)); + + /* fill command */ + pcmd->body.get_demod_stats.req.proc_id = + cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_demod_stats.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_demod_stats.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_DEMOD_STATS_RSP); + if (error < 0) { + goto out; + } + + /* Response OK -> get response data */ + pdemod_stats->frame_count = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count); + pdemod_stats->bad_frame_count = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count); + pdemod_stats->bytes_fixed_by_rs = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs); + pdemod_stats->mer = + le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer); + pdemod_stats->has_started = + prsp->body.get_demod_stats.rsp.stats.has_started; + +out: + LEAVE(); + return(error); +} + +/** + \brief send get impulse response command to AS10x + \param phandle: pointer to AS10x handle + \param is_ready: pointer to value indicating when impulse + response data is ready + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, + uint8_t *is_ready) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_impulse_rsp.req)); + + /* fill command */ + pcmd->body.get_impulse_rsp.req.proc_id = + cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_impulse_rsp.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_impulse_rsp.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_IMPULSE_RESP_RSP); + if (error < 0) { + goto out; + } + + /* Response OK -> get response data */ + *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready; + +out: + LEAVE(); + return(error); +} + + + +/** + \brief build AS10x command header + \param pcmd: pointer to AS10x command buffer + \param xid: sequence id of the command + \param cmd_len: lenght of the command + \return - + \callgraph +*/ +void as10x_cmd_build(struct as10x_cmd_t *pcmd, + uint16_t xid, uint16_t cmd_len) +{ + pcmd->header.req_id = cpu_to_le16(xid); + pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID); + pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION); + pcmd->header.data_len = cpu_to_le16(cmd_len); +} + +/** + \brief Parse command response + \param pcmd: pointer to AS10x command buffer + \param cmd_seqid: sequence id of the command + \param cmd_len: lenght of the command + \return 0 when no error, < 0 in case of error + \callgraph +*/ +int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) +{ + int error; + + /* extract command error code */ + error = prsp->body.common.rsp.error; + + if((error == 0) && (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) { + return 0; + } + + return AS10X_CMD_ERROR; +} + + diff --git linux/drivers/staging/media/as102/as10x_cmd.h linuxb/drivers/media/dvb/as102/as10x_cmd.h new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as10x_cmd.h @@ -0,0 +1,540 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifndef _AS10X_CMD_H_ +#define _AS10X_CMD_H_ + +#ifdef __KERNEL__ +#include <linux/kernel.h> +#endif + +#include "as10x_types.h" + +/*********************************/ +/* MACRO DEFINITIONS */ +/*********************************/ +#define AS10X_CMD_ERROR -1 + +#define SERVICE_PROG_ID 0x0002 +#define SERVICE_PROG_VERSION 0x0001 + +#define HIER_NONE 0x00 +#define HIER_LOW_PRIORITY 0x01 + +#define HEADER_SIZE (sizeof(struct as10x_cmd_header_t)) + +/* context request types */ +#define GET_CONTEXT_DATA 1 +#define SET_CONTEXT_DATA 2 + +/* ODSP suspend modes */ +#define CFG_MODE_ODSP_RESUME 0 +#define CFG_MODE_ODSP_SUSPEND 1 + +/* Dump memory size */ +#define DUMP_BLOCK_SIZE_MAX 0x20 + +/*********************************/ +/* TYPE DEFINITION */ +/*********************************/ +typedef enum { + CONTROL_PROC_TURNON = 0x0001, + CONTROL_PROC_TURNON_RSP = 0x0100, + CONTROL_PROC_SET_REGISTER = 0x0002, + CONTROL_PROC_SET_REGISTER_RSP = 0x0200, + CONTROL_PROC_GET_REGISTER = 0x0003, + CONTROL_PROC_GET_REGISTER_RSP = 0x0300, + CONTROL_PROC_SETTUNE = 0x000A, + CONTROL_PROC_SETTUNE_RSP = 0x0A00, + CONTROL_PROC_GETTUNESTAT = 0x000B, + CONTROL_PROC_GETTUNESTAT_RSP = 0x0B00, + CONTROL_PROC_GETTPS = 0x000D, + CONTROL_PROC_GETTPS_RSP = 0x0D00, + CONTROL_PROC_SETFILTER = 0x000E, + CONTROL_PROC_SETFILTER_RSP = 0x0E00, + CONTROL_PROC_REMOVEFILTER = 0x000F, + CONTROL_PROC_REMOVEFILTER_RSP = 0x0F00, + CONTROL_PROC_GET_IMPULSE_RESP = 0x0012, + CONTROL_PROC_GET_IMPULSE_RESP_RSP = 0x1200, + CONTROL_PROC_START_STREAMING = 0x0013, + CONTROL_PROC_START_STREAMING_RSP = 0x1300, + CONTROL_PROC_STOP_STREAMING = 0x0014, + CONTROL_PROC_STOP_STREAMING_RSP = 0x1400, + CONTROL_PROC_GET_DEMOD_STATS = 0x0015, + CONTROL_PROC_GET_DEMOD_STATS_RSP = 0x1500, + CONTROL_PROC_ELNA_CHANGE_MODE = 0x0016, + CONTROL_PROC_ELNA_CHANGE_MODE_RSP = 0x1600, + CONTROL_PROC_ODSP_CHANGE_MODE = 0x0017, + CONTROL_PROC_ODSP_CHANGE_MODE_RSP = 0x1700, + CONTROL_PROC_AGC_CHANGE_MODE = 0x0018, + CONTROL_PROC_AGC_CHANGE_MODE_RSP = 0x1800, + + CONTROL_PROC_CONTEXT = 0x00FC, + CONTROL_PROC_CONTEXT_RSP = 0xFC00, + CONTROL_PROC_DUMP_MEMORY = 0x00FD, + CONTROL_PROC_DUMP_MEMORY_RSP = 0xFD00, + CONTROL_PROC_DUMPLOG_MEMORY = 0x00FE, + CONTROL_PROC_DUMPLOG_MEMORY_RSP = 0xFE00, + CONTROL_PROC_TURNOFF = 0x00FF, + CONTROL_PROC_TURNOFF_RSP = 0xFF00 +} control_proc; + + +#pragma pack(1) +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} TURN_ON; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t err; + } rsp; +} TURN_OFF; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* tune params */ + struct as10x_tune_args args; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + } rsp; +} SET_TUNE; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + /* tune status */ + struct as10x_tune_status sts; + } rsp; +} GET_TUNE_STATUS; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + /* tps details */ + struct as10x_tps tps; + } rsp; +} GET_TPS; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + } rsp; +} COMMON; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* PID to filter */ + uint16_t pid; + /* stream type (MPE, PSI/SI or PES )*/ + uint8_t stream_type; + /* PID index in filter table */ + uint8_t idx; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + /* Filter id */ + uint8_t filter_id; + } rsp; +} ADD_PID_FILTER; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* PID to remove */ + uint16_t pid; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* response error */ + uint8_t error; + } rsp; +} DEL_PID_FILTER; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} START_STREAMING; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} STOP_STREAMING; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* demod stats */ + struct as10x_demod_stats stats; + } rsp; +} GET_DEMOD_STATS; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* impulse response ready */ + uint8_t is_ready; + } rsp; +} GET_IMPULSE_RESP; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* value to write (for set context)*/ + struct as10x_register_value reg_val; + /* context tag */ + uint16_t tag; + /* context request type */ + uint16_t type; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* value read (for get context) */ + struct as10x_register_value reg_val; + /* context request type */ + uint16_t type; + /* error */ + uint8_t error; + } rsp; +} FW_CONTEXT; + +typedef union { + /* request */ + struct { + /* response identifier */ + uint16_t proc_id; + /* register description */ + struct as10x_register_addr reg_addr; + /* register content */ + struct as10x_register_value reg_val; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} SET_REGISTER; + +typedef union { + /* request */ + struct { + /* response identifier */ + uint16_t proc_id; + /* register description */ + struct as10x_register_addr reg_addr; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* register content */ + struct as10x_register_value reg_val; + } rsp; +} GET_REGISTER; + +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* mode */ + uint8_t mode; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + } rsp; +} CFG_CHANGE_MODE; + +struct as10x_cmd_header_t { + uint16_t req_id; + uint16_t prog; + uint16_t version; + uint16_t data_len; +}; + +#define DUMP_BLOCK_SIZE 16 +typedef union { + /* request */ + struct { + /* request identifier */ + uint16_t proc_id; + /* dump memory type request */ + uint8_t dump_req; + /* register description */ + struct as10x_register_addr reg_addr; + /* nb blocks to read */ + uint16_t num_blocks; + } req; + /* response */ + struct { + /* response identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* dump response */ + uint8_t dump_rsp; + /* data */ + union { + uint8_t data8[DUMP_BLOCK_SIZE]; + uint16_t data16[DUMP_BLOCK_SIZE / sizeof(uint16_t)]; + uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)]; + } u; + } rsp; +} DUMP_MEMORY; + +typedef union { + struct { + /* request identifier */ + uint16_t proc_id; + /* dump memory type request */ + uint8_t dump_req; + } req; + struct { + /* request identifier */ + uint16_t proc_id; + /* error */ + uint8_t error; + /* dump response */ + uint8_t dump_rsp; + /* dump data */ + uint8_t data[DUMP_BLOCK_SIZE]; + } rsp; +} DUMPLOG_MEMORY; + +typedef union { + /* request */ + struct { + uint16_t proc_id; + uint8_t data[64 - sizeof(struct as10x_cmd_header_t) -2 /* proc_id */]; + } req; + /* response */ + struct { + uint16_t proc_id; + uint8_t error; + uint8_t data[64 - sizeof(struct as10x_cmd_header_t) /* header */ + - 2 /* proc_id */ - 1 /* rc */]; + } rsp; +} RAW_DATA; + +struct as10x_cmd_t { + /* header */ + struct as10x_cmd_header_t header; + /* body */ + union { + TURN_ON turn_on; + TURN_OFF turn_off; + SET_TUNE set_tune; + GET_TUNE_STATUS get_tune_status; + GET_TPS get_tps; + COMMON common; + ADD_PID_FILTER add_pid_filter; + DEL_PID_FILTER del_pid_filter; + START_STREAMING start_streaming; + STOP_STREAMING stop_streaming; + GET_DEMOD_STATS get_demod_stats; + GET_IMPULSE_RESP get_impulse_rsp; + FW_CONTEXT context; + SET_REGISTER set_register; + GET_REGISTER get_register; + CFG_CHANGE_MODE cfg_change_mode; + DUMP_MEMORY dump_memory; + DUMPLOG_MEMORY dumplog_memory; + RAW_DATA raw_data; + } body; +}; + +struct as10x_token_cmd_t { + /* token cmd */ + struct as10x_cmd_t c; + /* token response */ + struct as10x_cmd_t r; +}; +#pragma pack() + + +/**************************/ +/* FUNCTION DECLARATION */ +/**************************/ + +void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id, + uint16_t cmd_len); +int as10x_rsp_parse(struct as10x_cmd_t *r, uint16_t proc_id); + +#ifdef __cplusplus +extern "C" { +#endif + +/* as10x cmd */ +int as10x_cmd_turn_on(as10x_handle_t *phandle); +int as10x_cmd_turn_off(as10x_handle_t *phandle); + +int as10x_cmd_set_tune(as10x_handle_t *phandle, + struct as10x_tune_args *ptune); + +int as10x_cmd_get_tune_status(as10x_handle_t *phandle, + struct as10x_tune_status *pstatus); + +int as10x_cmd_get_tps(as10x_handle_t *phandle, + struct as10x_tps *ptps); + +int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, + struct as10x_demod_stats *pdemod_stats); + +int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, + uint8_t *is_ready); + +/* as10x cmd stream */ +int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, + struct as10x_ts_filter *filter); +int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, + uint16_t pid_value); + +int as10x_cmd_start_streaming(as10x_handle_t *phandle); +int as10x_cmd_stop_streaming(as10x_handle_t *phandle); + +/* as10x cmd cfg */ +int as10x_cmd_set_context(as10x_handle_t *phandle, + uint16_t tag, + uint32_t value); +int as10x_cmd_get_context(as10x_handle_t *phandle, + uint16_t tag, + uint32_t *pvalue); + +int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode); +int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id); +#ifdef __cplusplus +} +#endif +#endif +/* EOF - vim: set textwidth=80 ts=3 sw=3 sts=3 et: */ diff --git linux/drivers/staging/media/as102/as10x_cmd_cfg.c linuxb/drivers/media/dvb/as102/as10x_cmd_cfg.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c @@ -0,0 +1,239 @@ +/** + + \file as10x_cmd_cfg.c + + \version $Id$ + + \author: S. Martinelli + + ----------------------------------------------------------------------------\n + (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n + www.abilis.com \n + ----------------------------------------------------------------------------\n + + \brief AS10x API, configuration services + + AS10x cmd management: build command buffer, send command through + selected port and wait for the response when required. + +*/ + +#if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */ +#include <linux/kernel.h> +#include "as102_drv.h" +#elif defined(WIN32) + #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) /* win32 ddk implementation */ + #include "wdm.h" + #include "Device.h" + #include "endian_mgmt.h" /* FIXME */ + #else /* win32 sdk implementation */ + #include <windows.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" + #endif +#else /* all other cases */ + #include <string.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" /* FIXME */ +#endif /* __KERNEL__ */ + +#include "as10x_types.h" +#include "as10x_cmd.h" + +/***************************/ +/* FUNCTION DEFINITION */ +/***************************/ + +/** + \brief send get context command to AS10x + \param phandle: pointer to AS10x handle + \param tag: context tag + \param pvalue: pointer where to store context value read + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag, + uint32_t *pvalue) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.context.req)); + + /* fill command */ + pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); + pcmd->body.context.req.tag = cpu_to_le16(tag); + pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA); + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.context.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.context.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response: context command do not follow the common response */ + /* structure -> specific handling response parse required */ + error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); + + if(error == 0) { + /* Response OK -> get response data */ + *pvalue = le32_to_cpu(prsp->body.context.rsp.reg_val.u.value32); + /* value returned is always a 32-bit value */ + } + +out: + LEAVE(); + return(error); +} + +/** + \brief send set context command to AS10x + \param phandle: pointer to AS10x handle + \param tag: context tag + \param value: value to set in context + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag, + uint32_t value) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.context.req)); + + /* fill command */ + pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); + /* pcmd->body.context.req.reg_val.mode initialization is not required */ + pcmd->body.context.req.reg_val.u.value32 = cpu_to_le32(value); + pcmd->body.context.req.tag = cpu_to_le16(tag); + pcmd->body.context.req.type = cpu_to_le16(SET_CONTEXT_DATA); + + /* send command */ + if(phandle->ops->xfer_cmd){ + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.context.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.context.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response: context command do not follow the common response */ + /* structure -> specific handling response parse required */ + error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief send eLNA change mode command to AS10x + \param phandle: pointer to AS10x handle + \param tag: context tag + \param mode: mode selected: + - ON : 0x0 => eLNA always ON + - OFF : 0x1 => eLNA always OFF + - AUTO : 0x2 => eLNA follow hysteresis parameters to be + ON or OFF + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.cfg_change_mode.req)); + + /* fill command */ + pcmd->body.cfg_change_mode.req.proc_id = + cpu_to_le16(CONTROL_PROC_ELNA_CHANGE_MODE); + pcmd->body.cfg_change_mode.req.mode = mode; + + /* send command */ + if(phandle->ops->xfer_cmd){ + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.cfg_change_mode.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.cfg_change_mode.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_ELNA_CHANGE_MODE_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief Parse context command response. Since this command does not follow + the common response, a specific parse function is required. + \param prsp: pointer to AS10x command response buffer + \param proc_id: id of the command + \return 0 when no error, < 0 in case of error. + ABILIS_RC_NOK + \callgraph +*/ +int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) { + + int err; + + err = prsp->body.context.rsp.error; + + if((err == 0) && + (le16_to_cpu(prsp->body.context.rsp.proc_id) == proc_id)) { + return 0; + } + return AS10X_CMD_ERROR; +} diff --git linux/drivers/staging/media/as102/as10x_cmd_stream.c linuxb/drivers/media/dvb/as102/as10x_cmd_stream.c new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as10x_cmd_stream.c @@ -0,0 +1,256 @@ +/** + + \file as10x_cmd_stream.c + + \version $Id$ + + \author: S. Martinelli + + ----------------------------------------------------------------------------\n + (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n + www.abilis.com \n + ----------------------------------------------------------------------------\n + + \brief AS10x CMD, stream services + + AS10x CMD management: build command buffer, send command through + selected port and wait for the response when required. + +*/ + + +#if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */ +#include <linux/kernel.h> +#include "as102_drv.h" +#elif defined(WIN32) + #if defined(DDK) /* win32 ddk implementation */ + #include "wdm.h" + #include "Device.h" + #include "endian_mgmt.h" /* FIXME */ + #else /* win32 sdk implementation */ + #include <windows.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" + #endif +#else /* all other cases */ + #include <string.h> + #include "types.h" + #include "util.h" + #include "as10x_handle.h" + #include "endian_mgmt.h" /* FIXME */ +#endif /* __KERNEL__ */ + +#include "as10x_cmd.h" + + +/** + \brief send add filter command to AS10x + \param phandle: pointer to AS10x handle + \param filter: TSFilter filter for DVB-T + \param pfilter_handle: pointer where to store filter handle + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_add_PID_filter(as10x_handle_t* phandle, + struct as10x_ts_filter *filter) { + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.add_pid_filter.req)); + + /* fill command */ + pcmd->body.add_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_SETFILTER); + pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid); + pcmd->body.add_pid_filter.req.stream_type = filter->type; + + if(filter->idx < 16) + pcmd->body.add_pid_filter.req.idx = filter->idx; + else + pcmd->body.add_pid_filter.req.idx = 0xFF; + + /* send command */ + if(phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.add_pid_filter.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.add_pid_filter.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP); + + if(error == 0) { + /* Response OK -> get response data */ + filter->idx = prsp->body.add_pid_filter.rsp.filter_id; + } + +out: + LEAVE(); + return(error); +} + +/** + \brief Send delete filter command to AS10x + \param phandle: pointer to AS10x handle + \param filter_handle: filter handle + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_del_PID_filter(as10x_handle_t* phandle, + uint16_t pid_value) +{ + + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.del_pid_filter.req)); + + /* fill command */ + pcmd->body.del_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_REMOVEFILTER); + pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value); + + /* send command */ + if(phandle->ops->xfer_cmd){ + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.del_pid_filter.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.del_pid_filter.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_REMOVEFILTER_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief Send start streaming command to AS10x + \param phandle: pointer to AS10x handle + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_start_streaming(as10x_handle_t* phandle) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.start_streaming.req)); + + /* fill command */ + pcmd->body.start_streaming.req.proc_id = + cpu_to_le16(CONTROL_PROC_START_STREAMING); + + /* send command */ + if(phandle->ops->xfer_cmd){ + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.start_streaming.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.start_streaming.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_START_STREAMING_RSP); + +out: + LEAVE(); + return(error); +} + +/** + \brief Send stop streaming command to AS10x + \param phandle: pointer to AS10x handle + \return 0 when no error, < 0 in case of error. + \callgraph +*/ +int as10x_cmd_stop_streaming(as10x_handle_t* phandle) +{ + int8_t error; + struct as10x_cmd_t *pcmd, *prsp; + + ENTER(); + + pcmd = phandle->cmd; + prsp = phandle->rsp; + + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.stop_streaming.req)); + + /* fill command */ + pcmd->body.stop_streaming.req.proc_id = + cpu_to_le16(CONTROL_PROC_STOP_STREAMING); + + /* send command */ + if(phandle->ops->xfer_cmd){ + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.stop_streaming.req) + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.stop_streaming.rsp) + HEADER_SIZE); + } + else{ + error = AS10X_CMD_ERROR; + } + + if(error < 0) { + goto out; + } + + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_STOP_STREAMING_RSP); + +out: + LEAVE(); + return(error); +} + + diff --git linux/drivers/staging/media/as102/as10x_handle.h linuxb/drivers/media/dvb/as102/as10x_handle.h new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as10x_handle.h @@ -0,0 +1,58 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifdef __KERNEL__ +struct as102_bus_adapter_t; +struct as102_dev_t; + +#define as10x_handle_t struct as102_bus_adapter_t +#include "as10x_cmd.h" + +/* values for "mode" field */ +#define REGMODE8 8 +#define REGMODE16 16 +#define REGMODE32 32 + +struct as102_priv_ops_t { + int (*upload_fw_pkt) (struct as102_bus_adapter_t *bus_adap, + unsigned char *buf, int buflen, int swap32); + + int (*send_cmd) (struct as102_bus_adapter_t *bus_adap, + unsigned char *buf, int buflen); + + int (*xfer_cmd) (struct as102_bus_adapter_t *bus_adap, + unsigned char *send_buf, int send_buf_len, + unsigned char *recv_buf, int recv_buf_len); +/* + int (*pid_filter) (struct as102_bus_adapter_t *bus_adap, + int index, u16 pid, int onoff); +*/ + int (*start_stream) (struct as102_dev_t *dev); + void (*stop_stream) (struct as102_dev_t *dev); + + int (*reset_target) (struct as102_bus_adapter_t *bus_adap); + + int (*read_write)(struct as102_bus_adapter_t *bus_adap, uint8_t mode, + uint32_t rd_addr, uint16_t rd_len, + uint32_t wr_addr, uint16_t wr_len); + + int (*as102_read_ep2) (struct as102_bus_adapter_t *bus_adap, + unsigned char *recv_buf, + int recv_buf_len); +}; +#endif diff --git linux/drivers/staging/media/as102/as10x_types.h linuxb/drivers/media/dvb/as102/as10x_types.h new file mode 100644 --- /dev/null +++ linuxb/drivers/staging/media/as102/as10x_types.h @@ -0,0 +1,198 @@ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifndef _AS10X_TYPES_H_ +#define _AS10X_TYPES_H_ + +#include "as10x_handle.h" + +/*********************************/ +/* MACRO DEFINITIONS */ +/*********************************/ + +/* bandwidth constant values */ +#define BW_5_MHZ 0x00 +#define BW_6_MHZ 0x01 +#define BW_7_MHZ 0x02 +#define BW_8_MHZ 0x03 + +/* hierarchy priority selection values */ +#define HIER_NO_PRIORITY 0x00 +#define HIER_LOW_PRIORITY 0x01 +#define HIER_HIGH_PRIORITY 0x02 + +/* constellation available values */ +#define CONST_QPSK 0x00 +#define CONST_QAM16 0x01 +#define CONST_QAM64 0x02 +#define CONST_UNKNOWN 0xFF + +/* hierarchy available values */ +#define HIER_NONE 0x00 +#define HIER_ALPHA_1 0x01 +#define HIER_ALPHA_2 0x02 +#define HIER_ALPHA_4 0x03 +#define HIER_UNKNOWN 0xFF + +/* interleaving available values */ +#define INTLV_NATIVE 0x00 +#define INTLV_IN_DEPTH 0x01 +#define INTLV_UNKNOWN 0xFF + +/* code rate available values */ +#define CODE_RATE_1_2 0x00 +#define CODE_RATE_2_3 0x01 +#define CODE_RATE_3_4 0x02 +#define CODE_RATE_5_6 0x03 +#define CODE_RATE_7_8 0x04 +#define CODE_RATE_UNKNOWN 0xFF + +/* guard interval available values */ +#define GUARD_INT_1_32 0x00 +#define GUARD_INT_1_16 0x01 +#define GUARD_INT_1_8 0x02 +#define GUARD_INT_1_4 0x03 +#define GUARD_UNKNOWN 0xFF + +/* transmission mode available values */ +#define TRANS_MODE_2K 0x00 +#define TRANS_MODE_8K 0x01 +#define TRANS_MODE_4K 0x02 +#define TRANS_MODE_UNKNOWN 0xFF + +/* DVBH signalling available values */ +#define TIMESLICING_PRESENT 0x01 +#define MPE_FEC_PRESENT 0x02 + +/* tune state available */ +#define TUNE_STATUS_NOT_TUNED 0x00 +#define TUNE_STATUS_IDLE 0x01 +#define TUNE_STATUS_LOCKING 0x02 +#define TUNE_STATUS_SIGNAL_DVB_OK 0x03 +#define TUNE_STATUS_STREAM_DETECTED 0x04 +#define TUNE_STATUS_STREAM_TUNED 0x05 +#define TUNE_STATUS_ERROR 0xFF + +/* available TS FID filter types */ +#define TS_PID_TYPE_TS 0 +#define TS_PID_TYPE_PSI_SI 1 +#define TS_PID_TYPE_MPE 2 + +/* number of echos available */ +#define MAX_ECHOS 15 + +/* Context types */ +#define CONTEXT_LNA 1010 +#define CONTEXT_ELNA_HYSTERESIS 4003 +#define CONTEXT_ELNA_GAIN 4004 +#define CONTEXT_MER_THRESHOLD 5005 +#define CONTEXT_MER_OFFSET 5006 +#define CONTEXT_IR_STATE 7000 +#define CONTEXT_TSOUT_MSB_FIRST 7004 +#define CONTEXT_TSOUT_FALLING_EDGE 7005 + +/* Configuration modes */ +#define CFG_MODE_ON 0 +#define CFG_MODE_OFF 1 +#define CFG_MODE_AUTO 2 + +#pragma pack(1) +struct as10x_tps { + uint8_t constellation; + uint8_t hierarchy; + uint8_t interleaving_mode; + uint8_t code_rate_HP; + uint8_t code_rate_LP; + uint8_t guard_interval; + uint8_t transmission_mode; + uint8_t DVBH_mask_HP; + uint8_t DVBH_mask_LP; + uint16_t cell_ID; +}; + +struct as10x_tune_args { + /* frequency */ + uint32_t freq; + /* bandwidth */ + uint8_t bandwidth; + /* hierarchy selection */ + uint8_t hier_select; + /* constellation */ + uint8_t constellation; + /* hierarchy */ + uint8_t hierarchy; + /* interleaving mode */ + uint8_t interleaving_mode; + /* code rate */ + uint8_t code_rate; + /* guard interval */ + uint8_t guard_interval; + /* transmission mode */ + uint8_t transmission_mode; +}; + +struct as10x_tune_status { + /* tune status */ + uint8_t tune_state; + /* signal strength */ + int16_t signal_strength; + /* packet error rate 10^-4 */ + uint16_t PER; + /* bit error rate 10^-4 */ + uint16_t BER; +}; + +struct as10x_demod_stats { + /* frame counter */ + uint32_t frame_count; + /* Bad frame counter */ + uint32_t bad_frame_count; + /* Number of wrong bytes fixed by Reed-Solomon */ + uint32_t bytes_fixed_by_rs; + /* Averaged MER */ + uint16_t mer; + /* statistics calculation state indicator (started or not) */ + uint8_t has_started; +}; + +struct as10x_ts_filter { + uint16_t pid; /** valid PID value 0x00 : 0x2000 */ + uint8_t type; /** Red TS_PID_TYPE_<N> values */ + uint8_t idx; /** index in filtering table */ +}; + +struct as10x_register_value { + uint8_t mode; + union { + uint8_t value8; /* 8 bit value */ + uint16_t value16; /* 16 bit value */ + uint32_t value32; /* 32 bit value */ + }u; +}; + +#pragma pack() + +struct as10x_register_addr { + /* register addr */ + uint32_t addr; + /* register mode access */ + uint8_t mode; +}; + + +#endif ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 1/14] staging/media/as102: initial import from Abilis 2011-10-18 19:46 ` [RESEND PATCH " Piotr Chmura @ 2011-10-30 21:03 ` Piotr Chmura 2011-10-30 21:25 ` Stefan Richter 2011-10-31 10:24 ` Sylwester Nawrocki 0 siblings, 2 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-30 21:03 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel, Sylwester Nawrocki W dniu 18.10.2011 21:46, Piotr Chmura pisze: > Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ > > Changes made by me: > 1. Driver moved from media/dvb to staging/media > 2. Removed Makefile/Kconfig - it doesn't compile in current tree (...) > + > +/* > + * Note: > + * - in AS102 SNR=MER > + * - the SNR will be returned in linear terms, i.e. not in dB > + * - the accuracy equals ±2dB for a SNR range from 4dB to 30dB > + * - the accuracy is>2dB for SNR values outside this range > + */ I found another issue here. In this comment "±" is from upper ASCII (0xF1). Should I change it into sth. like "+/-" in this patch (1/14) or leave it and just resend without "Â" (wasn't there in original patch, don't know where it came from) ? Peter P.S. Thanks to Sylwester Nawrocki for pointing me out, that there is something wrong with patch 6/14, which was caused by this comment in 1/14. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 1/14] staging/media/as102: initial import from Abilis 2011-10-30 21:03 ` Piotr Chmura @ 2011-10-30 21:25 ` Stefan Richter 2011-10-31 10:24 ` Sylwester Nawrocki 1 sibling, 0 replies; 91+ messages in thread From: Stefan Richter @ 2011-10-30 21:25 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, Devin Heitmueller, Greg KH, Patrick Dickey, LMML, devel, Sylwester Nawrocki On Oct 30 Piotr Chmura wrote: > > + * Note: > > + * - in AS102 SNR=MER > > + * - the SNR will be returned in linear terms, i.e. not in dB > > + * - the accuracy equals ±2dB for a SNR range from 4dB to 30dB > > + * - the accuracy is>2dB for SNR values outside this range > > + */ > > I found another issue here. > In this comment "±" is from upper ASCII (0xF1). Should I change it into > sth. like "+/-" in this patch (1/14) or leave it and just resend without > "Â" (wasn't there in original patch, don't know where it came from) ? Special characters can be used in comments, provided that they are UTF-8 encoded. In case of names of persons or companies, it is very much desirable to preserve special characters. In case like this one on the other hand, sticking with ASCII (the 7 bit character table) might not be such a bad idea to keep things simple. But since you are passing on a patch from somebody else, the right thing to do is IMO to keep the special characters that the author chose and only make sure that the file (and the patch mailing) are UTF-8 encoded. -- Stefan Richter -=====-==-== =-=- ====- http://arcgraph.de/sr/ ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 1/14] staging/media/as102: initial import from Abilis 2011-10-30 21:03 ` Piotr Chmura 2011-10-30 21:25 ` Stefan Richter @ 2011-10-31 10:24 ` Sylwester Nawrocki 1 sibling, 0 replies; 91+ messages in thread From: Sylwester Nawrocki @ 2011-10-31 10:24 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel On 10/30/2011 10:03 PM, Piotr Chmura wrote: > W dniu 18.10.2011 21:46, Piotr Chmura pisze: >> Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ >> >> Changes made by me: >> 1. Driver moved from media/dvb to staging/media >> 2. Removed Makefile/Kconfig - it doesn't compile in current tree > (...) >> + >> +/* >> + * Note: >> + * - in AS102 SNR=MER >> + * - the SNR will be returned in linear terms, i.e. not in dB >> + * - the accuracy equals ±2dB for a SNR range from 4dB to 30dB >> + * - the accuracy is>2dB for SNR values outside this range >> + */ > > I found another issue here. > In this comment "±" is from upper ASCII (0xF1). Should I change it into sth. > like "+/-" in this patch (1/14) or leave it and just resend without "Â" > (wasn't there in original patch, don't know where it came from) ? I collected all your patches (1..14/14, as we agreed in private), did a bit of cleanup myself, re-edited the changelogs and I'm going to post the series which is hopefully ready for initial pull into staging/media. I've also removed that odd  character right from the first patch. > > Peter > > P.S. Thanks to Sylwester Nawrocki for pointing me out, that there is something > wrong with patch 6/14, which was caused by this comment in 1/14. --- Regards, Sylwester ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 2/14] staging/media/as102: checkpatch fixes [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> 2011-10-18 9:11 ` [PATCH 1/14] staging/media/as102: initial import from Abilis Piotr Chmura @ 2011-10-18 9:11 ` Piotr Chmura 2011-10-18 19:48 ` [RESEND PATCH " Piotr Chmura 2011-10-18 9:11 ` [PATCH 3/14] " Piotr Chmura ` (11 subsequent siblings) 13 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:11 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318502 18000 # Node ID e2ba344c99936bddc46722f1f1efec5600c58659 # Parent a78bda1e1a0badc4a1296be958f1f8a49014ae18 as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as102_drv.c Priority: normal Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> diff --git linux/drivers/staging/media/as102/as102_drv.c linuxb/drivers/media/dvb/as102/as102_drv.c --- linux/drivers/staging/media/as102/as102_drv.c +++ linuxb/drivers/staging/media/as102/as102_drv.c @@ -1,6 +1,7 @@ /* * Abilis Systems Single DVB-T Receiver * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,23 +37,23 @@ #warning >>> DVB_CORE not defined !!! <<< #endif -int debug = 0; +int debug; module_param_named(debug, debug, int, 0644); MODULE_PARM_DESC(debug, "Turn on/off debugging (default: off)"); -int dual_tuner = 0; +int dual_tuner; module_param_named(dual_tuner, dual_tuner, int, 0644); -MODULE_PARM_DESC(dual_tuner, "Activate Dual-Tuner configuration (default: off)"); +MODULE_PARM_DESC(dual_tuner, "Activate Dual-Tuner config (default: off)"); static int fw_upload = 1; module_param_named(fw_upload, fw_upload, int, 0644); MODULE_PARM_DESC(fw_upload, "Turn on/off default FW upload (default: on)"); -static int pid_filtering = 0; +static int pid_filtering; module_param_named(pid_filtering, pid_filtering, int, 0644); MODULE_PARM_DESC(pid_filtering, "Activate HW PID filtering (default: off)"); -static int ts_auto_disable = 0; +static int ts_auto_disable; module_param_named(ts_auto_disable, ts_auto_disable, int, 0644); MODULE_PARM_DESC(ts_auto_disable, "Stream Auto Enable on FW (default: off)"); @@ -65,7 +66,8 @@ #endif #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) -static void as102_stop_stream(struct as102_dev_t *dev) { +static void as102_stop_stream(struct as102_dev_t *dev) +{ struct as102_bus_adapter_t *bus_adap; if (dev != NULL) @@ -80,16 +82,15 @@ if (mutex_lock_interruptible(&dev->bus_adap.lock)) return; - if (as10x_cmd_stop_streaming(bus_adap) < 0) { + if (as10x_cmd_stop_streaming(bus_adap) < 0) dprintk(debug, "as10x_cmd_stop_streaming failed\n"); - } mutex_unlock(&dev->bus_adap.lock); } } -static int as102_start_stream(struct as102_dev_t *dev) { - +static int as102_start_stream(struct as102_dev_t *dev) +{ struct as102_bus_adapter_t *bus_adap; int ret = -EFAULT; @@ -98,9 +99,8 @@ else return ret; - if (bus_adap->ops->start_stream != NULL) { + if (bus_adap->ops->start_stream != NULL) ret = bus_adap->ops->start_stream(dev); - } if (ts_auto_disable) { if (mutex_lock_interruptible(&dev->bus_adap.lock)) @@ -127,25 +127,25 @@ return -EBUSY; } - switch(onoff) { - case 0: - ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) pid); - dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = %d\n", - index, pid, ret); - break; - case 1: - { - struct as10x_ts_filter filter; + switch (onoff) { + case 0: + ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) pid); + dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = %d\n", + index, pid, ret); + break; + case 1: + { + struct as10x_ts_filter filter; - filter.type = TS_PID_TYPE_TS; - filter.idx = 0xFF; - filter.pid = pid; + filter.type = TS_PID_TYPE_TS; + filter.idx = 0xFF; + filter.pid = pid; - ret = as10x_cmd_add_PID_filter(bus_adap, &filter); - dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n", - index, filter.idx, filter.pid, ret); - break; - } + ret = as10x_cmd_add_PID_filter(bus_adap, &filter); + dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n", + index, filter.idx, filter.pid, ret); + break; + } } mutex_unlock(&dev->bus_adap.lock); @@ -154,7 +154,8 @@ return ret; } -static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed) { +static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed) +{ int ret = 0; struct dvb_demux *demux = dvbdmxfeed->demux; struct as102_dev_t *as102_dev = demux->priv; @@ -169,16 +170,16 @@ dvbdmxfeed->index, dvbdmxfeed->pid, 1); } - if (as102_dev->streaming++ == 0) { + if (as102_dev->streaming++ == 0) ret = as102_start_stream(as102_dev); - } mutex_unlock(&as102_dev->sem); LEAVE(); return ret; } -static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed) { +static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed) +{ struct dvb_demux *demux = dvbdmxfeed->demux; struct as102_dev_t *as102_dev = demux->priv; @@ -187,9 +188,8 @@ if (mutex_lock_interruptible(&as102_dev->sem)) return -ERESTARTSYS; - if (--as102_dev->streaming == 0) { + if (--as102_dev->streaming == 0) as102_stop_stream(as102_dev); - } if (pid_filtering) { as10x_pid_filter(as102_dev, @@ -202,7 +202,8 @@ } #endif -int as102_dvb_register(struct as102_dev_t *as102_dev) { +int as102_dvb_register(struct as102_dev_t *as102_dev) +{ int ret = 0; ENTER(); @@ -223,7 +224,7 @@ ); if (ret < 0) { err("%s: dvb_register_adapter() failed (errno = %d)", - __FUNCTION__, ret); + __func__, ret); goto failed; } @@ -240,23 +241,23 @@ as102_dev->dvb_dmxdev.demux = &as102_dev->dvb_dmx.dmx; as102_dev->dvb_dmxdev.capabilities = 0; - if ((ret = dvb_dmx_init(&as102_dev->dvb_dmx)) < 0) { - err("%s: dvb_dmx_init() failed (errno = %d)", - __FUNCTION__, ret); + ret = dvb_dmx_init(&as102_dev->dvb_dmx); + if (ret < 0) { + err("%s: dvb_dmx_init() failed (errno = %d)", __func__, ret); goto failed; } ret = dvb_dmxdev_init(&as102_dev->dvb_dmxdev, &as102_dev->dvb_adap); if (ret < 0) { - err("%s: dvb_dmxdev_init() failed (errno = %d)", - __FUNCTION__, ret); + err("%s: dvb_dmxdev_init() failed (errno = %d)", __func__, + ret); goto failed; } ret = as102_dvb_register_fe(as102_dev, &as102_dev->dvb_fe); if (ret < 0) { err("%s: as102_dvb_register_frontend() failed (errno = %d)", - __FUNCTION__, ret); + __func__, ret); goto failed; } #endif @@ -283,7 +284,8 @@ return ret; } -void as102_dvb_unregister(struct as102_dev_t *as102_dev) { +void as102_dvb_unregister(struct as102_dev_t *as102_dev) +{ ENTER(); #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) @@ -300,7 +302,8 @@ LEAVE(); } -static int __init as102_driver_init(void) { +static int __init as102_driver_init(void) +{ int ret = 0; ENTER(); @@ -331,7 +334,8 @@ * \brief as102 driver exit point. This function is called when device has * to be removed. */ -static void __exit as102_driver_exit(void) { +static void __exit as102_driver_exit(void) +{ ENTER(); /* deregister this driver with the low level bus subsystem */ #if defined(CONFIG_AS102_USB) ^ permalink raw reply [flat|nested] 91+ messages in thread
* [RESEND PATCH 2/14] staging/media/as102: checkpatch fixes 2011-10-18 9:11 ` [PATCH 2/14] staging/media/as102: checkpatch fixes Piotr Chmura @ 2011-10-18 19:48 ` Piotr Chmura 0 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 19:48 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318502 18000 # Node ID e2ba344c99936bddc46722f1f1efec5600c58659 # Parent a78bda1e1a0badc4a1296be958f1f8a49014ae18 as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as102_drv.c Priority: normal Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff --git linux/drivers/staging/media/as102/as102_drv.c linuxb/drivers/media/dvb/as102/as102_drv.c --- linux/drivers/staging/media/as102/as102_drv.c +++ linuxb/drivers/staging/media/as102/as102_drv.c @@ -1,6 +1,7 @@ /* * Abilis Systems Single DVB-T Receiver * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,23 +37,23 @@ #warning >>> DVB_CORE not defined !!! <<< #endif -int debug = 0; +int debug; module_param_named(debug, debug, int, 0644); MODULE_PARM_DESC(debug, "Turn on/off debugging (default: off)"); -int dual_tuner = 0; +int dual_tuner; module_param_named(dual_tuner, dual_tuner, int, 0644); -MODULE_PARM_DESC(dual_tuner, "Activate Dual-Tuner configuration (default: off)"); +MODULE_PARM_DESC(dual_tuner, "Activate Dual-Tuner config (default: off)"); static int fw_upload = 1; module_param_named(fw_upload, fw_upload, int, 0644); MODULE_PARM_DESC(fw_upload, "Turn on/off default FW upload (default: on)"); -static int pid_filtering = 0; +static int pid_filtering; module_param_named(pid_filtering, pid_filtering, int, 0644); MODULE_PARM_DESC(pid_filtering, "Activate HW PID filtering (default: off)"); -static int ts_auto_disable = 0; +static int ts_auto_disable; module_param_named(ts_auto_disable, ts_auto_disable, int, 0644); MODULE_PARM_DESC(ts_auto_disable, "Stream Auto Enable on FW (default: off)"); @@ -65,7 +66,8 @@ #endif #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) -static void as102_stop_stream(struct as102_dev_t *dev) { +static void as102_stop_stream(struct as102_dev_t *dev) +{ struct as102_bus_adapter_t *bus_adap; if (dev != NULL) @@ -80,16 +82,15 @@ if (mutex_lock_interruptible(&dev->bus_adap.lock)) return; - if (as10x_cmd_stop_streaming(bus_adap) < 0) { + if (as10x_cmd_stop_streaming(bus_adap) < 0) dprintk(debug, "as10x_cmd_stop_streaming failed\n"); - } mutex_unlock(&dev->bus_adap.lock); } } -static int as102_start_stream(struct as102_dev_t *dev) { - +static int as102_start_stream(struct as102_dev_t *dev) +{ struct as102_bus_adapter_t *bus_adap; int ret = -EFAULT; @@ -98,9 +99,8 @@ else return ret; - if (bus_adap->ops->start_stream != NULL) { + if (bus_adap->ops->start_stream != NULL) ret = bus_adap->ops->start_stream(dev); - } if (ts_auto_disable) { if (mutex_lock_interruptible(&dev->bus_adap.lock)) @@ -127,25 +127,25 @@ return -EBUSY; } - switch(onoff) { - case 0: - ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) pid); - dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = %d\n", - index, pid, ret); - break; - case 1: - { - struct as10x_ts_filter filter; + switch (onoff) { + case 0: + ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) pid); + dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = %d\n", + index, pid, ret); + break; + case 1: + { + struct as10x_ts_filter filter; - filter.type = TS_PID_TYPE_TS; - filter.idx = 0xFF; - filter.pid = pid; + filter.type = TS_PID_TYPE_TS; + filter.idx = 0xFF; + filter.pid = pid; - ret = as10x_cmd_add_PID_filter(bus_adap, &filter); - dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n", - index, filter.idx, filter.pid, ret); - break; - } + ret = as10x_cmd_add_PID_filter(bus_adap, &filter); + dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n", + index, filter.idx, filter.pid, ret); + break; + } } mutex_unlock(&dev->bus_adap.lock); @@ -154,7 +154,8 @@ return ret; } -static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed) { +static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed) +{ int ret = 0; struct dvb_demux *demux = dvbdmxfeed->demux; struct as102_dev_t *as102_dev = demux->priv; @@ -169,16 +170,16 @@ dvbdmxfeed->index, dvbdmxfeed->pid, 1); } - if (as102_dev->streaming++ == 0) { + if (as102_dev->streaming++ == 0) ret = as102_start_stream(as102_dev); - } mutex_unlock(&as102_dev->sem); LEAVE(); return ret; } -static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed) { +static int as102_dvb_dmx_stop_feed(struct dvb_demux_feed *dvbdmxfeed) +{ struct dvb_demux *demux = dvbdmxfeed->demux; struct as102_dev_t *as102_dev = demux->priv; @@ -187,9 +188,8 @@ if (mutex_lock_interruptible(&as102_dev->sem)) return -ERESTARTSYS; - if (--as102_dev->streaming == 0) { + if (--as102_dev->streaming == 0) as102_stop_stream(as102_dev); - } if (pid_filtering) { as10x_pid_filter(as102_dev, @@ -202,7 +202,8 @@ } #endif -int as102_dvb_register(struct as102_dev_t *as102_dev) { +int as102_dvb_register(struct as102_dev_t *as102_dev) +{ int ret = 0; ENTER(); @@ -223,7 +224,7 @@ ); if (ret < 0) { err("%s: dvb_register_adapter() failed (errno = %d)", - __FUNCTION__, ret); + __func__, ret); goto failed; } @@ -240,23 +241,23 @@ as102_dev->dvb_dmxdev.demux = &as102_dev->dvb_dmx.dmx; as102_dev->dvb_dmxdev.capabilities = 0; - if ((ret = dvb_dmx_init(&as102_dev->dvb_dmx)) < 0) { - err("%s: dvb_dmx_init() failed (errno = %d)", - __FUNCTION__, ret); + ret = dvb_dmx_init(&as102_dev->dvb_dmx); + if (ret < 0) { + err("%s: dvb_dmx_init() failed (errno = %d)", __func__, ret); goto failed; } ret = dvb_dmxdev_init(&as102_dev->dvb_dmxdev, &as102_dev->dvb_adap); if (ret < 0) { - err("%s: dvb_dmxdev_init() failed (errno = %d)", - __FUNCTION__, ret); + err("%s: dvb_dmxdev_init() failed (errno = %d)", __func__, + ret); goto failed; } ret = as102_dvb_register_fe(as102_dev, &as102_dev->dvb_fe); if (ret < 0) { err("%s: as102_dvb_register_frontend() failed (errno = %d)", - __FUNCTION__, ret); + __func__, ret); goto failed; } #endif @@ -283,7 +284,8 @@ return ret; } -void as102_dvb_unregister(struct as102_dev_t *as102_dev) { +void as102_dvb_unregister(struct as102_dev_t *as102_dev) +{ ENTER(); #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) @@ -300,7 +302,8 @@ LEAVE(); } -static int __init as102_driver_init(void) { +static int __init as102_driver_init(void) +{ int ret = 0; ENTER(); @@ -331,7 +334,8 @@ * \brief as102 driver exit point. This function is called when device has * to be removed. */ -static void __exit as102_driver_exit(void) { +static void __exit as102_driver_exit(void) +{ ENTER(); /* deregister this driver with the low level bus subsystem */ #if defined(CONFIG_AS102_USB) ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 3/14] staging/media/as102: checkpatch fixes [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> 2011-10-18 9:11 ` [PATCH 1/14] staging/media/as102: initial import from Abilis Piotr Chmura 2011-10-18 9:11 ` [PATCH 2/14] staging/media/as102: checkpatch fixes Piotr Chmura @ 2011-10-18 9:11 ` Piotr Chmura 2011-10-18 19:50 ` [RESEND PATCH " Piotr Chmura 2011-10-18 9:11 ` [PATCH 4/14] " Piotr Chmura ` (10 subsequent siblings) 13 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:11 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318626 18000 # Node ID b91e96a07bee27c1d421b4c3702e33ee8075de83 # Parent e2ba344c99936bddc46722f1f1efec5600c58659 as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as102_fw.c. Priority: normal Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> diff --git linux/drivers/staging/media/as102/as102_fw.c linuxb/drivers/media/dvb/as102/as102_fw.c --- linux/drivers/staging/media/as102/as102_fw.c +++ linuxb/drivers/staging/media/as102/as102_fw.c @@ -1,6 +1,7 @@ /* * Abilis Systems Single DVB-T Receiver * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,15 +32,16 @@ char as102_dt_fw1[] = "as102_data1_dt.hex"; char as102_dt_fw2[] = "as102_data2_dt.hex"; -static unsigned char atohx(unsigned char *dst, char *src) { +static unsigned char atohx(unsigned char *dst, char *src) +{ unsigned char value = 0; char msb = tolower(*src) - '0'; - char lsb = tolower(*(src +1)) - '0'; + char lsb = tolower(*(src + 1)) - '0'; - if (msb > 9 ) + if (msb > 9) msb -= 7; - if (lsb > 9 ) + if (lsb > 9) lsb -= 7; *dst = value = ((msb & 0xF) << 4) | (lsb & 0xF); @@ -62,43 +64,42 @@ } /* locate end of line */ - for (src=fw_data; *src != '\n'; src += 2) { + for (src = fw_data; *src != '\n'; src += 2) { atohx(&dst, src); /* parse line to split addr / data */ switch (count) { - case 0: - *dataLength = dst; - break; - case 1: - addr[2] = dst; - break; - case 2: - addr[3] = dst; - break; - case 3: - /* check if data is an address */ - if (dst == 0x04) - *addr_has_changed = 1; - else - *addr_has_changed = 0; - break; - case 4: - case 5: - if (*addr_has_changed) { - addr[(count - 4)] = dst; - } else { - data[(count - 4)] = dst; - } - break; - default: + case 0: + *dataLength = dst; + break; + case 1: + addr[2] = dst; + break; + case 2: + addr[3] = dst; + break; + case 3: + /* check if data is an address */ + if (dst == 0x04) + *addr_has_changed = 1; + else + *addr_has_changed = 0; + break; + case 4: + case 5: + if (*addr_has_changed) + addr[(count - 4)] = dst; + else data[(count - 4)] = dst; - break; + break; + default: + data[(count - 4)] = dst; + break; } count++; } /* return read value + ':' + '\n' */ - return ((count * 2) + 2); + return (count * 2) + 2; } static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap, @@ -122,17 +123,20 @@ &data_len, &addr_has_changed); - if (read_bytes <= 0) { + if (read_bytes <= 0) goto error; - } /* detect the end of file */ - if ((total_read_bytes += read_bytes) == firmware->size) { + total_read_bytes += read_bytes; + if (total_read_bytes == firmware->size) { fw_pkt.u.request[0] = 0x00; fw_pkt.u.request[1] = 0x03; /* send EOF command */ - if ((errno = bus_adap->ops->upload_fw_pkt(bus_adap,(uint8_t *) &fw_pkt, 2, 0)) < 0) + errno = bus_adap->ops->upload_fw_pkt(bus_adap, + (uint8_t *) + &fw_pkt, 2, 0); + if (errno < 0) goto error; } else { if (!addr_has_changed) { @@ -144,7 +148,12 @@ data_len += sizeof(fw_pkt.raw.address); /* send cmd to device */ - if ((errno = bus_adap->ops->upload_fw_pkt(bus_adap, (uint8_t *) &fw_pkt, data_len, 0)) < 0) + errno = bus_adap->ops->upload_fw_pkt(bus_adap, + (uint8_t *) + &fw_pkt, + data_len, + 0); + if (errno < 0) goto error; } } @@ -154,7 +163,8 @@ return (errno == 0) ? total_read_bytes : errno; } -int as102_fw_upload(struct as102_bus_adapter_t *bus_adap) { +int as102_fw_upload(struct as102_bus_adapter_t *bus_adap) +{ int errno = -EFAULT; const struct firmware *firmware; unsigned char *cmd_buf = NULL; @@ -179,20 +189,23 @@ #if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) /* allocate buffer to store firmware upload command and data */ - if ((cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL)) == NULL) { + cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL); + if (cmd_buf == NULL) { errno = -ENOMEM; goto error; } /* request kernel to locate firmware file: part1 */ - if ((errno = request_firmware(&firmware, fw1, &dev->dev)) < 0) { + errno = request_firmware(&firmware, fw1, &dev->dev); + if (errno < 0) { printk(KERN_ERR "%s: unable to locate firmware file: %s\n", DRIVER_NAME, fw1); goto error; } /* initiate firmware upload */ - if ((errno = as102_firmware_upload(bus_adap, cmd_buf, firmware)) < 0) { + errno = as102_firmware_upload(bus_adap, cmd_buf, firmware); + if (errno < 0) { printk(KERN_ERR "%s: error during firmware upload part1\n", DRIVER_NAME); goto error; @@ -206,14 +219,16 @@ mdelay(100); /* request kernel to locate firmware file: part2 */ - if ((errno = request_firmware(&firmware, fw2, &dev->dev)) < 0) { + errno = request_firmware(&firmware, fw2, &dev->dev); + if (errno < 0) { printk(KERN_ERR "%s: unable to locate firmware file: %s\n", DRIVER_NAME, fw2); goto error; } /* initiate firmware upload */ - if ((errno = as102_firmware_upload(bus_adap, cmd_buf, firmware)) < 0) { + errno = as102_firmware_upload(bus_adap, cmd_buf, firmware); + if (errno < 0) { printk(KERN_ERR "%s: error during firmware upload part2\n", DRIVER_NAME); goto error; ^ permalink raw reply [flat|nested] 91+ messages in thread
* [RESEND PATCH 3/14] staging/media/as102: checkpatch fixes 2011-10-18 9:11 ` [PATCH 3/14] " Piotr Chmura @ 2011-10-18 19:50 ` Piotr Chmura 0 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 19:50 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318626 18000 # Node ID b91e96a07bee27c1d421b4c3702e33ee8075de83 # Parent e2ba344c99936bddc46722f1f1efec5600c58659 as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as102_fw.c. Priority: normal Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff --git linux/drivers/staging/media/as102/as102_fw.c linuxb/drivers/media/dvb/as102/as102_fw.c --- linux/drivers/staging/media/as102/as102_fw.c +++ linuxb/drivers/staging/media/as102/as102_fw.c @@ -1,6 +1,7 @@ /* * Abilis Systems Single DVB-T Receiver * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,15 +32,16 @@ char as102_dt_fw1[] = "as102_data1_dt.hex"; char as102_dt_fw2[] = "as102_data2_dt.hex"; -static unsigned char atohx(unsigned char *dst, char *src) { +static unsigned char atohx(unsigned char *dst, char *src) +{ unsigned char value = 0; char msb = tolower(*src) - '0'; - char lsb = tolower(*(src +1)) - '0'; + char lsb = tolower(*(src + 1)) - '0'; - if (msb > 9 ) + if (msb > 9) msb -= 7; - if (lsb > 9 ) + if (lsb > 9) lsb -= 7; *dst = value = ((msb & 0xF) << 4) | (lsb & 0xF); @@ -62,43 +64,42 @@ } /* locate end of line */ - for (src=fw_data; *src != '\n'; src += 2) { + for (src = fw_data; *src != '\n'; src += 2) { atohx(&dst, src); /* parse line to split addr / data */ switch (count) { - case 0: - *dataLength = dst; - break; - case 1: - addr[2] = dst; - break; - case 2: - addr[3] = dst; - break; - case 3: - /* check if data is an address */ - if (dst == 0x04) - *addr_has_changed = 1; - else - *addr_has_changed = 0; - break; - case 4: - case 5: - if (*addr_has_changed) { - addr[(count - 4)] = dst; - } else { - data[(count - 4)] = dst; - } - break; - default: + case 0: + *dataLength = dst; + break; + case 1: + addr[2] = dst; + break; + case 2: + addr[3] = dst; + break; + case 3: + /* check if data is an address */ + if (dst == 0x04) + *addr_has_changed = 1; + else + *addr_has_changed = 0; + break; + case 4: + case 5: + if (*addr_has_changed) + addr[(count - 4)] = dst; + else data[(count - 4)] = dst; - break; + break; + default: + data[(count - 4)] = dst; + break; } count++; } /* return read value + ':' + '\n' */ - return ((count * 2) + 2); + return (count * 2) + 2; } static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap, @@ -122,17 +123,20 @@ &data_len, &addr_has_changed); - if (read_bytes <= 0) { + if (read_bytes <= 0) goto error; - } /* detect the end of file */ - if ((total_read_bytes += read_bytes) == firmware->size) { + total_read_bytes += read_bytes; + if (total_read_bytes == firmware->size) { fw_pkt.u.request[0] = 0x00; fw_pkt.u.request[1] = 0x03; /* send EOF command */ - if ((errno = bus_adap->ops->upload_fw_pkt(bus_adap,(uint8_t *) &fw_pkt, 2, 0)) < 0) + errno = bus_adap->ops->upload_fw_pkt(bus_adap, + (uint8_t *) + &fw_pkt, 2, 0); + if (errno < 0) goto error; } else { if (!addr_has_changed) { @@ -144,7 +148,12 @@ data_len += sizeof(fw_pkt.raw.address); /* send cmd to device */ - if ((errno = bus_adap->ops->upload_fw_pkt(bus_adap, (uint8_t *) &fw_pkt, data_len, 0)) < 0) + errno = bus_adap->ops->upload_fw_pkt(bus_adap, + (uint8_t *) + &fw_pkt, + data_len, + 0); + if (errno < 0) goto error; } } @@ -154,7 +163,8 @@ return (errno == 0) ? total_read_bytes : errno; } -int as102_fw_upload(struct as102_bus_adapter_t *bus_adap) { +int as102_fw_upload(struct as102_bus_adapter_t *bus_adap) +{ int errno = -EFAULT; const struct firmware *firmware; unsigned char *cmd_buf = NULL; @@ -179,20 +189,23 @@ #if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) /* allocate buffer to store firmware upload command and data */ - if ((cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL)) == NULL) { + cmd_buf = kzalloc(MAX_FW_PKT_SIZE, GFP_KERNEL); + if (cmd_buf == NULL) { errno = -ENOMEM; goto error; } /* request kernel to locate firmware file: part1 */ - if ((errno = request_firmware(&firmware, fw1, &dev->dev)) < 0) { + errno = request_firmware(&firmware, fw1, &dev->dev); + if (errno < 0) { printk(KERN_ERR "%s: unable to locate firmware file: %s\n", DRIVER_NAME, fw1); goto error; } /* initiate firmware upload */ - if ((errno = as102_firmware_upload(bus_adap, cmd_buf, firmware)) < 0) { + errno = as102_firmware_upload(bus_adap, cmd_buf, firmware); + if (errno < 0) { printk(KERN_ERR "%s: error during firmware upload part1\n", DRIVER_NAME); goto error; @@ -206,14 +219,16 @@ mdelay(100); /* request kernel to locate firmware file: part2 */ - if ((errno = request_firmware(&firmware, fw2, &dev->dev)) < 0) { + errno = request_firmware(&firmware, fw2, &dev->dev); + if (errno < 0) { printk(KERN_ERR "%s: unable to locate firmware file: %s\n", DRIVER_NAME, fw2); goto error; } /* initiate firmware upload */ - if ((errno = as102_firmware_upload(bus_adap, cmd_buf, firmware)) < 0) { + errno = as102_firmware_upload(bus_adap, cmd_buf, firmware); + if (errno < 0) { printk(KERN_ERR "%s: error during firmware upload part2\n", DRIVER_NAME); goto error; ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 4/14] staging/media/as102: checkpatch fixes [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> ` (2 preceding siblings ...) 2011-10-18 9:11 ` [PATCH 3/14] " Piotr Chmura @ 2011-10-18 9:11 ` Piotr Chmura 2011-10-18 19:51 ` [RESEND PATCH " Piotr Chmura 2011-10-18 9:11 ` [PATCH 5/14] " Piotr Chmura ` (9 subsequent siblings) 13 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:11 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318701 18000 # Node ID 69c8f5172790784738bcc18f8301919ef3d5373f # Parent b91e96a07bee27c1d421b4c3702e33ee8075de83 as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as10x_cmd.c. Priority: normal Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> diff --git linux/drivers/staging/media/as102/as10x_cmd.c linuxb/drivers/media/dvb/as102/as10x_cmd.c --- linux/drivers/staging/media/as102/as10x_cmd.c +++ linuxb/drivers/staging/media/as102/as10x_cmd.c @@ -1,6 +1,7 @@ /* * Abilis Systems Single DVB-T Receiver * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,7 +22,8 @@ #include <linux/kernel.h> #include "as102_drv.h" #elif defined(WIN32) - #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) /* win32 ddk implementation */ + #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) + /* win32 ddk implementation */ #include "wdm.h" #include "Device.h" #include "endian_mgmt.h" /* FIXME */ @@ -51,43 +53,42 @@ */ int as10x_cmd_turn_on(as10x_handle_t *phandle) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd,(++phandle->cmd_xid), sizeof(pcmd->body.turn_on.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.turn_on.req)); - /* fill command */ - pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON); + /* fill command */ + pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd( - phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.turn_on.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.turn_on.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.turn_on.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.turn_on.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -98,42 +99,41 @@ */ int as10x_cmd_turn_off(as10x_handle_t *phandle) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.turn_off.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.turn_off.req)); - /* fill command */ - pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF); + /* fill command */ + pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd( + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( phandle, (uint8_t *) pcmd, sizeof(pcmd->body.turn_off.req) + HEADER_SIZE, - (uint8_t *) prsp, + (uint8_t *) prsp, sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -145,50 +145,54 @@ */ int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune) { - int error; - struct as10x_cmd_t *preq, *prsp; + int error; + struct as10x_cmd_t *preq, *prsp; - ENTER(); + ENTER(); - preq = phandle->cmd; - prsp = phandle->rsp; + preq = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(preq,(++phandle->cmd_xid),sizeof(preq->body.set_tune.req)); + /* prepare command */ + as10x_cmd_build(preq, (++phandle->cmd_xid), + sizeof(preq->body.set_tune.req)); - /* fill command */ - preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE); - preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq); - preq->body.set_tune.req.args.bandwidth = ptune->bandwidth; - preq->body.set_tune.req.args.hier_select = ptune->hier_select; - preq->body.set_tune.req.args.constellation = ptune->constellation; - preq->body.set_tune.req.args.hierarchy = ptune->hierarchy; - preq->body.set_tune.req.args.interleaving_mode = ptune->interleaving_mode; - preq->body.set_tune.req.args.code_rate = ptune->code_rate; - preq->body.set_tune.req.args.guard_interval = ptune->guard_interval; - preq->body.set_tune.req.args.transmission_mode = ptune->transmission_mode; + /* fill command */ + preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE); + preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq); + preq->body.set_tune.req.args.bandwidth = ptune->bandwidth; + preq->body.set_tune.req.args.hier_select = ptune->hier_select; + preq->body.set_tune.req.args.constellation = ptune->constellation; + preq->body.set_tune.req.args.hierarchy = ptune->hierarchy; + preq->body.set_tune.req.args.interleaving_mode = + ptune->interleaving_mode; + preq->body.set_tune.req.args.code_rate = ptune->code_rate; + preq->body.set_tune.req.args.guard_interval = ptune->guard_interval; + preq->body.set_tune.req.args.transmission_mode = + ptune->transmission_mode; - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) preq, - sizeof(preq->body.set_tune.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.set_tune.rsp) + HEADER_SIZE); - } else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) preq, + sizeof(preq->body.set_tune.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.set_tune.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -198,57 +202,55 @@ \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_get_tune_status(as10x_handle_t *phandle, struct as10x_tune_status *pstatus) +int as10x_cmd_get_tune_status(as10x_handle_t *phandle, + struct as10x_tune_status *pstatus) { - int error; - struct as10x_cmd_t *preq, *prsp; + int error; + struct as10x_cmd_t *preq, *prsp; - ENTER(); + ENTER(); - preq = phandle->cmd; - prsp = phandle->rsp; + preq = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(preq,(++phandle->cmd_xid), - sizeof(preq->body.get_tune_status.req)); + /* prepare command */ + as10x_cmd_build(preq, (++phandle->cmd_xid), + sizeof(preq->body.get_tune_status.req)); - /* fill command */ - preq->body.get_tune_status.req.proc_id = - cpu_to_le16(CONTROL_PROC_GETTUNESTAT); + /* fill command */ + preq->body.get_tune_status.req.proc_id = + cpu_to_le16(CONTROL_PROC_GETTUNESTAT); - /* send command */ - if (phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd( + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( phandle, (uint8_t *) preq, sizeof(preq->body.get_tune_status.req) + HEADER_SIZE, (uint8_t *) prsp, sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + } else { + error = AS10X_CMD_ERROR; + } - if (error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP); - if (error < 0) { - goto out; - } + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP); + if (error < 0) + goto out; - /* Response OK -> get response data */ - pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state; - pstatus->signal_strength = - le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength); - pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER); - pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER); + /* Response OK -> get response data */ + pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state; + pstatus->signal_strength = + le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength); + pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER); + pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -260,56 +262,58 @@ */ int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps) { + int error; + struct as10x_cmd_t *pcmd, *prsp; - int error; - struct as10x_cmd_t *pcmd, *prsp; + ENTER(); - ENTER(); + pcmd = phandle->cmd; + prsp = phandle->rsp; - pcmd = phandle->cmd; - prsp = phandle->rsp; + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_tps.req)); - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid),sizeof(pcmd->body.get_tps.req)); + /* fill command */ + pcmd->body.get_tune_status.req.proc_id = + cpu_to_le16(CONTROL_PROC_GETTPS); - /* fill command */ - pcmd->body.get_tune_status.req.proc_id = cpu_to_le16(CONTROL_PROC_GETTPS); + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_tps.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_tps.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, sizeof(pcmd->body.get_tps.req) + HEADER_SIZE, - (uint8_t *) prsp, sizeof(prsp->body.get_tps.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + if (error < 0) + goto out; - if(error < 0) { - goto out; - } + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP); + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP); - if (error < 0) { - goto out; - } - - /* Response OK -> get response data */ - ptps->constellation = prsp->body.get_tps.rsp.tps.constellation; - ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy; - ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode; - ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP; - ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP; - ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval; - ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode; - ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP; - ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP; - ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID); + /* Response OK -> get response data */ + ptps->constellation = prsp->body.get_tps.rsp.tps.constellation; + ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy; + ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode; + ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP; + ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP; + ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval; + ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode; + ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP; + ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP; + ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -322,59 +326,58 @@ int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, struct as10x_demod_stats *pdemod_stats) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.get_demod_stats.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_demod_stats.req)); - /* fill command */ - pcmd->body.get_demod_stats.req.proc_id = - cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); + /* fill command */ + pcmd->body.get_demod_stats.req.proc_id = + cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.get_demod_stats.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.get_demod_stats.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_demod_stats.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_demod_stats.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_DEMOD_STATS_RSP); - if (error < 0) { - goto out; - } + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_DEMOD_STATS_RSP); + if (error < 0) + goto out; - /* Response OK -> get response data */ - pdemod_stats->frame_count = - le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count); - pdemod_stats->bad_frame_count = - le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count); - pdemod_stats->bytes_fixed_by_rs = - le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs); - pdemod_stats->mer = - le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer); - pdemod_stats->has_started = - prsp->body.get_demod_stats.rsp.stats.has_started; + /* Response OK -> get response data */ + pdemod_stats->frame_count = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count); + pdemod_stats->bad_frame_count = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count); + pdemod_stats->bytes_fixed_by_rs = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs); + pdemod_stats->mer = + le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer); + pdemod_stats->has_started = + prsp->body.get_demod_stats.rsp.stats.has_started; out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -388,50 +391,49 @@ int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, uint8_t *is_ready) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.get_impulse_rsp.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_impulse_rsp.req)); - /* fill command */ - pcmd->body.get_impulse_rsp.req.proc_id = - cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); + /* fill command */ + pcmd->body.get_impulse_rsp.req.proc_id = + cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.get_impulse_rsp.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.get_impulse_rsp.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_impulse_rsp.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_impulse_rsp.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_IMPULSE_RESP_RSP); - if (error < 0) { - goto out; - } + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_IMPULSE_RESP_RSP); + if (error < 0) + goto out; - /* Response OK -> get response data */ - *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready; + /* Response OK -> get response data */ + *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready; out: - LEAVE(); - return(error); + LEAVE(); + return error; } @@ -447,10 +449,10 @@ void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t xid, uint16_t cmd_len) { - pcmd->header.req_id = cpu_to_le16(xid); - pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID); - pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION); - pcmd->header.data_len = cpu_to_le16(cmd_len); + pcmd->header.req_id = cpu_to_le16(xid); + pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID); + pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION); + pcmd->header.data_len = cpu_to_le16(cmd_len); } /** @@ -463,16 +465,17 @@ */ int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) { - int error; + int error; - /* extract command error code */ - error = prsp->body.common.rsp.error; + /* extract command error code */ + error = prsp->body.common.rsp.error; - if((error == 0) && (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) { - return 0; - } + if ((error == 0) && + (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) { + return 0; + } - return AS10X_CMD_ERROR; + return AS10X_CMD_ERROR; } ^ permalink raw reply [flat|nested] 91+ messages in thread
* [RESEND PATCH 4/14] staging/media/as102: checkpatch fixes 2011-10-18 9:11 ` [PATCH 4/14] " Piotr Chmura @ 2011-10-18 19:51 ` Piotr Chmura 2011-10-29 10:22 ` Sylwester Nawrocki 0 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 19:51 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318701 18000 # Node ID 69c8f5172790784738bcc18f8301919ef3d5373f # Parent b91e96a07bee27c1d421b4c3702e33ee8075de83 as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as10x_cmd.c. Priority: normal Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff --git linux/drivers/staging/media/as102/as10x_cmd.c linuxb/drivers/media/dvb/as102/as10x_cmd.c --- linux/drivers/staging/media/as102/as10x_cmd.c +++ linuxb/drivers/staging/media/as102/as10x_cmd.c @@ -1,6 +1,7 @@ /* * Abilis Systems Single DVB-T Receiver * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,7 +22,8 @@ #include <linux/kernel.h> #include "as102_drv.h" #elif defined(WIN32) - #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) /* win32 ddk implementation */ + #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) + /* win32 ddk implementation */ #include "wdm.h" #include "Device.h" #include "endian_mgmt.h" /* FIXME */ @@ -51,43 +53,42 @@ */ int as10x_cmd_turn_on(as10x_handle_t *phandle) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd,(++phandle->cmd_xid), sizeof(pcmd->body.turn_on.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.turn_on.req)); - /* fill command */ - pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON); + /* fill command */ + pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd( - phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.turn_on.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.turn_on.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.turn_on.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.turn_on.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -98,42 +99,41 @@ */ int as10x_cmd_turn_off(as10x_handle_t *phandle) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.turn_off.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.turn_off.req)); - /* fill command */ - pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF); + /* fill command */ + pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd( + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( phandle, (uint8_t *) pcmd, sizeof(pcmd->body.turn_off.req) + HEADER_SIZE, - (uint8_t *) prsp, + (uint8_t *) prsp, sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -145,50 +145,54 @@ */ int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune) { - int error; - struct as10x_cmd_t *preq, *prsp; + int error; + struct as10x_cmd_t *preq, *prsp; - ENTER(); + ENTER(); - preq = phandle->cmd; - prsp = phandle->rsp; + preq = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(preq,(++phandle->cmd_xid),sizeof(preq->body.set_tune.req)); + /* prepare command */ + as10x_cmd_build(preq, (++phandle->cmd_xid), + sizeof(preq->body.set_tune.req)); - /* fill command */ - preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE); - preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq); - preq->body.set_tune.req.args.bandwidth = ptune->bandwidth; - preq->body.set_tune.req.args.hier_select = ptune->hier_select; - preq->body.set_tune.req.args.constellation = ptune->constellation; - preq->body.set_tune.req.args.hierarchy = ptune->hierarchy; - preq->body.set_tune.req.args.interleaving_mode = ptune->interleaving_mode; - preq->body.set_tune.req.args.code_rate = ptune->code_rate; - preq->body.set_tune.req.args.guard_interval = ptune->guard_interval; - preq->body.set_tune.req.args.transmission_mode = ptune->transmission_mode; + /* fill command */ + preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE); + preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq); + preq->body.set_tune.req.args.bandwidth = ptune->bandwidth; + preq->body.set_tune.req.args.hier_select = ptune->hier_select; + preq->body.set_tune.req.args.constellation = ptune->constellation; + preq->body.set_tune.req.args.hierarchy = ptune->hierarchy; + preq->body.set_tune.req.args.interleaving_mode = + ptune->interleaving_mode; + preq->body.set_tune.req.args.code_rate = ptune->code_rate; + preq->body.set_tune.req.args.guard_interval = ptune->guard_interval; + preq->body.set_tune.req.args.transmission_mode = + ptune->transmission_mode; - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) preq, - sizeof(preq->body.set_tune.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.set_tune.rsp) + HEADER_SIZE); - } else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) preq, + sizeof(preq->body.set_tune.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.set_tune.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -198,57 +202,55 @@ \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_get_tune_status(as10x_handle_t *phandle, struct as10x_tune_status *pstatus) +int as10x_cmd_get_tune_status(as10x_handle_t *phandle, + struct as10x_tune_status *pstatus) { - int error; - struct as10x_cmd_t *preq, *prsp; + int error; + struct as10x_cmd_t *preq, *prsp; - ENTER(); + ENTER(); - preq = phandle->cmd; - prsp = phandle->rsp; + preq = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(preq,(++phandle->cmd_xid), - sizeof(preq->body.get_tune_status.req)); + /* prepare command */ + as10x_cmd_build(preq, (++phandle->cmd_xid), + sizeof(preq->body.get_tune_status.req)); - /* fill command */ - preq->body.get_tune_status.req.proc_id = - cpu_to_le16(CONTROL_PROC_GETTUNESTAT); + /* fill command */ + preq->body.get_tune_status.req.proc_id = + cpu_to_le16(CONTROL_PROC_GETTUNESTAT); - /* send command */ - if (phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd( + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( phandle, (uint8_t *) preq, sizeof(preq->body.get_tune_status.req) + HEADER_SIZE, (uint8_t *) prsp, sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + } else { + error = AS10X_CMD_ERROR; + } - if (error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP); - if (error < 0) { - goto out; - } + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP); + if (error < 0) + goto out; - /* Response OK -> get response data */ - pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state; - pstatus->signal_strength = - le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength); - pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER); - pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER); + /* Response OK -> get response data */ + pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state; + pstatus->signal_strength = + le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength); + pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER); + pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -260,56 +262,58 @@ */ int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps) { + int error; + struct as10x_cmd_t *pcmd, *prsp; - int error; - struct as10x_cmd_t *pcmd, *prsp; + ENTER(); - ENTER(); + pcmd = phandle->cmd; + prsp = phandle->rsp; - pcmd = phandle->cmd; - prsp = phandle->rsp; + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_tps.req)); - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid),sizeof(pcmd->body.get_tps.req)); + /* fill command */ + pcmd->body.get_tune_status.req.proc_id = + cpu_to_le16(CONTROL_PROC_GETTPS); - /* fill command */ - pcmd->body.get_tune_status.req.proc_id = cpu_to_le16(CONTROL_PROC_GETTPS); + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_tps.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_tps.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, sizeof(pcmd->body.get_tps.req) + HEADER_SIZE, - (uint8_t *) prsp, sizeof(prsp->body.get_tps.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + if (error < 0) + goto out; - if(error < 0) { - goto out; - } + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP); + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP); - if (error < 0) { - goto out; - } - - /* Response OK -> get response data */ - ptps->constellation = prsp->body.get_tps.rsp.tps.constellation; - ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy; - ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode; - ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP; - ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP; - ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval; - ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode; - ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP; - ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP; - ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID); + /* Response OK -> get response data */ + ptps->constellation = prsp->body.get_tps.rsp.tps.constellation; + ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy; + ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode; + ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP; + ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP; + ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval; + ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode; + ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP; + ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP; + ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -322,59 +326,58 @@ int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, struct as10x_demod_stats *pdemod_stats) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.get_demod_stats.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_demod_stats.req)); - /* fill command */ - pcmd->body.get_demod_stats.req.proc_id = - cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); + /* fill command */ + pcmd->body.get_demod_stats.req.proc_id = + cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.get_demod_stats.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.get_demod_stats.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_demod_stats.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_demod_stats.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_DEMOD_STATS_RSP); - if (error < 0) { - goto out; - } + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_DEMOD_STATS_RSP); + if (error < 0) + goto out; - /* Response OK -> get response data */ - pdemod_stats->frame_count = - le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count); - pdemod_stats->bad_frame_count = - le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count); - pdemod_stats->bytes_fixed_by_rs = - le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs); - pdemod_stats->mer = - le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer); - pdemod_stats->has_started = - prsp->body.get_demod_stats.rsp.stats.has_started; + /* Response OK -> get response data */ + pdemod_stats->frame_count = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count); + pdemod_stats->bad_frame_count = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count); + pdemod_stats->bytes_fixed_by_rs = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs); + pdemod_stats->mer = + le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer); + pdemod_stats->has_started = + prsp->body.get_demod_stats.rsp.stats.has_started; out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -388,50 +391,49 @@ int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, uint8_t *is_ready) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.get_impulse_rsp.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_impulse_rsp.req)); - /* fill command */ - pcmd->body.get_impulse_rsp.req.proc_id = - cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); + /* fill command */ + pcmd->body.get_impulse_rsp.req.proc_id = + cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.get_impulse_rsp.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.get_impulse_rsp.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_impulse_rsp.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_impulse_rsp.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_IMPULSE_RESP_RSP); - if (error < 0) { - goto out; - } + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_IMPULSE_RESP_RSP); + if (error < 0) + goto out; - /* Response OK -> get response data */ - *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready; + /* Response OK -> get response data */ + *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready; out: - LEAVE(); - return(error); + LEAVE(); + return error; } @@ -447,10 +449,10 @@ void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t xid, uint16_t cmd_len) { - pcmd->header.req_id = cpu_to_le16(xid); - pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID); - pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION); - pcmd->header.data_len = cpu_to_le16(cmd_len); + pcmd->header.req_id = cpu_to_le16(xid); + pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID); + pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION); + pcmd->header.data_len = cpu_to_le16(cmd_len); } /** @@ -463,16 +465,17 @@ */ int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) { - int error; + int error; - /* extract command error code */ - error = prsp->body.common.rsp.error; + /* extract command error code */ + error = prsp->body.common.rsp.error; - if((error == 0) && (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) { - return 0; - } + if ((error == 0) && + (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) { + return 0; + } - return AS10X_CMD_ERROR; + return AS10X_CMD_ERROR; } ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 4/14] staging/media/as102: checkpatch fixes 2011-10-18 19:51 ` [RESEND PATCH " Piotr Chmura @ 2011-10-29 10:22 ` Sylwester Nawrocki 2011-10-29 13:17 ` Piotr Chmura 0 siblings, 1 reply; 91+ messages in thread From: Sylwester Nawrocki @ 2011-10-29 10:22 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel On 10/18/2011 09:51 PM, Piotr Chmura wrote: > Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ > > Original source and comment: > # HG changeset patch > # User Devin Heitmueller<dheitmueller@kernellabs.com> > # Date 1267318701 18000 > # Node ID 69c8f5172790784738bcc18f8301919ef3d5373f > # Parent b91e96a07bee27c1d421b4c3702e33ee8075de83 > as102: checkpatch fixes > > From: Devin Heitmueller<dheitmueller@kernellabs.com> > > Fix make checkpatch issues reported against as10x_cmd.c. > > Priority: normal > > Signed-off-by: Devin Heitmueller<dheitmueller@kernellabs.com> > Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> Hi Piotr, starting from this patch the series doesn't apply cleanly to staging/for_v3.2 tree. Which branch is it based on ? --- Thanks, Sylwester ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 4/14] staging/media/as102: checkpatch fixes 2011-10-29 10:22 ` Sylwester Nawrocki @ 2011-10-29 13:17 ` Piotr Chmura 2011-10-29 16:14 ` Sylwester Nawrocki 2011-10-29 16:25 ` [RESEND PATCH " Piotr Chmura 0 siblings, 2 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-29 13:17 UTC (permalink / raw) To: Sylwester Nawrocki Cc: Mauro Carvalho Chehab, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel W dniu 29.10.2011 12:22, Sylwester Nawrocki pisze: > On 10/18/2011 09:51 PM, Piotr Chmura wrote: >> Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ >> >> Original source and comment: >> # HG changeset patch >> # User Devin Heitmueller<dheitmueller@kernellabs.com> >> # Date 1267318701 18000 >> # Node ID 69c8f5172790784738bcc18f8301919ef3d5373f >> # Parent b91e96a07bee27c1d421b4c3702e33ee8075de83 >> as102: checkpatch fixes >> >> From: Devin Heitmueller<dheitmueller@kernellabs.com> >> >> Fix make checkpatch issues reported against as10x_cmd.c. >> >> Priority: normal >> >> Signed-off-by: Devin Heitmueller<dheitmueller@kernellabs.com> >> Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> > Hi Piotr, > > starting from this patch the series doesn't apply cleanly to > staging/for_v3.2 tree. Which branch is it based on ? > > --- > Thanks, > Sylwester Hi Sylwester, I'is based on git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git kernel-3.1.0-git9+ All patches are working on newly created driver directory drivers/staging/media/as102 (exception is 13/14: staging/Makefile and staging/Kconfig) and they apply cleanly in my tree. Let me know why they doesn't on yours and i'll try to fix them. Thanks, Piotr ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 4/14] staging/media/as102: checkpatch fixes 2011-10-29 13:17 ` Piotr Chmura @ 2011-10-29 16:14 ` Sylwester Nawrocki 2011-10-29 17:48 ` Piotr Chmura 2011-10-29 16:25 ` [RESEND PATCH " Piotr Chmura 1 sibling, 1 reply; 91+ messages in thread From: Sylwester Nawrocki @ 2011-10-29 16:14 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Hi, On 10/29/2011 03:17 PM, Piotr Chmura wrote: > > W dniu 29.10.2011 12:22, Sylwester Nawrocki pisze: >> On 10/18/2011 09:51 PM, Piotr Chmura wrote: >>> Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ >>> >>> Original source and comment: >>> # HG changeset patch >>> # User Devin Heitmueller<dheitmueller@kernellabs.com> >>> # Date 1267318701 18000 >>> # Node ID 69c8f5172790784738bcc18f8301919ef3d5373f >>> # Parent b91e96a07bee27c1d421b4c3702e33ee8075de83 >>> as102: checkpatch fixes >>> >>> From: Devin Heitmueller<dheitmueller@kernellabs.com> >>> >>> Fix make checkpatch issues reported against as10x_cmd.c. >>> >>> Priority: normal >>> >>> Signed-off-by: Devin Heitmueller<dheitmueller@kernellabs.com> >>> Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> >> Hi Piotr, >> >> starting from this patch the series doesn't apply cleanly to >> staging/for_v3.2 tree. Which branch is it based on ? >> >> --- >> Thanks, >> Sylwester > Hi Sylwester, > > I'is based on > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git kernel-3.1.0-git9+ > > All patches are working on newly created driver directory drivers/staging/media/as102 > (exception is 13/14: staging/Makefile and staging/Kconfig) and they apply cleanly in > my tree. Let me know why they doesn't on yours and i'll try to fix them. I suspect the patch got mangled. The base tree shouldn't matter that much since the patches are touching only the newly created directory. With you previous patch set I'm getting an error at patch 5/11. snawrocki@vostro:~/linux/media_tree$ git am -3 RESEND-1-14-staging-media-as102-initial-import-from-Abilis.patch Applying: staging/media/as102: initial import from Abilis snawrocki@vostro:~/linux/media_tree$ git am -3 RESEND-2-14-staging-media-as102-checkpatch-fixes.patch Applying: staging/media/as102: checkpatch fixes snawrocki@vostro:~/linux/media_tree$ git am -3 RESEND-3-14-staging-media-as102-checkpatch-fixes.patch Applying: staging/media/as102: checkpatch fixes snawrocki@vostro:~/linux/media_tree$ git am -3 RESEND-4-14-staging-media-as102-checkpatch-fixes.patch Applying: staging/media/as102: checkpatch fixes fatal: corrupt patch at line 664 Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 staging/media/as102: checkpatch fixes When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort". snawrocki@vostro:~/linux/media_tree$ git apply --verbose --reject RESEND-4-14-staging-media-as102-checkpatch-fixes.patch fatal: corrupt patch at line 702 snawrocki@vostro:~/linux/media_tree$ git ll cbcbb4b staging/media/as102: checkpatch fixes acde12d staging/media/as102: checkpatch fixes d47fc51 staging/media/as102: initial import from Abilis ... You are not using git send-email to send the patches, are you ? -- Regards, Sylwester ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 4/14] staging/media/as102: checkpatch fixes 2011-10-29 16:14 ` Sylwester Nawrocki @ 2011-10-29 17:48 ` Piotr Chmura 2011-10-29 21:37 ` Sylwester Nawrocki 0 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-29 17:48 UTC (permalink / raw) To: Sylwester Nawrocki Cc: Mauro Carvalho Chehab, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel W dniu 29.10.2011 18:14, Sylwester Nawrocki pisze: > Hi, > > On 10/29/2011 03:17 PM, Piotr Chmura wrote: >> W dniu 29.10.2011 12:22, Sylwester Nawrocki pisze: >>> On 10/18/2011 09:51 PM, Piotr Chmura wrote: >>>> Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ >>>> >>>> Original source and comment: >>>> # HG changeset patch >>>> # User Devin Heitmueller<dheitmueller@kernellabs.com> >>>> # Date 1267318701 18000 >>>> # Node ID 69c8f5172790784738bcc18f8301919ef3d5373f >>>> # Parent b91e96a07bee27c1d421b4c3702e33ee8075de83 >>>> as102: checkpatch fixes >>>> >>>> From: Devin Heitmueller<dheitmueller@kernellabs.com> >>>> >>>> Fix make checkpatch issues reported against as10x_cmd.c. >>>> >>>> Priority: normal >>>> >>>> Signed-off-by: Devin Heitmueller<dheitmueller@kernellabs.com> >>>> Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> >>> Hi Piotr, >>> >>> starting from this patch the series doesn't apply cleanly to >>> staging/for_v3.2 tree. Which branch is it based on ? >>> >>> --- >>> Thanks, >>> Sylwester >> Hi Sylwester, >> >> I'is based on >> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git kernel-3.1.0-git9+ >> >> All patches are working on newly created driver directory drivers/staging/media/as102 >> (exception is 13/14: staging/Makefile and staging/Kconfig) and they apply cleanly in >> my tree. Let me know why they doesn't on yours and i'll try to fix them. > I suspect the patch got mangled. The base tree shouldn't matter that much since > the patches are touching only the newly created directory. > With you previous patch set I'm getting an error at patch 5/11. > > > snawrocki@vostro:~/linux/media_tree$ git am -3 RESEND-1-14-staging-media-as102-initial-import-from-Abilis.patch > Applying: staging/media/as102: initial import from Abilis > snawrocki@vostro:~/linux/media_tree$ git am -3 RESEND-2-14-staging-media-as102-checkpatch-fixes.patch > Applying: staging/media/as102: checkpatch fixes > snawrocki@vostro:~/linux/media_tree$ git am -3 RESEND-3-14-staging-media-as102-checkpatch-fixes.patch > Applying: staging/media/as102: checkpatch fixes > snawrocki@vostro:~/linux/media_tree$ git am -3 RESEND-4-14-staging-media-as102-checkpatch-fixes.patch > Applying: staging/media/as102: checkpatch fixes > fatal: corrupt patch at line 664 > Repository lacks necessary blobs to fall back on 3-way merge. > Cannot fall back to three-way merge. > Patch failed at 0001 staging/media/as102: checkpatch fixes > When you have resolved this problem run "git am --resolved". > If you would prefer to skip this patch, instead run "git am --skip". > To restore the original branch and stop patching run "git am --abort". I've downloaded patches from patchwork, as expected by you: dom@darkstar ~/src/kernel/linux.trynew $ patch -p1 -i RESEND-4-14-staging-media-as102-checkpatch-fixes.patch patching file drivers/staging/media/as102/as10x_cmd.c patch: **** malformed patch at line 664: To unsubscribe from this list: send the line "unsubscribe linux-media" in after removing -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org from end of file: dom@darkstar ~/src/kernel/linux.trynew $ patch -p1 -i RESEND-4-14-staging-media-as102-checkpatch-fixes.patch patching file drivers/staging/media/as102/as10x_cmd.c Works fine, so looks like footer of mailing list IS an issue here (there are less then 3 lines in patch because of end of file). > snawrocki@vostro:~/linux/media_tree$ git apply --verbose --reject RESEND-4-14-staging-media-as102-checkpatch-fixes.patch > fatal: corrupt patch at line 702 > snawrocki@vostro:~/linux/media_tree$ git ll > cbcbb4b staging/media/as102: checkpatch fixes > acde12d staging/media/as102: checkpatch fixes > d47fc51 staging/media/as102: initial import from Abilis > ... > > You are not using git send-email to send the patches, are you ? > I'm not using git for sending patches. Peter ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 4/14] staging/media/as102: checkpatch fixes 2011-10-29 17:48 ` Piotr Chmura @ 2011-10-29 21:37 ` Sylwester Nawrocki 2011-10-30 7:11 ` [PATCH v3 " Piotr Chmura 0 siblings, 1 reply; 91+ messages in thread From: Sylwester Nawrocki @ 2011-10-29 21:37 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel On 10/29/2011 07:48 PM, Piotr Chmura wrote: > W dniu 29.10.2011 18:14, Sylwester Nawrocki pisze: >> On 10/29/2011 03:17 PM, Piotr Chmura wrote: >>> W dniu 29.10.2011 12:22, Sylwester Nawrocki pisze: >>>> On 10/18/2011 09:51 PM, Piotr Chmura wrote: >>>>> Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ >>>>> >>>>> Original source and comment: >>>>> # HG changeset patch >>>>> # User Devin Heitmueller<dheitmueller@kernellabs.com> >>>>> # Date 1267318701 18000 >>>>> # Node ID 69c8f5172790784738bcc18f8301919ef3d5373f >>>>> # Parent b91e96a07bee27c1d421b4c3702e33ee8075de83 >>>>> as102: checkpatch fixes >>>>> >>>>> From: Devin Heitmueller<dheitmueller@kernellabs.com> >>>>> >>>>> Fix make checkpatch issues reported against as10x_cmd.c. >>>>> >>>>> Priority: normal >>>>> >>>>> Signed-off-by: Devin Heitmueller<dheitmueller@kernellabs.com> >>>>> Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> >>>> Hi Piotr, >>>> >>>> starting from this patch the series doesn't apply cleanly to >>>> staging/for_v3.2 tree. Which branch is it based on ? >>>> >>>> --- >>>> Thanks, >>>> Sylwester >>> Hi Sylwester, >>> >>> I'is based on >>> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git kernel-3.1.0-git9+ >>> >>> All patches are working on newly created driver directory drivers/staging/media/as102 >>> (exception is 13/14: staging/Makefile and staging/Kconfig) and they apply cleanly in >>> my tree. Let me know why they doesn't on yours and i'll try to fix them. >> I suspect the patch got mangled. The base tree shouldn't matter that much since >> the patches are touching only the newly created directory. >> With you previous patch set I'm getting an error at patch 5/11. >> >> >> snawrocki@vostro:~/linux/media_tree$ git am -3 RESEND-1-14-staging-media-as102-initial-import-from-Abilis.patch >> Applying: staging/media/as102: initial import from Abilis >> snawrocki@vostro:~/linux/media_tree$ git am -3 RESEND-2-14-staging-media-as102-checkpatch-fixes.patch >> Applying: staging/media/as102: checkpatch fixes >> snawrocki@vostro:~/linux/media_tree$ git am -3 RESEND-3-14-staging-media-as102-checkpatch-fixes.patch >> Applying: staging/media/as102: checkpatch fixes >> snawrocki@vostro:~/linux/media_tree$ git am -3 RESEND-4-14-staging-media-as102-checkpatch-fixes.patch >> Applying: staging/media/as102: checkpatch fixes >> fatal: corrupt patch at line 664 >> Repository lacks necessary blobs to fall back on 3-way merge. >> Cannot fall back to three-way merge. >> Patch failed at 0001 staging/media/as102: checkpatch fixes >> When you have resolved this problem run "git am --resolved". >> If you would prefer to skip this patch, instead run "git am --skip". >> To restore the original branch and stop patching run "git am --abort". > I've downloaded patches from patchwork, as expected by you: > > dom@darkstar ~/src/kernel/linux.trynew $ patch -p1 -i RESEND-4-14-staging-media-as102-checkpatch-fixes.patch > patching file drivers/staging/media/as102/as10x_cmd.c > patch: **** malformed patch at line 664: To unsubscribe from this list: send the line "unsubscribe linux-media" in > > after removing > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majordomo@vger.kernel.org > from end of file: > > dom@darkstar ~/src/kernel/linux.trynew $ patch -p1 -i RESEND-4-14-staging-media-as102-checkpatch-fixes.patch > patching file drivers/staging/media/as102/as10x_cmd.c > > Works fine, so looks like footer of mailing list IS an issue here (there are less then 3 lines in patch because of end of file). Yes, I confirm removing the footer solves the problem when using 'patch' rather than 'git am'. But then even 'patch' gives up at the subsequent patch: $ patch -p1 -i RESEND-5-14-staging-media-as102-checkpatch-fixes.patch patching file drivers/staging/media/as102/as10x_cmd_stream.c Hunk #3 FAILED at 111. 1 out of 3 hunks FAILED -- saving rejects to file drivers/staging/media/as102/as10x_cmd_stream.c.rej Anyway, thanks for your work, I ended up applying patches 1..3/14, 7..10 (RESEND), and 13..14/14 onto staging/for_v3.2 branch (http://git.linuxtv.org/media_tree.git). The driver works fine then with my PCTV 74e stick. > >> snawrocki@vostro:~/linux/media_tree$ git apply --verbose --reject RESEND-4-14-staging-media-as102-checkpatch-fixes.patch >> fatal: corrupt patch at line 702 >> snawrocki@vostro:~/linux/media_tree$ git ll >> cbcbb4b staging/media/as102: checkpatch fixes >> acde12d staging/media/as102: checkpatch fixes >> d47fc51 staging/media/as102: initial import from Abilis >> ... >> >> You are not using git send-email to send the patches, are you ? >> > I'm not using git for sending patches. I have never had any issues with git send-email, and it's quite easy to setup and convenient to use with larger patch series. -- Regards, Sylwester ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH v3 4/14] staging/media/as102: checkpatch fixes 2011-10-29 21:37 ` Sylwester Nawrocki @ 2011-10-30 7:11 ` Piotr Chmura 2011-10-30 11:17 ` Stefan Richter 0 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-30 7:11 UTC (permalink / raw) To: Sylwester Nawrocki, Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318701 18000 # Node ID 69c8f5172790784738bcc18f8301919ef3d5373f # Parent b91e96a07bee27c1d421b4c3702e33ee8075de83 as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as10x_cmd.c. Priority: normal Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> ---- Added missing empty lines at end of patch Sylwester could you check if it applies cleanly now ? diff --git linux/drivers/staging/media/as102/as10x_cmd.c linuxb/drivers/staging/media/as102/as10x_cmd.c --- linux/drivers/staging/media/as102/as10x_cmd.c +++ linuxb/drivers/staging/media/as102/as10x_cmd.c @@ -1,6 +1,7 @@ /* * Abilis Systems Single DVB-T Receiver * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,7 +22,8 @@ #include <linux/kernel.h> #include "as102_drv.h" #elif defined(WIN32) - #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) /* win32 ddk implementation */ + #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) + /* win32 ddk implementation */ #include "wdm.h" #include "Device.h" #include "endian_mgmt.h" /* FIXME */ @@ -51,43 +53,42 @@ */ int as10x_cmd_turn_on(as10x_handle_t *phandle) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd,(++phandle->cmd_xid), sizeof(pcmd->body.turn_on.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.turn_on.req)); - /* fill command */ - pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON); + /* fill command */ + pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd( - phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.turn_on.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.turn_on.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.turn_on.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.turn_on.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -98,42 +99,41 @@ */ int as10x_cmd_turn_off(as10x_handle_t *phandle) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.turn_off.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.turn_off.req)); - /* fill command */ - pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF); + /* fill command */ + pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd( + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( phandle, (uint8_t *) pcmd, sizeof(pcmd->body.turn_off.req) + HEADER_SIZE, - (uint8_t *) prsp, + (uint8_t *) prsp, sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -145,50 +145,54 @@ */ int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune) { - int error; - struct as10x_cmd_t *preq, *prsp; + int error; + struct as10x_cmd_t *preq, *prsp; - ENTER(); + ENTER(); - preq = phandle->cmd; - prsp = phandle->rsp; + preq = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(preq,(++phandle->cmd_xid),sizeof(preq->body.set_tune.req)); + /* prepare command */ + as10x_cmd_build(preq, (++phandle->cmd_xid), + sizeof(preq->body.set_tune.req)); - /* fill command */ - preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE); - preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq); - preq->body.set_tune.req.args.bandwidth = ptune->bandwidth; - preq->body.set_tune.req.args.hier_select = ptune->hier_select; - preq->body.set_tune.req.args.constellation = ptune->constellation; - preq->body.set_tune.req.args.hierarchy = ptune->hierarchy; - preq->body.set_tune.req.args.interleaving_mode = ptune->interleaving_mode; - preq->body.set_tune.req.args.code_rate = ptune->code_rate; - preq->body.set_tune.req.args.guard_interval = ptune->guard_interval; - preq->body.set_tune.req.args.transmission_mode = ptune->transmission_mode; + /* fill command */ + preq->body.set_tune.req.proc_id = cpu_to_le16(CONTROL_PROC_SETTUNE); + preq->body.set_tune.req.args.freq = cpu_to_le32(ptune->freq); + preq->body.set_tune.req.args.bandwidth = ptune->bandwidth; + preq->body.set_tune.req.args.hier_select = ptune->hier_select; + preq->body.set_tune.req.args.constellation = ptune->constellation; + preq->body.set_tune.req.args.hierarchy = ptune->hierarchy; + preq->body.set_tune.req.args.interleaving_mode = + ptune->interleaving_mode; + preq->body.set_tune.req.args.code_rate = ptune->code_rate; + preq->body.set_tune.req.args.guard_interval = ptune->guard_interval; + preq->body.set_tune.req.args.transmission_mode = + ptune->transmission_mode; - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) preq, - sizeof(preq->body.set_tune.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.set_tune.rsp) + HEADER_SIZE); - } else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) preq, + sizeof(preq->body.set_tune.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.set_tune.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_SETTUNE_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -198,57 +202,55 @@ \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_get_tune_status(as10x_handle_t *phandle, struct as10x_tune_status *pstatus) +int as10x_cmd_get_tune_status(as10x_handle_t *phandle, + struct as10x_tune_status *pstatus) { - int error; - struct as10x_cmd_t *preq, *prsp; + int error; + struct as10x_cmd_t *preq, *prsp; - ENTER(); + ENTER(); - preq = phandle->cmd; - prsp = phandle->rsp; + preq = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(preq,(++phandle->cmd_xid), - sizeof(preq->body.get_tune_status.req)); + /* prepare command */ + as10x_cmd_build(preq, (++phandle->cmd_xid), + sizeof(preq->body.get_tune_status.req)); - /* fill command */ - preq->body.get_tune_status.req.proc_id = - cpu_to_le16(CONTROL_PROC_GETTUNESTAT); + /* fill command */ + preq->body.get_tune_status.req.proc_id = + cpu_to_le16(CONTROL_PROC_GETTUNESTAT); - /* send command */ - if (phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd( + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd( phandle, (uint8_t *) preq, sizeof(preq->body.get_tune_status.req) + HEADER_SIZE, (uint8_t *) prsp, sizeof(prsp->body.get_tune_status.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + } else { + error = AS10X_CMD_ERROR; + } - if (error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP); - if (error < 0) { - goto out; - } + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTUNESTAT_RSP); + if (error < 0) + goto out; - /* Response OK -> get response data */ - pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state; - pstatus->signal_strength = - le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength); - pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER); - pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER); + /* Response OK -> get response data */ + pstatus->tune_state = prsp->body.get_tune_status.rsp.sts.tune_state; + pstatus->signal_strength = + le16_to_cpu(prsp->body.get_tune_status.rsp.sts.signal_strength); + pstatus->PER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.PER); + pstatus->BER = le16_to_cpu(prsp->body.get_tune_status.rsp.sts.BER); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -260,56 +262,58 @@ */ int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps) { + int error; + struct as10x_cmd_t *pcmd, *prsp; - int error; - struct as10x_cmd_t *pcmd, *prsp; + ENTER(); - ENTER(); + pcmd = phandle->cmd; + prsp = phandle->rsp; - pcmd = phandle->cmd; - prsp = phandle->rsp; + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_tps.req)); - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid),sizeof(pcmd->body.get_tps.req)); + /* fill command */ + pcmd->body.get_tune_status.req.proc_id = + cpu_to_le16(CONTROL_PROC_GETTPS); - /* fill command */ - pcmd->body.get_tune_status.req.proc_id = cpu_to_le16(CONTROL_PROC_GETTPS); + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_tps.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_tps.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, sizeof(pcmd->body.get_tps.req) + HEADER_SIZE, - (uint8_t *) prsp, sizeof(prsp->body.get_tps.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + if (error < 0) + goto out; - if(error < 0) { - goto out; - } + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP); + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_GETTPS_RSP); - if (error < 0) { - goto out; - } - - /* Response OK -> get response data */ - ptps->constellation = prsp->body.get_tps.rsp.tps.constellation; - ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy; - ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode; - ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP; - ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP; - ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval; - ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode; - ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP; - ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP; - ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID); + /* Response OK -> get response data */ + ptps->constellation = prsp->body.get_tps.rsp.tps.constellation; + ptps->hierarchy = prsp->body.get_tps.rsp.tps.hierarchy; + ptps->interleaving_mode = prsp->body.get_tps.rsp.tps.interleaving_mode; + ptps->code_rate_HP = prsp->body.get_tps.rsp.tps.code_rate_HP; + ptps->code_rate_LP = prsp->body.get_tps.rsp.tps.code_rate_LP; + ptps->guard_interval = prsp->body.get_tps.rsp.tps.guard_interval; + ptps->transmission_mode = prsp->body.get_tps.rsp.tps.transmission_mode; + ptps->DVBH_mask_HP = prsp->body.get_tps.rsp.tps.DVBH_mask_HP; + ptps->DVBH_mask_LP = prsp->body.get_tps.rsp.tps.DVBH_mask_LP; + ptps->cell_ID = le16_to_cpu(prsp->body.get_tps.rsp.tps.cell_ID); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -322,59 +326,58 @@ int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, struct as10x_demod_stats *pdemod_stats) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.get_demod_stats.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_demod_stats.req)); - /* fill command */ - pcmd->body.get_demod_stats.req.proc_id = - cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); + /* fill command */ + pcmd->body.get_demod_stats.req.proc_id = + cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.get_demod_stats.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.get_demod_stats.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_demod_stats.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_demod_stats.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_DEMOD_STATS_RSP); - if (error < 0) { - goto out; - } + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_DEMOD_STATS_RSP); + if (error < 0) + goto out; - /* Response OK -> get response data */ - pdemod_stats->frame_count = - le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count); - pdemod_stats->bad_frame_count = - le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count); - pdemod_stats->bytes_fixed_by_rs = - le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs); - pdemod_stats->mer = - le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer); - pdemod_stats->has_started = - prsp->body.get_demod_stats.rsp.stats.has_started; + /* Response OK -> get response data */ + pdemod_stats->frame_count = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.frame_count); + pdemod_stats->bad_frame_count = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bad_frame_count); + pdemod_stats->bytes_fixed_by_rs = + le32_to_cpu(prsp->body.get_demod_stats.rsp.stats.bytes_fixed_by_rs); + pdemod_stats->mer = + le16_to_cpu(prsp->body.get_demod_stats.rsp.stats.mer); + pdemod_stats->has_started = + prsp->body.get_demod_stats.rsp.stats.has_started; out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -388,50 +391,49 @@ int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, uint8_t *is_ready) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.get_impulse_rsp.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.get_impulse_rsp.req)); - /* fill command */ - pcmd->body.get_impulse_rsp.req.proc_id = - cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); + /* fill command */ + pcmd->body.get_impulse_rsp.req.proc_id = + cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.get_impulse_rsp.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.get_impulse_rsp.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.get_impulse_rsp.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.get_impulse_rsp.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp,CONTROL_PROC_GET_IMPULSE_RESP_RSP); - if (error < 0) { - goto out; - } + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_GET_IMPULSE_RESP_RSP); + if (error < 0) + goto out; - /* Response OK -> get response data */ - *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready; + /* Response OK -> get response data */ + *is_ready = prsp->body.get_impulse_rsp.rsp.is_ready; out: - LEAVE(); - return(error); + LEAVE(); + return error; } @@ -447,10 +449,10 @@ void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t xid, uint16_t cmd_len) { - pcmd->header.req_id = cpu_to_le16(xid); - pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID); - pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION); - pcmd->header.data_len = cpu_to_le16(cmd_len); + pcmd->header.req_id = cpu_to_le16(xid); + pcmd->header.prog = cpu_to_le16(SERVICE_PROG_ID); + pcmd->header.version = cpu_to_le16(SERVICE_PROG_VERSION); + pcmd->header.data_len = cpu_to_le16(cmd_len); } /** @@ -463,16 +465,17 @@ */ int as10x_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) { - int error; + int error; - /* extract command error code */ - error = prsp->body.common.rsp.error; + /* extract command error code */ + error = prsp->body.common.rsp.error; - if((error == 0) && (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) { - return 0; - } + if ((error == 0) && + (le16_to_cpu(prsp->body.common.rsp.proc_id) == proc_id)) { + return 0; + } - return AS10X_CMD_ERROR; + return AS10X_CMD_ERROR; } ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH v3 4/14] staging/media/as102: checkpatch fixes 2011-10-30 7:11 ` [PATCH v3 " Piotr Chmura @ 2011-10-30 11:17 ` Stefan Richter 2011-10-31 10:48 ` Stefan Richter 0 siblings, 1 reply; 91+ messages in thread From: Stefan Richter @ 2011-10-30 11:17 UTC (permalink / raw) To: Piotr Chmura Cc: Sylwester Nawrocki, Mauro Carvalho Chehab, Devin Heitmueller, Greg KH, Patrick Dickey, LMML, devel On Oct 30 Piotr Chmura wrote: > Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ > > Original source and comment: > # HG changeset patch > # User Devin Heitmueller <dheitmueller@kernellabs.com> > # Date 1267318701 18000 > # Node ID 69c8f5172790784738bcc18f8301919ef3d5373f > # Parent b91e96a07bee27c1d421b4c3702e33ee8075de83 > as102: checkpatch fixes > > From: Devin Heitmueller <dheitmueller@kernellabs.com> > > Fix make checkpatch issues reported against as10x_cmd.c. > > Priority: normal > > Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> > Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> > ---- > Added missing empty lines at end of patch > > Sylwester could you check if it applies cleanly now ? > > > diff --git linux/drivers/staging/media/as102/as10x_cmd.c linuxb/drivers/staging/media/as102/as10x_cmd.c > --- linux/drivers/staging/media/as102/as10x_cmd.c > +++ linuxb/drivers/staging/media/as102/as10x_cmd.c [...] "man git-am" says: "'From: ' [...] lines *starting* the body override the respective commit author name and title values taken from the headers." (Emphasis mine.) So, if the author field of the commit is meant to be set to Devin Heitmueller, the line "From: Devin [...]" needs to be placed as the first body of the mail message body. Or more correctly spoken, lines in a format like RFC 2822 mail headers may appear in the mail body and are recognized by "git am" as input for commit metadata - if they are "From: ", "Subject: ", or "Date: " header-like lines, - if they appear before any other kinds of lines of the mail body. A pro pos, it would be good to not only preserve author name and address that way, but also authorship date. I.e. if possible transform the line "# Date 1267318701 18000" into an RFC 2822 date-header like line and put it together with the From: line at the beginning of the body. I am not sure which date-time specification formats "git am" understands, but at least the one per RFC 2822 clause 3.3 works. The date thing would be icing on the cake. In current practice, not many kernel developers who forward patches by mail seem to be aware of it. On the rest of the changelog, the part that you added: - The URL of the original repo was of some interest in the first patch which adds all the entire driver. But it is hardly interesting in a checkpatch cleanup. - The information that this was once a HG changeset (before it became a mailed patch and hopefully eventually becomes a git commit...) as well as the original commit ID and parent commit ID are not of interest for the git changelog. On the rest of the changelog, the part written by Devin: - Well, that doesn't say a lot. /What/ kinds of checkpatch issues were "fixed", and why? In my opinion, the fact that a certain script called checkpatch was involved at all is one of the last interesting facts about this change. There was nothing "fixed" here. From a quick look at it, this patch reformats whitespace and changes perhaps some other code formatting to bring it closer to normal Linux code format. - We don't have "Priority" lines in mainline changelogs. However, since the kind of changes done in this patch appears to be mostly or entirely trivial, it is not a drama to have a less than perfect changelog (to say it mildly). But please consider for future contributions: When writing a changelog always describe the reason or impact of the change. E.g. here whitespace changes (and more?) without (?) change of functionality (without change of generated machine code even?). --- This criticism goes primarily to Devin, but also to Piotr who had the chance to improve the changelog. A very brief guide about good changelogs can be found in Andrew Morton's "The Perfect Patch", e.g. http://kerneltrap.org/node/3737. It takes a bit of consideration how to apply it to a patch like this one though. Hint: The answer to "why the kernel needed patching" in this case is *not* "because checkpatch told so". ;-) Take this criticism of the changelog not as a request to change this particular one, but as something to keep in mind in future contributions. On the part after changelog, before the diff: - The delimiter is supposed to be *three* dashes, immediately followed by end-of-line, not four dashes. See "man git-am" for lines that are recognized as beginning the patch == ending the changelog. - Please always insert a diffstat here. This is a help to anybody wanting to review or handle a patch posting. On the diff: - In typical patches which only touch a small part of a file, it is very important to generate the patch like "diff --show-c-function [...]" a.k.a. "diff -p [...]" would do. While this information is ignored by any tool which applies the patch, it highly increases the human- readability of the diff. Of course in this patch here which changes almost the entire file, this bit is not important for readability. But keep it in mind for future patch postings. -- Stefan Richter -=====-==-== =-=- ====- http://arcgraph.de/sr/ ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH v3 4/14] staging/media/as102: checkpatch fixes 2011-10-30 11:17 ` Stefan Richter @ 2011-10-31 10:48 ` Stefan Richter 2011-10-31 11:47 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 91+ messages in thread From: Stefan Richter @ 2011-10-31 10:48 UTC (permalink / raw) To: Piotr Chmura Cc: Sylwester Nawrocki, Mauro Carvalho Chehab, Devin Heitmueller, Greg KH, Patrick Dickey, LMML, devel > On Oct 30 Piotr Chmura wrote: >> Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ >> >> Original source and comment: >> # HG changeset patch By the way, the brand new git 1.7.8.rc0 features some HG support in "git am": https://code.google.com/p/git-core/source/detail?spec=svnbe3fa9125e708348c7baf04ebe9507a72a9d1800&r=0cfd112032017ab68ed576f6bb5258452084ebf1 This converts the "# User" and "# Date" lines of HG patches into RFC 2822 "From: " and "Date: " lines which are then used as authorship metadata. -- Stefan Richter -=====-==-== =-=- ===== http://arcgraph.de/sr/ ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [PATCH v3 4/14] staging/media/as102: checkpatch fixes 2011-10-31 10:48 ` Stefan Richter @ 2011-10-31 11:47 ` Mauro Carvalho Chehab 0 siblings, 0 replies; 91+ messages in thread From: Mauro Carvalho Chehab @ 2011-10-31 11:47 UTC (permalink / raw) To: Stefan Richter Cc: Piotr Chmura, Sylwester Nawrocki, Devin Heitmueller, Greg KH, Patrick Dickey, LMML, devel Em 31-10-2011 08:48, Stefan Richter escreveu: >> On Oct 30 Piotr Chmura wrote: >>> Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ >>> >>> Original source and comment: >>> # HG changeset patch > > By the way, the brand new git 1.7.8.rc0 features some HG support in "git am": > https://code.google.com/p/git-core/source/detail?spec=svnbe3fa9125e708348c7baf04ebe9507a72a9d1800&r=0cfd112032017ab68ed576f6bb5258452084ebf1 > > This converts the "# User" and "# Date" lines of HG patches into RFC 2822 > "From: " and "Date: " lines which are then used as authorship metadata. hg headers are fine. As we moved from hg a few years, the scripts I use here already handles hg headers, converting them to rfc-2822 (it also does other neat things like calling checkpatch.pl ;) ). Cheers, Mauro ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 4/14] staging/media/as102: checkpatch fixes 2011-10-29 13:17 ` Piotr Chmura 2011-10-29 16:14 ` Sylwester Nawrocki @ 2011-10-29 16:25 ` Piotr Chmura 2011-10-29 16:39 ` Sylwester Nawrocki 1 sibling, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-29 16:25 UTC (permalink / raw) To: Sylwester Nawrocki Cc: Mauro Carvalho Chehab, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel W dniu 29.10.2011 15:17, Piotr Chmura pisze: > > > W dniu 29.10.2011 12:22, Sylwester Nawrocki pisze: >> On 10/18/2011 09:51 PM, Piotr Chmura wrote: >>> Patch taken from >>> http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ >>> >>> Original source and comment: >>> # HG changeset patch >>> # User Devin Heitmueller<dheitmueller@kernellabs.com> >>> # Date 1267318701 18000 >>> # Node ID 69c8f5172790784738bcc18f8301919ef3d5373f >>> # Parent b91e96a07bee27c1d421b4c3702e33ee8075de83 >>> as102: checkpatch fixes >>> >>> From: Devin Heitmueller<dheitmueller@kernellabs.com> >>> >>> Fix make checkpatch issues reported against as10x_cmd.c. >>> >>> Priority: normal >>> >>> Signed-off-by: Devin Heitmueller<dheitmueller@kernellabs.com> >>> Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> >> Hi Piotr, >> >> starting from this patch the series doesn't apply cleanly to >> staging/for_v3.2 tree. Which branch is it based on ? >> >> --- >> Thanks, >> Sylwester > Hi Sylwester, > > I'is based on > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git > kernel-3.1.0-git9+ > > All patches are working on newly created driver directory > drivers/staging/media/as102 (exception is 13/14: staging/Makefile and > staging/Kconfig) and they apply cleanly in my tree. Let me know why > they doesn't on yours and i'll try to fix them. One more thing... patches starting from 4/14 in patchwork have "To unsubscribe from this list: send the line "unsubscribe linux-media" in..." on the end. Isn't this making them wrong ? Peter ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 4/14] staging/media/as102: checkpatch fixes 2011-10-29 16:25 ` [RESEND PATCH " Piotr Chmura @ 2011-10-29 16:39 ` Sylwester Nawrocki 2011-10-29 17:00 ` Dan Carpenter 0 siblings, 1 reply; 91+ messages in thread From: Sylwester Nawrocki @ 2011-10-29 16:39 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel On 10/29/2011 06:25 PM, Piotr Chmura wrote: > > W dniu 29.10.2011 15:17, Piotr Chmura pisze: >> >> W dniu 29.10.2011 12:22, Sylwester Nawrocki pisze: >>> On 10/18/2011 09:51 PM, Piotr Chmura wrote: >>>> Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ >>>> >>>> Original source and comment: >>>> # HG changeset patch >>>> # User Devin Heitmueller<dheitmueller@kernellabs.com> >>>> # Date 1267318701 18000 >>>> # Node ID 69c8f5172790784738bcc18f8301919ef3d5373f >>>> # Parent b91e96a07bee27c1d421b4c3702e33ee8075de83 >>>> as102: checkpatch fixes >>>> >>>> From: Devin Heitmueller<dheitmueller@kernellabs.com> >>>> >>>> Fix make checkpatch issues reported against as10x_cmd.c. >>>> >>>> Priority: normal >>>> >>>> Signed-off-by: Devin Heitmueller<dheitmueller@kernellabs.com> >>>> Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> >>> Hi Piotr, >>> >>> starting from this patch the series doesn't apply cleanly to >>> staging/for_v3.2 tree. Which branch is it based on ? >>> >>> --- >>> Thanks, >>> Sylwester >> Hi Sylwester, >> >> I'is based on >> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git kernel-3.1.0-git9+ >> >> All patches are working on newly created driver directory drivers/staging/media/as102 >> (exception is 13/14: staging/Makefile and staging/Kconfig) and they apply cleanly in >> my tree. Let me know why they doesn't on yours and i'll try to fix them. > One more thing... patches starting from 4/14 in patchwork have > > "To unsubscribe from this list: send the line "unsubscribe linux-media" in..." > > on the end. > > Isn't this making them wrong ? This shouldn't be an issue, I've also used patches saved directly form an e-mail client which didn't have this text appended and the patch didn't apply in same way. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 4/14] staging/media/as102: checkpatch fixes 2011-10-29 16:39 ` Sylwester Nawrocki @ 2011-10-29 17:00 ` Dan Carpenter 0 siblings, 0 replies; 91+ messages in thread From: Dan Carpenter @ 2011-10-29 17:00 UTC (permalink / raw) To: Sylwester Nawrocki Cc: Piotr Chmura, devel, Mauro Carvalho Chehab, Patrick Dickey, Greg KH, Stefan Richter, Devin Heitmueller, LMML On Sat, Oct 29, 2011 at 06:39:54PM +0200, Sylwester Nawrocki wrote: > >> Hi Sylwester, > >> > >> I'is based on > >> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git kernel-3.1.0-git9+ > >> > >> All patches are working on newly created driver directory drivers/staging/media/as102 > >> (exception is 13/14: staging/Makefile and staging/Kconfig) and they apply cleanly in > >> my tree. Let me know why they doesn't on yours and i'll try to fix them. > > One more thing... patches starting from 4/14 in patchwork have > > > > "To unsubscribe from this list: send the line "unsubscribe linux-media" in..." > > > > on the end. > > > > Isn't this making them wrong ? > > This shouldn't be an issue, I've also used patches saved directly form an e-mail client > which didn't have this text appended and the patch didn't apply in same way. I get this error when I try apply them. patching file drivers/staging/media/as102/as10x_cmd.c patch: **** malformed patch at line 696: _______________________________________________ I'm applying with "patch" not with "git am". regards, dan carpenter ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 5/14] staging/media/as102: checkpatch fixes [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> ` (3 preceding siblings ...) 2011-10-18 9:11 ` [PATCH 4/14] " Piotr Chmura @ 2011-10-18 9:11 ` Piotr Chmura 2011-10-18 19:54 ` [RESEND PATCH " Piotr Chmura 2011-10-18 9:12 ` [PATCH 6/14] " Piotr Chmura ` (8 subsequent siblings) 13 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:11 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318751 18000 # Node ID 1ccb2e0adbf02a111decf8a4c78e93f4354e2bd2 # Parent 69c8f5172790784738bcc18f8301919ef3d5373f as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as10x_cmd_stream.c. Priority: normal Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> diff --git linux/drivers/staging/media/as102/as10x_cmd_stream.c linuxb/drivers/media/dvb/as102/as10x_cmd_stream.c --- linux/drivers/staging/media/as102/as10x_cmd_stream.c +++ linuxb/drivers/staging/media/as102/as10x_cmd_stream.c @@ -2,8 +2,6 @@ \file as10x_cmd_stream.c - \version $Id$ - \author: S. Martinelli ----------------------------------------------------------------------------\n @@ -53,57 +51,57 @@ \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_add_PID_filter(as10x_handle_t* phandle, - struct as10x_ts_filter *filter) { - int error; - struct as10x_cmd_t *pcmd, *prsp; +int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, + struct as10x_ts_filter *filter) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.add_pid_filter.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.add_pid_filter.req)); - /* fill command */ - pcmd->body.add_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_SETFILTER); - pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid); - pcmd->body.add_pid_filter.req.stream_type = filter->type; + /* fill command */ + pcmd->body.add_pid_filter.req.proc_id = + cpu_to_le16(CONTROL_PROC_SETFILTER); + pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid); + pcmd->body.add_pid_filter.req.stream_type = filter->type; - if(filter->idx < 16) - pcmd->body.add_pid_filter.req.idx = filter->idx; - else - pcmd->body.add_pid_filter.req.idx = 0xFF; + if (filter->idx < 16) + pcmd->body.add_pid_filter.req.idx = filter->idx; + else + pcmd->body.add_pid_filter.req.idx = 0xFF; - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.add_pid_filter.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.add_pid_filter.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.add_pid_filter.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.add_pid_filter.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP); - if(error == 0) { - /* Response OK -> get response data */ - filter->idx = prsp->body.add_pid_filter.rsp.filter_id; - } + if (error == 0) { + /* Response OK -> get response data */ + filter->idx = prsp->body.add_pid_filter.rsp.filter_id; + } out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -113,144 +111,138 @@ \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_del_PID_filter(as10x_handle_t* phandle, +int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, uint16_t pid_value) { + int error; + struct as10x_cmd_t *pcmd, *prsp; - int error; - struct as10x_cmd_t *pcmd, *prsp; + ENTER(); - ENTER(); + pcmd = phandle->cmd; + prsp = phandle->rsp; - pcmd = phandle->cmd; - prsp = phandle->rsp; + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.del_pid_filter.req)); - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.del_pid_filter.req)); + /* fill command */ + pcmd->body.del_pid_filter.req.proc_id = + cpu_to_le16(CONTROL_PROC_REMOVEFILTER); + pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value); - /* fill command */ - pcmd->body.del_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_REMOVEFILTER); - pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value); + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.del_pid_filter.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.del_pid_filter.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - /* send command */ - if(phandle->ops->xfer_cmd){ - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.del_pid_filter.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.del_pid_filter.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + if (error < 0) + goto out; - if(error < 0) { - goto out; - } - - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_REMOVEFILTER_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_REMOVEFILTER_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** \brief Send start streaming command to AS10x \param phandle: pointer to AS10x handle - \return 0 when no error, < 0 in case of error._ + \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_start_streaming(as10x_handle_t* phandle) +int as10x_cmd_start_streaming(as10x_handle_t *phandle) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.start_streaming.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.start_streaming.req)); - /* fill command */ - pcmd->body.start_streaming.req.proc_id = - cpu_to_le16(CONTROL_PROC_START_STREAMING); + /* fill command */ + pcmd->body.start_streaming.req.proc_id = + cpu_to_le16(CONTROL_PROC_START_STREAMING); - /* send command */ - if(phandle->ops->xfer_cmd){ - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.start_streaming.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.start_streaming.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.start_streaming.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.start_streaming.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_START_STREAMING_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_START_STREAMING_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** \brief Send stop streaming command to AS10x \param phandle: pointer to AS10x handle - \return 0 when no error, < 0 in case of error._ + \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_stop_streaming(as10x_handle_t* phandle) +int as10x_cmd_stop_streaming(as10x_handle_t *phandle) { - int8_t error; - struct as10x_cmd_t *pcmd, *prsp; + int8_t error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.stop_streaming.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.stop_streaming.req)); - /* fill command */ - pcmd->body.stop_streaming.req.proc_id = - cpu_to_le16(CONTROL_PROC_STOP_STREAMING); + /* fill command */ + pcmd->body.stop_streaming.req.proc_id = + cpu_to_le16(CONTROL_PROC_STOP_STREAMING); - /* send command */ - if(phandle->ops->xfer_cmd){ - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.stop_streaming.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.stop_streaming.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.stop_streaming.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.stop_streaming.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_STOP_STREAMING_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_STOP_STREAMING_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } ^ permalink raw reply [flat|nested] 91+ messages in thread
* [RESEND PATCH 5/14] staging/media/as102: checkpatch fixes 2011-10-18 9:11 ` [PATCH 5/14] " Piotr Chmura @ 2011-10-18 19:54 ` Piotr Chmura 2011-10-30 13:53 ` [PATCH v3 " Piotr Chmura 0 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 19:54 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318751 18000 # Node ID 1ccb2e0adbf02a111decf8a4c78e93f4354e2bd2 # Parent 69c8f5172790784738bcc18f8301919ef3d5373f as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as10x_cmd_stream.c. Priority: normal Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff --git linux/drivers/staging/media/as102/as10x_cmd_stream.c linuxb/drivers/staging/media/as102/as10x_cmd_stream.c --- linux/drivers/staging/media/as102/as10x_cmd_stream.c +++ linuxb/drivers/staging/media/as102/as10x_cmd_stream.c @@ -2,8 +2,6 @@ \file as10x_cmd_stream.c - \version $Id$ - \author: S. Martinelli ----------------------------------------------------------------------------\n @@ -53,57 +51,57 @@ \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_add_PID_filter(as10x_handle_t* phandle, - struct as10x_ts_filter *filter) { - int error; - struct as10x_cmd_t *pcmd, *prsp; +int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, + struct as10x_ts_filter *filter) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.add_pid_filter.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.add_pid_filter.req)); - /* fill command */ - pcmd->body.add_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_SETFILTER); - pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid); - pcmd->body.add_pid_filter.req.stream_type = filter->type; + /* fill command */ + pcmd->body.add_pid_filter.req.proc_id = + cpu_to_le16(CONTROL_PROC_SETFILTER); + pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid); + pcmd->body.add_pid_filter.req.stream_type = filter->type; - if(filter->idx < 16) - pcmd->body.add_pid_filter.req.idx = filter->idx; - else - pcmd->body.add_pid_filter.req.idx = 0xFF; + if (filter->idx < 16) + pcmd->body.add_pid_filter.req.idx = filter->idx; + else + pcmd->body.add_pid_filter.req.idx = 0xFF; - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.add_pid_filter.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.add_pid_filter.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.add_pid_filter.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.add_pid_filter.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP); - if(error == 0) { - /* Response OK -> get response data */ - filter->idx = prsp->body.add_pid_filter.rsp.filter_id; - } + if (error == 0) { + /* Response OK -> get response data */ + filter->idx = prsp->body.add_pid_filter.rsp.filter_id; + } out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -113,144 +111,138 @@ \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_del_PID_filter(as10x_handle_t* phandle, +int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, uint16_t pid_value) { + int error; + struct as10x_cmd_t *pcmd, *prsp; - int error; - struct as10x_cmd_t *pcmd, *prsp; + ENTER(); - ENTER(); + pcmd = phandle->cmd; + prsp = phandle->rsp; - pcmd = phandle->cmd; - prsp = phandle->rsp; + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.del_pid_filter.req)); - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.del_pid_filter.req)); + /* fill command */ + pcmd->body.del_pid_filter.req.proc_id = + cpu_to_le16(CONTROL_PROC_REMOVEFILTER); + pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value); - /* fill command */ - pcmd->body.del_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_REMOVEFILTER); - pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value); + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.del_pid_filter.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.del_pid_filter.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - /* send command */ - if(phandle->ops->xfer_cmd){ - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.del_pid_filter.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.del_pid_filter.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + if (error < 0) + goto out; - if(error < 0) { - goto out; - } - - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_REMOVEFILTER_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_REMOVEFILTER_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** \brief Send start streaming command to AS10x \param phandle: pointer to AS10x handle - \return 0 when no error, < 0 in case of error._ + \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_start_streaming(as10x_handle_t* phandle) +int as10x_cmd_start_streaming(as10x_handle_t *phandle) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.start_streaming.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.start_streaming.req)); - /* fill command */ - pcmd->body.start_streaming.req.proc_id = - cpu_to_le16(CONTROL_PROC_START_STREAMING); + /* fill command */ + pcmd->body.start_streaming.req.proc_id = + cpu_to_le16(CONTROL_PROC_START_STREAMING); - /* send command */ - if(phandle->ops->xfer_cmd){ - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.start_streaming.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.start_streaming.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.start_streaming.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.start_streaming.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_START_STREAMING_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_START_STREAMING_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** \brief Send stop streaming command to AS10x \param phandle: pointer to AS10x handle - \return 0 when no error, < 0 in case of error._ + \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_stop_streaming(as10x_handle_t* phandle) +int as10x_cmd_stop_streaming(as10x_handle_t *phandle) { - int8_t error; - struct as10x_cmd_t *pcmd, *prsp; + int8_t error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.stop_streaming.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.stop_streaming.req)); - /* fill command */ - pcmd->body.stop_streaming.req.proc_id = - cpu_to_le16(CONTROL_PROC_STOP_STREAMING); + /* fill command */ + pcmd->body.stop_streaming.req.proc_id = + cpu_to_le16(CONTROL_PROC_STOP_STREAMING); - /* send command */ - if(phandle->ops->xfer_cmd){ - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.stop_streaming.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.stop_streaming.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.stop_streaming.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.stop_streaming.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_STOP_STREAMING_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_STOP_STREAMING_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH v3 5/14] staging/media/as102: checkpatch fixes 2011-10-18 19:54 ` [RESEND PATCH " Piotr Chmura @ 2011-10-30 13:53 ` Piotr Chmura 0 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-30 13:53 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel From: Devin Heitmueller <dheitmueller@kernellabs.com> Reformats as10x_cmd_stream.c to take it closer to linux format code. Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> --- v3: added missing empty lines on end of patch. diff --git linux/drivers/staging/media/as102/as10x_cmd_stream.c linuxb/drivers/staging/media/as102/as10x_cmd_stream.c --- linux/drivers/staging/media/as102/as10x_cmd_stream.c +++ linuxb/drivers/staging/media/as102/as10x_cmd_stream.c @@ -2,8 +2,6 @@ \file as10x_cmd_stream.c - \version $Id$ - \author: S. Martinelli ----------------------------------------------------------------------------\n @@ -53,57 +51,57 @@ \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_add_PID_filter(as10x_handle_t* phandle, - struct as10x_ts_filter *filter) { - int error; - struct as10x_cmd_t *pcmd, *prsp; +int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, + struct as10x_ts_filter *filter) +{ + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.add_pid_filter.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.add_pid_filter.req)); - /* fill command */ - pcmd->body.add_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_SETFILTER); - pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid); - pcmd->body.add_pid_filter.req.stream_type = filter->type; + /* fill command */ + pcmd->body.add_pid_filter.req.proc_id = + cpu_to_le16(CONTROL_PROC_SETFILTER); + pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid); + pcmd->body.add_pid_filter.req.stream_type = filter->type; - if(filter->idx < 16) - pcmd->body.add_pid_filter.req.idx = filter->idx; - else - pcmd->body.add_pid_filter.req.idx = 0xFF; + if (filter->idx < 16) + pcmd->body.add_pid_filter.req.idx = filter->idx; + else + pcmd->body.add_pid_filter.req.idx = 0xFF; - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.add_pid_filter.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.add_pid_filter.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.add_pid_filter.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.add_pid_filter.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP); - if(error == 0) { - /* Response OK -> get response data */ - filter->idx = prsp->body.add_pid_filter.rsp.filter_id; - } + if (error == 0) { + /* Response OK -> get response data */ + filter->idx = prsp->body.add_pid_filter.rsp.filter_id; + } out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -113,144 +111,138 @@ \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_del_PID_filter(as10x_handle_t* phandle, +int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, uint16_t pid_value) { + int error; + struct as10x_cmd_t *pcmd, *prsp; - int error; - struct as10x_cmd_t *pcmd, *prsp; + ENTER(); - ENTER(); + pcmd = phandle->cmd; + prsp = phandle->rsp; - pcmd = phandle->cmd; - prsp = phandle->rsp; + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.del_pid_filter.req)); - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.del_pid_filter.req)); + /* fill command */ + pcmd->body.del_pid_filter.req.proc_id = + cpu_to_le16(CONTROL_PROC_REMOVEFILTER); + pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value); - /* fill command */ - pcmd->body.del_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_REMOVEFILTER); - pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value); + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.del_pid_filter.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.del_pid_filter.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - /* send command */ - if(phandle->ops->xfer_cmd){ - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.del_pid_filter.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.del_pid_filter.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + if (error < 0) + goto out; - if(error < 0) { - goto out; - } - - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_REMOVEFILTER_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_REMOVEFILTER_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** \brief Send start streaming command to AS10x \param phandle: pointer to AS10x handle - \return 0 when no error, < 0 in case of error. + \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_start_streaming(as10x_handle_t* phandle) +int as10x_cmd_start_streaming(as10x_handle_t *phandle) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.start_streaming.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.start_streaming.req)); - /* fill command */ - pcmd->body.start_streaming.req.proc_id = - cpu_to_le16(CONTROL_PROC_START_STREAMING); + /* fill command */ + pcmd->body.start_streaming.req.proc_id = + cpu_to_le16(CONTROL_PROC_START_STREAMING); - /* send command */ - if(phandle->ops->xfer_cmd){ - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.start_streaming.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.start_streaming.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.start_streaming.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.start_streaming.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_START_STREAMING_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_START_STREAMING_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** \brief Send stop streaming command to AS10x \param phandle: pointer to AS10x handle - \return 0 when no error, < 0 in case of error. + \return 0 when no error, < 0 in case of error. \callgraph */ -int as10x_cmd_stop_streaming(as10x_handle_t* phandle) +int as10x_cmd_stop_streaming(as10x_handle_t *phandle) { - int8_t error; - struct as10x_cmd_t *pcmd, *prsp; + int8_t error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.stop_streaming.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.stop_streaming.req)); - /* fill command */ - pcmd->body.stop_streaming.req.proc_id = - cpu_to_le16(CONTROL_PROC_STOP_STREAMING); + /* fill command */ + pcmd->body.stop_streaming.req.proc_id = + cpu_to_le16(CONTROL_PROC_STOP_STREAMING); - /* send command */ - if(phandle->ops->xfer_cmd){ - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.stop_streaming.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.stop_streaming.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.stop_streaming.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.stop_streaming.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_STOP_STREAMING_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_STOP_STREAMING_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 6/14] staging/media/as102: checkpatch fixes [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> ` (4 preceding siblings ...) 2011-10-18 9:11 ` [PATCH 5/14] " Piotr Chmura @ 2011-10-18 9:12 ` Piotr Chmura 2011-10-18 19:56 ` [RESEND PATCH " Piotr Chmura 2011-10-18 9:12 ` [PATCH 7/14] " Piotr Chmura ` (7 subsequent siblings) 13 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:12 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318799 18000 # Node ID 5916edd6739e9b8e02ff8a1e93161c4d23b50b3e # Parent 1ccb2e0adbf02a111decf8a4c78e93f4354e2bd2 as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as102_fe.c. Priority: normal Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> diff --git linux/drivers/staging/media/as102/as102_fe.c linuxb/drivers/media/dvb/as102/as102_fe.c --- linux/drivers/staging/media/as102/as102_fe.c +++ linuxb/drivers/staging/media/as102/as102_fe.c @@ -1,6 +1,7 @@ /* * Abilis Systems Single DVB-T Receiver * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,12 +32,14 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst, struct dvb_frontend_parameters *src); -static void as102_fe_release(struct dvb_frontend *fe) { +static void as102_fe_release(struct dvb_frontend *fe) +{ struct as102_dev_t *dev; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) @@ -64,13 +67,15 @@ } #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) -static int as102_fe_init(struct dvb_frontend *fe) { +static int as102_fe_init(struct dvb_frontend *fe) +{ int ret = 0; struct as102_dev_t *dev; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; if (mutex_lock_interruptible(&dev->bus_adap.lock)) @@ -90,14 +95,16 @@ #endif static int as102_fe_set_frontend(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) { + struct dvb_frontend_parameters *params) +{ int ret = 0; struct as102_dev_t *dev; struct as10x_tune_args tune_args = { 0 }; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; if (mutex_lock_interruptible(&dev->bus_adap.lock)) @@ -107,9 +114,8 @@ /* send abilis command: SET_TUNE */ ret = as10x_cmd_set_tune(&dev->bus_adap, &tune_args); - if(ret != 0) { + if (ret != 0) dprintk(debug, "as10x_cmd_set_tune failed. (err = %d)\n", ret); - } mutex_unlock(&dev->bus_adap.lock); @@ -117,7 +123,7 @@ return (ret < 0) ? -EINVAL : 0; } -static int as102_fe_get_frontend(struct dvb_frontend* fe, +static int as102_fe_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) { int ret = 0; struct as102_dev_t *dev; @@ -125,7 +131,8 @@ ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -EINVAL; if (mutex_lock_interruptible(&dev->bus_adap.lock)) @@ -150,7 +157,8 @@ #if 0 dprintk(debug, "step_size = %d\n", settings->step_size); dprintk(debug, "max_drift = %d\n", settings->max_drift); - dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms, 1000); + dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms, + 1000); #endif settings->min_delay_ms = 1000; @@ -160,14 +168,16 @@ } -static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) { +static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) +{ int ret = 0; struct as102_dev_t *dev; struct as10x_tune_status tstate = { 0 }; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; if (mutex_lock_interruptible(&dev->bus_adap.lock)) @@ -176,48 +186,47 @@ /* send abilis command: GET_TUNE_STATUS */ ret = as10x_cmd_get_tune_status(&dev->bus_adap, &tstate); if (ret < 0) { - dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n", ret); + dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n", + ret); goto out; } dev->signal_strength = tstate.signal_strength; dev->ber = tstate.BER; - switch(tstate.tune_state) { - case TUNE_STATUS_SIGNAL_DVB_OK: - *status = FE_HAS_SIGNAL | - FE_HAS_CARRIER; - break; - case TUNE_STATUS_STREAM_DETECTED: - *status = FE_HAS_SIGNAL | - FE_HAS_CARRIER | - FE_HAS_SYNC; - break; - case TUNE_STATUS_STREAM_TUNED: - *status = FE_HAS_SIGNAL | - FE_HAS_CARRIER | - FE_HAS_SYNC | - FE_HAS_LOCK; - break; - default: - *status = TUNE_STATUS_NOT_TUNED; + switch (tstate.tune_state) { + case TUNE_STATUS_SIGNAL_DVB_OK: + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER; + break; + case TUNE_STATUS_STREAM_DETECTED: + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC; + break; + case TUNE_STATUS_STREAM_TUNED: + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC | + FE_HAS_LOCK; + break; + default: + *status = TUNE_STATUS_NOT_TUNED; } - dprintk(debug, "tuner status: 0x%02x , strength %d , per: %d , ber: %d\n", + dprintk(debug, "tuner status: 0x%02x, strength %d, per: %d, ber: %d\n", tstate.tune_state, tstate.signal_strength, tstate.PER, tstate.BER); if (*status & FE_HAS_LOCK) { if (as10x_cmd_get_demod_stats(&dev->bus_adap, - (struct as10x_demod_stats *) &dev->demod_stats) < 0) { + (struct as10x_demod_stats *) &dev->demod_stats) < 0) { memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); - dprintk(debug, "as10x_cmd_get_demod_stats failed (probably not tuned)\n"); + dprintk(debug, "as10x_cmd_get_demod_stats failed " + "(probably not tuned)\n"); } else { - dprintk(debug, "demod status: fc: 0x%08x , bad fc: 0x%08x , bytes corrected: 0x%08x , MER: 0x%04x\n", - dev->demod_stats.frame_count, - dev->demod_stats.bad_frame_count, - dev->demod_stats.bytes_fixed_by_rs, - dev->demod_stats.mer); + dprintk(debug, + "demod status: fc: 0x%08x, bad fc: 0x%08x, " + "bytes corrected: 0x%08x , MER: 0x%04x\n", + dev->demod_stats.frame_count, + dev->demod_stats.bad_frame_count, + dev->demod_stats.bytes_fixed_by_rs, + dev->demod_stats.mer); } } else { memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); @@ -236,12 +245,14 @@ * - the accuracy equals ±2dB for a SNR range from 4dB to 30dB * - the accuracy is >2dB for SNR values outside this range */ -static int as102_fe_read_snr(struct dvb_frontend* fe, u16* snr) { +static int as102_fe_read_snr(struct dvb_frontend *fe, u16 *snr) +{ struct as102_dev_t *dev; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; *snr = dev->demod_stats.mer; @@ -250,12 +261,14 @@ return 0; } -static int as102_fe_read_ber(struct dvb_frontend* fe, u32* ber) { +static int as102_fe_read_ber(struct dvb_frontend *fe, u32 *ber) +{ struct as102_dev_t *dev; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; *ber = dev->ber; @@ -264,12 +277,15 @@ return 0; } -static int as102_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength) { +static int as102_fe_read_signal_strength(struct dvb_frontend *fe, + u16 *strength) +{ struct as102_dev_t *dev; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; *strength = (((0xffff * 400) * dev->signal_strength + 41000) * 2); @@ -278,12 +294,14 @@ return 0; } -static int as102_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) { +static int as102_fe_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) +{ struct as102_dev_t *dev; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; if (dev->demod_stats.has_started) @@ -296,13 +314,15 @@ } #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) -static int as102_fe_ts_bus_ctrl(struct dvb_frontend* fe, int acquire) { +static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) +{ struct as102_dev_t *dev; int ret; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; if (mutex_lock_interruptible(&dev->bus_adap.lock)) @@ -362,8 +382,8 @@ #endif }; -int as102_dvb_unregister_fe(struct dvb_frontend *fe) { - +int as102_dvb_unregister_fe(struct dvb_frontend *fe) +{ /* unregister frontend */ dvb_unregister_frontend(fe); @@ -374,11 +394,13 @@ return 0; } -int as102_dvb_register_fe(struct as102_dev_t *as102_dev, struct dvb_frontend *dvb_fe) { +int as102_dvb_register_fe(struct as102_dev_t *as102_dev, + struct dvb_frontend *dvb_fe) +{ int errno; struct dvb_adapter *dvb_adap; - if(as102_dev == NULL) + if (as102_dev == NULL) return -EINVAL; /* extract dvb_adapter */ @@ -389,140 +411,143 @@ /* register dbvb frontend */ errno = dvb_register_frontend(dvb_adap, dvb_fe); - if(errno == 0) + if (errno == 0) dvb_fe->tuner_priv = as102_dev; return errno; } static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst, - struct as10x_tps *as10x_tps) { + struct as10x_tps *as10x_tps) +{ struct dvb_ofdm_parameters *fe_tps = &dst->u.ofdm; /* extract consteallation */ - switch(as10x_tps->constellation) { - case CONST_QPSK: - fe_tps->constellation = QPSK; - break; - case CONST_QAM16: - fe_tps->constellation = QAM_16; - break; - case CONST_QAM64: - fe_tps->constellation = QAM_64; - break; + switch (as10x_tps->constellation) { + case CONST_QPSK: + fe_tps->constellation = QPSK; + break; + case CONST_QAM16: + fe_tps->constellation = QAM_16; + break; + case CONST_QAM64: + fe_tps->constellation = QAM_64; + break; } /* extract hierarchy */ - switch(as10x_tps->hierarchy) { - case HIER_NONE: - fe_tps->hierarchy_information = HIERARCHY_NONE; - break; - case HIER_ALPHA_1: - fe_tps->hierarchy_information = HIERARCHY_1; - break; - case HIER_ALPHA_2: - fe_tps->hierarchy_information = HIERARCHY_2; - break; - case HIER_ALPHA_4: - fe_tps->hierarchy_information = HIERARCHY_4; - break; + switch (as10x_tps->hierarchy) { + case HIER_NONE: + fe_tps->hierarchy_information = HIERARCHY_NONE; + break; + case HIER_ALPHA_1: + fe_tps->hierarchy_information = HIERARCHY_1; + break; + case HIER_ALPHA_2: + fe_tps->hierarchy_information = HIERARCHY_2; + break; + case HIER_ALPHA_4: + fe_tps->hierarchy_information = HIERARCHY_4; + break; } /* extract code rate HP */ - switch(as10x_tps->code_rate_HP) { - case CODE_RATE_1_2: - fe_tps->code_rate_HP = FEC_1_2; - break; - case CODE_RATE_2_3: - fe_tps->code_rate_HP = FEC_2_3; - break; - case CODE_RATE_3_4: - fe_tps->code_rate_HP = FEC_3_4; - break; - case CODE_RATE_5_6: - fe_tps->code_rate_HP = FEC_5_6; - break; - case CODE_RATE_7_8: - fe_tps->code_rate_HP = FEC_7_8; - break; + switch (as10x_tps->code_rate_HP) { + case CODE_RATE_1_2: + fe_tps->code_rate_HP = FEC_1_2; + break; + case CODE_RATE_2_3: + fe_tps->code_rate_HP = FEC_2_3; + break; + case CODE_RATE_3_4: + fe_tps->code_rate_HP = FEC_3_4; + break; + case CODE_RATE_5_6: + fe_tps->code_rate_HP = FEC_5_6; + break; + case CODE_RATE_7_8: + fe_tps->code_rate_HP = FEC_7_8; + break; } /* extract code rate LP */ - switch(as10x_tps->code_rate_LP) { - case CODE_RATE_1_2: - fe_tps->code_rate_LP = FEC_1_2; - break; - case CODE_RATE_2_3: - fe_tps->code_rate_LP = FEC_2_3; - break; - case CODE_RATE_3_4: - fe_tps->code_rate_LP = FEC_3_4; - break; - case CODE_RATE_5_6: - fe_tps->code_rate_LP = FEC_5_6; - break; - case CODE_RATE_7_8: - fe_tps->code_rate_LP = FEC_7_8; - break; + switch (as10x_tps->code_rate_LP) { + case CODE_RATE_1_2: + fe_tps->code_rate_LP = FEC_1_2; + break; + case CODE_RATE_2_3: + fe_tps->code_rate_LP = FEC_2_3; + break; + case CODE_RATE_3_4: + fe_tps->code_rate_LP = FEC_3_4; + break; + case CODE_RATE_5_6: + fe_tps->code_rate_LP = FEC_5_6; + break; + case CODE_RATE_7_8: + fe_tps->code_rate_LP = FEC_7_8; + break; } /* extract guard interval */ - switch(as10x_tps->guard_interval) { - case GUARD_INT_1_32: - fe_tps->guard_interval = GUARD_INTERVAL_1_32; - break; - case GUARD_INT_1_16: - fe_tps->guard_interval = GUARD_INTERVAL_1_16; - break; - case GUARD_INT_1_8: - fe_tps->guard_interval = GUARD_INTERVAL_1_8; - break; - case GUARD_INT_1_4: - fe_tps->guard_interval = GUARD_INTERVAL_1_4; - break; + switch (as10x_tps->guard_interval) { + case GUARD_INT_1_32: + fe_tps->guard_interval = GUARD_INTERVAL_1_32; + break; + case GUARD_INT_1_16: + fe_tps->guard_interval = GUARD_INTERVAL_1_16; + break; + case GUARD_INT_1_8: + fe_tps->guard_interval = GUARD_INTERVAL_1_8; + break; + case GUARD_INT_1_4: + fe_tps->guard_interval = GUARD_INTERVAL_1_4; + break; } /* extract transmission mode */ - switch(as10x_tps->transmission_mode) { - case TRANS_MODE_2K: - fe_tps->transmission_mode = TRANSMISSION_MODE_2K; - break; - case TRANS_MODE_8K: - fe_tps->transmission_mode = TRANSMISSION_MODE_8K; - break; + switch (as10x_tps->transmission_mode) { + case TRANS_MODE_2K: + fe_tps->transmission_mode = TRANSMISSION_MODE_2K; + break; + case TRANS_MODE_8K: + fe_tps->transmission_mode = TRANSMISSION_MODE_8K; + break; } } -static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg) { +static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg) +{ uint8_t c; - switch(arg) { - case FEC_1_2: - c = CODE_RATE_1_2; - break; - case FEC_2_3: - c = CODE_RATE_2_3; - break; - case FEC_3_4: - c = CODE_RATE_3_4; - break; - case FEC_5_6: - c = CODE_RATE_5_6; - break; - case FEC_7_8: - c = CODE_RATE_7_8; - break; - default: - c = CODE_RATE_UNKNOWN; - break; + switch (arg) { + case FEC_1_2: + c = CODE_RATE_1_2; + break; + case FEC_2_3: + c = CODE_RATE_2_3; + break; + case FEC_3_4: + c = CODE_RATE_3_4; + break; + case FEC_5_6: + c = CODE_RATE_5_6; + break; + case FEC_7_8: + c = CODE_RATE_7_8; + break; + default: + c = CODE_RATE_UNKNOWN; + break; } return c; } static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args, - struct dvb_frontend_parameters *params) { + struct dvb_frontend_parameters *params) +{ /* set frequency */ tune_args->freq = params->frequency / 1000; @@ -530,81 +555,81 @@ /* fix interleaving_mode */ tune_args->interleaving_mode = INTLV_NATIVE; - switch(params->u.ofdm.bandwidth) { - case BANDWIDTH_8_MHZ: - tune_args->bandwidth = BW_8_MHZ; - break; - case BANDWIDTH_7_MHZ: - tune_args->bandwidth = BW_7_MHZ; - break; - case BANDWIDTH_6_MHZ: - tune_args->bandwidth = BW_6_MHZ; - break; - default: - tune_args->bandwidth = BW_8_MHZ; + switch (params->u.ofdm.bandwidth) { + case BANDWIDTH_8_MHZ: + tune_args->bandwidth = BW_8_MHZ; + break; + case BANDWIDTH_7_MHZ: + tune_args->bandwidth = BW_7_MHZ; + break; + case BANDWIDTH_6_MHZ: + tune_args->bandwidth = BW_6_MHZ; + break; + default: + tune_args->bandwidth = BW_8_MHZ; } - switch(params->u.ofdm.guard_interval) { - case GUARD_INTERVAL_1_32: - tune_args->guard_interval = GUARD_INT_1_32; - break; - case GUARD_INTERVAL_1_16: - tune_args->guard_interval = GUARD_INT_1_16; - break; - case GUARD_INTERVAL_1_8: - tune_args->guard_interval = GUARD_INT_1_8; - break; - case GUARD_INTERVAL_1_4: - tune_args->guard_interval = GUARD_INT_1_4; - break; - case GUARD_INTERVAL_AUTO: - default: - tune_args->guard_interval = GUARD_UNKNOWN; - break; + switch (params->u.ofdm.guard_interval) { + case GUARD_INTERVAL_1_32: + tune_args->guard_interval = GUARD_INT_1_32; + break; + case GUARD_INTERVAL_1_16: + tune_args->guard_interval = GUARD_INT_1_16; + break; + case GUARD_INTERVAL_1_8: + tune_args->guard_interval = GUARD_INT_1_8; + break; + case GUARD_INTERVAL_1_4: + tune_args->guard_interval = GUARD_INT_1_4; + break; + case GUARD_INTERVAL_AUTO: + default: + tune_args->guard_interval = GUARD_UNKNOWN; + break; } - switch(params->u.ofdm.constellation) { - case QPSK: - tune_args->constellation = CONST_QPSK; - break; - case QAM_16: - tune_args->constellation = CONST_QAM16; - break; - case QAM_64: - tune_args->constellation = CONST_QAM64; - break; - default: - tune_args->constellation = CONST_UNKNOWN; - break; + switch (params->u.ofdm.constellation) { + case QPSK: + tune_args->constellation = CONST_QPSK; + break; + case QAM_16: + tune_args->constellation = CONST_QAM16; + break; + case QAM_64: + tune_args->constellation = CONST_QAM64; + break; + default: + tune_args->constellation = CONST_UNKNOWN; + break; } - switch(params->u.ofdm.transmission_mode) { - case TRANSMISSION_MODE_2K: - tune_args->transmission_mode = TRANS_MODE_2K; - break; - case TRANSMISSION_MODE_8K: - tune_args->transmission_mode = TRANS_MODE_8K; - break; - default: - tune_args->transmission_mode = TRANS_MODE_UNKNOWN; + switch (params->u.ofdm.transmission_mode) { + case TRANSMISSION_MODE_2K: + tune_args->transmission_mode = TRANS_MODE_2K; + break; + case TRANSMISSION_MODE_8K: + tune_args->transmission_mode = TRANS_MODE_8K; + break; + default: + tune_args->transmission_mode = TRANS_MODE_UNKNOWN; } - switch(params->u.ofdm.hierarchy_information) { - case HIERARCHY_NONE: - tune_args->hierarchy = HIER_NONE; - break; - case HIERARCHY_1: - tune_args->hierarchy = HIER_ALPHA_1; - break; - case HIERARCHY_2: - tune_args->hierarchy = HIER_ALPHA_2; - break; - case HIERARCHY_4: - tune_args->hierarchy = HIER_ALPHA_4; - break; - case HIERARCHY_AUTO: - tune_args->hierarchy = HIER_UNKNOWN; - break; + switch (params->u.ofdm.hierarchy_information) { + case HIERARCHY_NONE: + tune_args->hierarchy = HIER_NONE; + break; + case HIERARCHY_1: + tune_args->hierarchy = HIER_ALPHA_1; + break; + case HIERARCHY_2: + tune_args->hierarchy = HIER_ALPHA_2; + break; + case HIERARCHY_4: + tune_args->hierarchy = HIER_ALPHA_4; + break; + case HIERARCHY_AUTO: + tune_args->hierarchy = HIER_UNKNOWN; + break; } dprintk(debug, "tuner parameters: freq: %d bw: 0x%02x gi: 0x%02x\n", @@ -623,23 +648,26 @@ if (params->u.ofdm.code_rate_LP == FEC_NONE) { tune_args->hier_select = HIER_HIGH_PRIORITY; tune_args->code_rate = - as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); + as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); } if (params->u.ofdm.code_rate_HP == FEC_NONE) { tune_args->hier_select = HIER_LOW_PRIORITY; tune_args->code_rate = - as102_fe_get_code_rate(params->u.ofdm.code_rate_LP); + as102_fe_get_code_rate(params->u.ofdm.code_rate_LP); } dprintk(debug, "\thierarchy: 0x%02x " "selected: %s code_rate_%s: 0x%02x\n", tune_args->hierarchy, - tune_args->hier_select == HIER_HIGH_PRIORITY ? "HP" : "LP", - tune_args->hier_select == HIER_HIGH_PRIORITY ? "HP" : "LP", + tune_args->hier_select == HIER_HIGH_PRIORITY ? + "HP" : "LP", + tune_args->hier_select == HIER_HIGH_PRIORITY ? + "HP" : "LP", tune_args->code_rate); } else { - tune_args->code_rate = as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); + tune_args->code_rate = + as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); } } #endif ^ permalink raw reply [flat|nested] 91+ messages in thread
* [RESEND PATCH 6/14] staging/media/as102: checkpatch fixes 2011-10-18 9:12 ` [PATCH 6/14] " Piotr Chmura @ 2011-10-18 19:56 ` Piotr Chmura 0 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 19:56 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318799 18000 # Node ID 5916edd6739e9b8e02ff8a1e93161c4d23b50b3e # Parent 1ccb2e0adbf02a111decf8a4c78e93f4354e2bd2 as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as102_fe.c. Priority: normal Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff --git linux/drivers/staging/media/as102/as102_fe.c linuxb/drivers/staging/media/as102/as102_fe.c --- linux/drivers/staging/media/as102/as102_fe.c +++ linuxb/drivers/staging/media/as102/as102_fe.c @@ -1,6 +1,7 @@ /* * Abilis Systems Single DVB-T Receiver * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,12 +32,14 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst, struct dvb_frontend_parameters *src); -static void as102_fe_release(struct dvb_frontend *fe) { +static void as102_fe_release(struct dvb_frontend *fe) +{ struct as102_dev_t *dev; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) @@ -64,13 +67,15 @@ } #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) -static int as102_fe_init(struct dvb_frontend *fe) { +static int as102_fe_init(struct dvb_frontend *fe) +{ int ret = 0; struct as102_dev_t *dev; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; if (mutex_lock_interruptible(&dev->bus_adap.lock)) @@ -90,14 +95,16 @@ #endif static int as102_fe_set_frontend(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) { + struct dvb_frontend_parameters *params) +{ int ret = 0; struct as102_dev_t *dev; struct as10x_tune_args tune_args = { 0 }; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; if (mutex_lock_interruptible(&dev->bus_adap.lock)) @@ -107,9 +114,8 @@ /* send abilis command: SET_TUNE */ ret = as10x_cmd_set_tune(&dev->bus_adap, &tune_args); - if(ret != 0) { + if (ret != 0) dprintk(debug, "as10x_cmd_set_tune failed. (err = %d)\n", ret); - } mutex_unlock(&dev->bus_adap.lock); @@ -117,7 +123,7 @@ return (ret < 0) ? -EINVAL : 0; } -static int as102_fe_get_frontend(struct dvb_frontend* fe, +static int as102_fe_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) { int ret = 0; struct as102_dev_t *dev; @@ -125,7 +131,8 @@ ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -EINVAL; if (mutex_lock_interruptible(&dev->bus_adap.lock)) @@ -150,7 +157,8 @@ #if 0 dprintk(debug, "step_size = %d\n", settings->step_size); dprintk(debug, "max_drift = %d\n", settings->max_drift); - dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms, 1000); + dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms, + 1000); #endif settings->min_delay_ms = 1000; @@ -160,14 +168,16 @@ } -static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) { +static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) +{ int ret = 0; struct as102_dev_t *dev; struct as10x_tune_status tstate = { 0 }; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; if (mutex_lock_interruptible(&dev->bus_adap.lock)) @@ -176,48 +186,47 @@ /* send abilis command: GET_TUNE_STATUS */ ret = as10x_cmd_get_tune_status(&dev->bus_adap, &tstate); if (ret < 0) { - dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n", ret); + dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n", + ret); goto out; } dev->signal_strength = tstate.signal_strength; dev->ber = tstate.BER; - switch(tstate.tune_state) { - case TUNE_STATUS_SIGNAL_DVB_OK: - *status = FE_HAS_SIGNAL | - FE_HAS_CARRIER; - break; - case TUNE_STATUS_STREAM_DETECTED: - *status = FE_HAS_SIGNAL | - FE_HAS_CARRIER | - FE_HAS_SYNC; - break; - case TUNE_STATUS_STREAM_TUNED: - *status = FE_HAS_SIGNAL | - FE_HAS_CARRIER | - FE_HAS_SYNC | - FE_HAS_LOCK; - break; - default: - *status = TUNE_STATUS_NOT_TUNED; + switch (tstate.tune_state) { + case TUNE_STATUS_SIGNAL_DVB_OK: + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER; + break; + case TUNE_STATUS_STREAM_DETECTED: + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC; + break; + case TUNE_STATUS_STREAM_TUNED: + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC | + FE_HAS_LOCK; + break; + default: + *status = TUNE_STATUS_NOT_TUNED; } - dprintk(debug, "tuner status: 0x%02x , strength %d , per: %d , ber: %d\n", + dprintk(debug, "tuner status: 0x%02x, strength %d, per: %d, ber: %d\n", tstate.tune_state, tstate.signal_strength, tstate.PER, tstate.BER); if (*status & FE_HAS_LOCK) { if (as10x_cmd_get_demod_stats(&dev->bus_adap, - (struct as10x_demod_stats *) &dev->demod_stats) < 0) { + (struct as10x_demod_stats *) &dev->demod_stats) < 0) { memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); - dprintk(debug, "as10x_cmd_get_demod_stats failed (probably not tuned)\n"); + dprintk(debug, "as10x_cmd_get_demod_stats failed " + "(probably not tuned)\n"); } else { - dprintk(debug, "demod status: fc: 0x%08x , bad fc: 0x%08x , bytes corrected: 0x%08x , MER: 0x%04x\n", - dev->demod_stats.frame_count, - dev->demod_stats.bad_frame_count, - dev->demod_stats.bytes_fixed_by_rs, - dev->demod_stats.mer); + dprintk(debug, + "demod status: fc: 0x%08x, bad fc: 0x%08x, " + "bytes corrected: 0x%08x , MER: 0x%04x\n", + dev->demod_stats.frame_count, + dev->demod_stats.bad_frame_count, + dev->demod_stats.bytes_fixed_by_rs, + dev->demod_stats.mer); } } else { memset(&dev->demod_stats, 0, sizeof(dev->demod_stats)); @@ -236,12 +245,14 @@ * - the accuracy equals ±2dB for a SNR range from 4dB to 30dB * - the accuracy is >2dB for SNR values outside this range */ -static int as102_fe_read_snr(struct dvb_frontend* fe, u16* snr) { +static int as102_fe_read_snr(struct dvb_frontend *fe, u16 *snr) +{ struct as102_dev_t *dev; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; *snr = dev->demod_stats.mer; @@ -250,12 +261,14 @@ return 0; } -static int as102_fe_read_ber(struct dvb_frontend* fe, u32* ber) { +static int as102_fe_read_ber(struct dvb_frontend *fe, u32 *ber) +{ struct as102_dev_t *dev; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; *ber = dev->ber; @@ -264,12 +277,15 @@ return 0; } -static int as102_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength) { +static int as102_fe_read_signal_strength(struct dvb_frontend *fe, + u16 *strength) +{ struct as102_dev_t *dev; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; *strength = (((0xffff * 400) * dev->signal_strength + 41000) * 2); @@ -278,12 +294,14 @@ return 0; } -static int as102_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) { +static int as102_fe_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) +{ struct as102_dev_t *dev; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; if (dev->demod_stats.has_started) @@ -296,13 +314,15 @@ } #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) -static int as102_fe_ts_bus_ctrl(struct dvb_frontend* fe, int acquire) { +static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) +{ struct as102_dev_t *dev; int ret; ENTER(); - if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL) + dev = (struct as102_dev_t *) fe->tuner_priv; + if (dev == NULL) return -ENODEV; if (mutex_lock_interruptible(&dev->bus_adap.lock)) @@ -362,8 +382,8 @@ #endif }; -int as102_dvb_unregister_fe(struct dvb_frontend *fe) { - +int as102_dvb_unregister_fe(struct dvb_frontend *fe) +{ /* unregister frontend */ dvb_unregister_frontend(fe); @@ -374,11 +394,13 @@ return 0; } -int as102_dvb_register_fe(struct as102_dev_t *as102_dev, struct dvb_frontend *dvb_fe) { +int as102_dvb_register_fe(struct as102_dev_t *as102_dev, + struct dvb_frontend *dvb_fe) +{ int errno; struct dvb_adapter *dvb_adap; - if(as102_dev == NULL) + if (as102_dev == NULL) return -EINVAL; /* extract dvb_adapter */ @@ -389,140 +411,143 @@ /* register dbvb frontend */ errno = dvb_register_frontend(dvb_adap, dvb_fe); - if(errno == 0) + if (errno == 0) dvb_fe->tuner_priv = as102_dev; return errno; } static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst, - struct as10x_tps *as10x_tps) { + struct as10x_tps *as10x_tps) +{ struct dvb_ofdm_parameters *fe_tps = &dst->u.ofdm; /* extract consteallation */ - switch(as10x_tps->constellation) { - case CONST_QPSK: - fe_tps->constellation = QPSK; - break; - case CONST_QAM16: - fe_tps->constellation = QAM_16; - break; - case CONST_QAM64: - fe_tps->constellation = QAM_64; - break; + switch (as10x_tps->constellation) { + case CONST_QPSK: + fe_tps->constellation = QPSK; + break; + case CONST_QAM16: + fe_tps->constellation = QAM_16; + break; + case CONST_QAM64: + fe_tps->constellation = QAM_64; + break; } /* extract hierarchy */ - switch(as10x_tps->hierarchy) { - case HIER_NONE: - fe_tps->hierarchy_information = HIERARCHY_NONE; - break; - case HIER_ALPHA_1: - fe_tps->hierarchy_information = HIERARCHY_1; - break; - case HIER_ALPHA_2: - fe_tps->hierarchy_information = HIERARCHY_2; - break; - case HIER_ALPHA_4: - fe_tps->hierarchy_information = HIERARCHY_4; - break; + switch (as10x_tps->hierarchy) { + case HIER_NONE: + fe_tps->hierarchy_information = HIERARCHY_NONE; + break; + case HIER_ALPHA_1: + fe_tps->hierarchy_information = HIERARCHY_1; + break; + case HIER_ALPHA_2: + fe_tps->hierarchy_information = HIERARCHY_2; + break; + case HIER_ALPHA_4: + fe_tps->hierarchy_information = HIERARCHY_4; + break; } /* extract code rate HP */ - switch(as10x_tps->code_rate_HP) { - case CODE_RATE_1_2: - fe_tps->code_rate_HP = FEC_1_2; - break; - case CODE_RATE_2_3: - fe_tps->code_rate_HP = FEC_2_3; - break; - case CODE_RATE_3_4: - fe_tps->code_rate_HP = FEC_3_4; - break; - case CODE_RATE_5_6: - fe_tps->code_rate_HP = FEC_5_6; - break; - case CODE_RATE_7_8: - fe_tps->code_rate_HP = FEC_7_8; - break; + switch (as10x_tps->code_rate_HP) { + case CODE_RATE_1_2: + fe_tps->code_rate_HP = FEC_1_2; + break; + case CODE_RATE_2_3: + fe_tps->code_rate_HP = FEC_2_3; + break; + case CODE_RATE_3_4: + fe_tps->code_rate_HP = FEC_3_4; + break; + case CODE_RATE_5_6: + fe_tps->code_rate_HP = FEC_5_6; + break; + case CODE_RATE_7_8: + fe_tps->code_rate_HP = FEC_7_8; + break; } /* extract code rate LP */ - switch(as10x_tps->code_rate_LP) { - case CODE_RATE_1_2: - fe_tps->code_rate_LP = FEC_1_2; - break; - case CODE_RATE_2_3: - fe_tps->code_rate_LP = FEC_2_3; - break; - case CODE_RATE_3_4: - fe_tps->code_rate_LP = FEC_3_4; - break; - case CODE_RATE_5_6: - fe_tps->code_rate_LP = FEC_5_6; - break; - case CODE_RATE_7_8: - fe_tps->code_rate_LP = FEC_7_8; - break; + switch (as10x_tps->code_rate_LP) { + case CODE_RATE_1_2: + fe_tps->code_rate_LP = FEC_1_2; + break; + case CODE_RATE_2_3: + fe_tps->code_rate_LP = FEC_2_3; + break; + case CODE_RATE_3_4: + fe_tps->code_rate_LP = FEC_3_4; + break; + case CODE_RATE_5_6: + fe_tps->code_rate_LP = FEC_5_6; + break; + case CODE_RATE_7_8: + fe_tps->code_rate_LP = FEC_7_8; + break; } /* extract guard interval */ - switch(as10x_tps->guard_interval) { - case GUARD_INT_1_32: - fe_tps->guard_interval = GUARD_INTERVAL_1_32; - break; - case GUARD_INT_1_16: - fe_tps->guard_interval = GUARD_INTERVAL_1_16; - break; - case GUARD_INT_1_8: - fe_tps->guard_interval = GUARD_INTERVAL_1_8; - break; - case GUARD_INT_1_4: - fe_tps->guard_interval = GUARD_INTERVAL_1_4; - break; + switch (as10x_tps->guard_interval) { + case GUARD_INT_1_32: + fe_tps->guard_interval = GUARD_INTERVAL_1_32; + break; + case GUARD_INT_1_16: + fe_tps->guard_interval = GUARD_INTERVAL_1_16; + break; + case GUARD_INT_1_8: + fe_tps->guard_interval = GUARD_INTERVAL_1_8; + break; + case GUARD_INT_1_4: + fe_tps->guard_interval = GUARD_INTERVAL_1_4; + break; } /* extract transmission mode */ - switch(as10x_tps->transmission_mode) { - case TRANS_MODE_2K: - fe_tps->transmission_mode = TRANSMISSION_MODE_2K; - break; - case TRANS_MODE_8K: - fe_tps->transmission_mode = TRANSMISSION_MODE_8K; - break; + switch (as10x_tps->transmission_mode) { + case TRANS_MODE_2K: + fe_tps->transmission_mode = TRANSMISSION_MODE_2K; + break; + case TRANS_MODE_8K: + fe_tps->transmission_mode = TRANSMISSION_MODE_8K; + break; } } -static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg) { +static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg) +{ uint8_t c; - switch(arg) { - case FEC_1_2: - c = CODE_RATE_1_2; - break; - case FEC_2_3: - c = CODE_RATE_2_3; - break; - case FEC_3_4: - c = CODE_RATE_3_4; - break; - case FEC_5_6: - c = CODE_RATE_5_6; - break; - case FEC_7_8: - c = CODE_RATE_7_8; - break; - default: - c = CODE_RATE_UNKNOWN; - break; + switch (arg) { + case FEC_1_2: + c = CODE_RATE_1_2; + break; + case FEC_2_3: + c = CODE_RATE_2_3; + break; + case FEC_3_4: + c = CODE_RATE_3_4; + break; + case FEC_5_6: + c = CODE_RATE_5_6; + break; + case FEC_7_8: + c = CODE_RATE_7_8; + break; + default: + c = CODE_RATE_UNKNOWN; + break; } return c; } static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args, - struct dvb_frontend_parameters *params) { + struct dvb_frontend_parameters *params) +{ /* set frequency */ tune_args->freq = params->frequency / 1000; @@ -530,81 +555,81 @@ /* fix interleaving_mode */ tune_args->interleaving_mode = INTLV_NATIVE; - switch(params->u.ofdm.bandwidth) { - case BANDWIDTH_8_MHZ: - tune_args->bandwidth = BW_8_MHZ; - break; - case BANDWIDTH_7_MHZ: - tune_args->bandwidth = BW_7_MHZ; - break; - case BANDWIDTH_6_MHZ: - tune_args->bandwidth = BW_6_MHZ; - break; - default: - tune_args->bandwidth = BW_8_MHZ; + switch (params->u.ofdm.bandwidth) { + case BANDWIDTH_8_MHZ: + tune_args->bandwidth = BW_8_MHZ; + break; + case BANDWIDTH_7_MHZ: + tune_args->bandwidth = BW_7_MHZ; + break; + case BANDWIDTH_6_MHZ: + tune_args->bandwidth = BW_6_MHZ; + break; + default: + tune_args->bandwidth = BW_8_MHZ; } - switch(params->u.ofdm.guard_interval) { - case GUARD_INTERVAL_1_32: - tune_args->guard_interval = GUARD_INT_1_32; - break; - case GUARD_INTERVAL_1_16: - tune_args->guard_interval = GUARD_INT_1_16; - break; - case GUARD_INTERVAL_1_8: - tune_args->guard_interval = GUARD_INT_1_8; - break; - case GUARD_INTERVAL_1_4: - tune_args->guard_interval = GUARD_INT_1_4; - break; - case GUARD_INTERVAL_AUTO: - default: - tune_args->guard_interval = GUARD_UNKNOWN; - break; + switch (params->u.ofdm.guard_interval) { + case GUARD_INTERVAL_1_32: + tune_args->guard_interval = GUARD_INT_1_32; + break; + case GUARD_INTERVAL_1_16: + tune_args->guard_interval = GUARD_INT_1_16; + break; + case GUARD_INTERVAL_1_8: + tune_args->guard_interval = GUARD_INT_1_8; + break; + case GUARD_INTERVAL_1_4: + tune_args->guard_interval = GUARD_INT_1_4; + break; + case GUARD_INTERVAL_AUTO: + default: + tune_args->guard_interval = GUARD_UNKNOWN; + break; } - switch(params->u.ofdm.constellation) { - case QPSK: - tune_args->constellation = CONST_QPSK; - break; - case QAM_16: - tune_args->constellation = CONST_QAM16; - break; - case QAM_64: - tune_args->constellation = CONST_QAM64; - break; - default: - tune_args->constellation = CONST_UNKNOWN; - break; + switch (params->u.ofdm.constellation) { + case QPSK: + tune_args->constellation = CONST_QPSK; + break; + case QAM_16: + tune_args->constellation = CONST_QAM16; + break; + case QAM_64: + tune_args->constellation = CONST_QAM64; + break; + default: + tune_args->constellation = CONST_UNKNOWN; + break; } - switch(params->u.ofdm.transmission_mode) { - case TRANSMISSION_MODE_2K: - tune_args->transmission_mode = TRANS_MODE_2K; - break; - case TRANSMISSION_MODE_8K: - tune_args->transmission_mode = TRANS_MODE_8K; - break; - default: - tune_args->transmission_mode = TRANS_MODE_UNKNOWN; + switch (params->u.ofdm.transmission_mode) { + case TRANSMISSION_MODE_2K: + tune_args->transmission_mode = TRANS_MODE_2K; + break; + case TRANSMISSION_MODE_8K: + tune_args->transmission_mode = TRANS_MODE_8K; + break; + default: + tune_args->transmission_mode = TRANS_MODE_UNKNOWN; } - switch(params->u.ofdm.hierarchy_information) { - case HIERARCHY_NONE: - tune_args->hierarchy = HIER_NONE; - break; - case HIERARCHY_1: - tune_args->hierarchy = HIER_ALPHA_1; - break; - case HIERARCHY_2: - tune_args->hierarchy = HIER_ALPHA_2; - break; - case HIERARCHY_4: - tune_args->hierarchy = HIER_ALPHA_4; - break; - case HIERARCHY_AUTO: - tune_args->hierarchy = HIER_UNKNOWN; - break; + switch (params->u.ofdm.hierarchy_information) { + case HIERARCHY_NONE: + tune_args->hierarchy = HIER_NONE; + break; + case HIERARCHY_1: + tune_args->hierarchy = HIER_ALPHA_1; + break; + case HIERARCHY_2: + tune_args->hierarchy = HIER_ALPHA_2; + break; + case HIERARCHY_4: + tune_args->hierarchy = HIER_ALPHA_4; + break; + case HIERARCHY_AUTO: + tune_args->hierarchy = HIER_UNKNOWN; + break; } dprintk(debug, "tuner parameters: freq: %d bw: 0x%02x gi: 0x%02x\n", @@ -623,23 +648,26 @@ if (params->u.ofdm.code_rate_LP == FEC_NONE) { tune_args->hier_select = HIER_HIGH_PRIORITY; tune_args->code_rate = - as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); + as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); } if (params->u.ofdm.code_rate_HP == FEC_NONE) { tune_args->hier_select = HIER_LOW_PRIORITY; tune_args->code_rate = - as102_fe_get_code_rate(params->u.ofdm.code_rate_LP); + as102_fe_get_code_rate(params->u.ofdm.code_rate_LP); } dprintk(debug, "\thierarchy: 0x%02x " "selected: %s code_rate_%s: 0x%02x\n", tune_args->hierarchy, - tune_args->hier_select == HIER_HIGH_PRIORITY ? "HP" : "LP", - tune_args->hier_select == HIER_HIGH_PRIORITY ? "HP" : "LP", + tune_args->hier_select == HIER_HIGH_PRIORITY ? + "HP" : "LP", + tune_args->hier_select == HIER_HIGH_PRIORITY ? + "HP" : "LP", tune_args->code_rate); } else { - tune_args->code_rate = as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); + tune_args->code_rate = + as102_fe_get_code_rate(params->u.ofdm.code_rate_HP); } } #endif ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 7/14] staging/media/as102: checkpatch fixes [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> ` (5 preceding siblings ...) 2011-10-18 9:12 ` [PATCH 6/14] " Piotr Chmura @ 2011-10-18 9:12 ` Piotr Chmura 2011-10-18 19:57 ` [RESEND PATCH " Piotr Chmura 2011-10-18 9:12 ` [PATCH 8/14] " Piotr Chmura ` (6 subsequent siblings) 13 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:12 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318867 18000 # Node ID 152825226bec049f947a844bea2c530fc9269ae5 # Parent 5916edd6739e9b8e02ff8a1e93161c4d23b50b3e as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as102_usb_drv.c. Priority: normal Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> diff --git linux/drivers/staging/media/as102/as102_usb_drv.c linuxb/drivers/media/dvb/as102/as102_usb_drv.c --- linux/drivers/staging/media/as102/as102_usb_drv.c +++ linuxb/drivers/staging/media/as102/as102_usb_drv.c @@ -1,6 +1,7 @@ /* * Abilis Systems Single DVB-T Receiver * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,7 +50,7 @@ .id_table = as102_usb_id_table }; -struct file_operations as102_dev_fops = { +static const struct file_operations as102_dev_fops = { .owner = THIS_MODULE, .open = as102_open, .release = as102_release, @@ -63,46 +64,48 @@ static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap, unsigned char *send_buf, int send_buf_len, - unsigned char *recv_buf, int recv_buf_len) { - + unsigned char *recv_buf, int recv_buf_len) +{ int ret = 0; ENTER(); - if(send_buf != NULL) { + if (send_buf != NULL) { ret = usb_control_msg(bus_adap->usb_dev, usb_sndctrlpipe(bus_adap->usb_dev, 0), AS102_USB_DEVICE_TX_CTRL_CMD, - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + USB_DIR_OUT | USB_TYPE_VENDOR | + USB_RECIP_DEVICE, bus_adap->cmd_xid, /* value */ 0, /* index */ send_buf, send_buf_len, USB_CTRL_SET_TIMEOUT /* 200 */); - if(ret < 0) { + if (ret < 0) { dprintk(debug, "usb_control_msg(send) failed, err %i\n", ret); return ret; } - if(ret != send_buf_len) { + if (ret != send_buf_len) { dprintk(debug, "only wrote %d of %d bytes\n", ret, send_buf_len); return -1; } } - if(recv_buf != NULL) { + if (recv_buf != NULL) { #ifdef TRACE dprintk(debug, "want to read: %d bytes\n", recv_buf_len); #endif ret = usb_control_msg(bus_adap->usb_dev, usb_rcvctrlpipe(bus_adap->usb_dev, 0), AS102_USB_DEVICE_RX_CTRL_CMD, - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + USB_DIR_IN | USB_TYPE_VENDOR | + USB_RECIP_DEVICE, bus_adap->cmd_xid, /* value */ 0, /* index */ recv_buf, recv_buf_len, USB_CTRL_GET_TIMEOUT /* 200 */); - if(ret < 0) { + if (ret < 0) { dprintk(debug, "usb_control_msg(recv) failed, err %i\n", ret); return ret; @@ -119,18 +122,19 @@ static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap, unsigned char *send_buf, int send_buf_len, - int swap32) { - + int swap32) +{ int ret = 0, actual_len; - ret = usb_bulk_msg(bus_adap->usb_dev, usb_sndbulkpipe(bus_adap->usb_dev, 1), + ret = usb_bulk_msg(bus_adap->usb_dev, + usb_sndbulkpipe(bus_adap->usb_dev, 1), send_buf, send_buf_len, &actual_len, 200); - if(ret) { + if (ret) { dprintk(debug, "usb_bulk_msg(send) failed, err %i\n", ret); return ret; } - if(actual_len != send_buf_len) { + if (actual_len != send_buf_len) { dprintk(debug, "only wrote %d of %d bytes\n", actual_len, send_buf_len); return -1; @@ -139,21 +143,22 @@ } static int as102_read_ep2(struct as102_bus_adapter_t *bus_adap, - unsigned char *recv_buf, int recv_buf_len) { - + unsigned char *recv_buf, int recv_buf_len) +{ int ret = 0, actual_len; - if(recv_buf == NULL) + if (recv_buf == NULL) return -EINVAL; - ret = usb_bulk_msg(bus_adap->usb_dev, usb_rcvbulkpipe(bus_adap->usb_dev, 2), + ret = usb_bulk_msg(bus_adap->usb_dev, + usb_rcvbulkpipe(bus_adap->usb_dev, 2), recv_buf, recv_buf_len, &actual_len, 200); - if(ret) { + if (ret) { dprintk(debug, "usb_bulk_msg(recv) failed, err %i\n", ret); return ret; } - if(actual_len != recv_buf_len) { + if (actual_len != recv_buf_len) { dprintk(debug, "only read %d of %d bytes\n", actual_len, recv_buf_len); return -1; @@ -169,7 +174,8 @@ .stop_stream = as102_usb_stop_stream, }; -static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb) { +static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb) +{ int err; usb_fill_bulk_urb(urb, @@ -180,8 +186,9 @@ as102_urb_stream_irq, dev); - if ((err = usb_submit_urb(urb, GFP_ATOMIC))) - dprintk(debug, "%s: usb_submit_urb failed\n", __FUNCTION__); + err = usb_submit_urb(urb, GFP_ATOMIC); + if (err) + dprintk(debug, "%s: usb_submit_urb failed\n", __func__); return err; } @@ -203,7 +210,7 @@ /* do nothing ? */ #endif } else { - if(urb->actual_length == 0) + if (urb->actual_length == 0) memset(urb->transfer_buffer, 0, AS102_USB_BUF_SIZE); } @@ -212,7 +219,8 @@ as102_submit_urb_stream(as102_dev, urb); } -static void as102_free_usb_stream_buffer(struct as102_dev_t *dev) { +static void as102_free_usb_stream_buffer(struct as102_dev_t *dev) +{ int i; ENTER(); @@ -227,7 +235,8 @@ LEAVE(); } -static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) { +static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) +{ int i, ret = 0; ENTER(); @@ -237,7 +246,7 @@ GFP_KERNEL, &dev->dma_addr); if (!dev->stream) { - dprintk(debug, "%s: usb_buffer_alloc failed\n", __FUNCTION__); + dprintk(debug, "%s: usb_buffer_alloc failed\n", __func__); return -ENOMEM; } @@ -247,8 +256,9 @@ for (i = 0; i < MAX_STREAM_URB; i++) { struct urb *urb; - if (!(urb = usb_alloc_urb(0, GFP_ATOMIC))) { - dprintk(debug, "%s: usb_alloc_urb failed\n", __FUNCTION__); + urb = usb_alloc_urb(0, GFP_ATOMIC); + if (urb == NULL) { + dprintk(debug, "%s: usb_alloc_urb failed\n", __func__); as102_free_usb_stream_buffer(dev); return -ENOMEM; } @@ -262,18 +272,21 @@ return ret; } -static void as102_usb_stop_stream(struct as102_dev_t *dev) { +static void as102_usb_stop_stream(struct as102_dev_t *dev) +{ int i; for (i = 0; i < MAX_STREAM_URB; i++) usb_kill_urb(dev->stream_urb[i]); } -static int as102_usb_start_stream(struct as102_dev_t *dev) { +static int as102_usb_start_stream(struct as102_dev_t *dev) +{ int i, ret = 0; for (i = 0; i < MAX_STREAM_URB; i++) { - if ((ret = as102_submit_urb_stream(dev, dev->stream_urb[i]))) { + ret = as102_submit_urb_stream(dev, dev->stream_urb[i]); + if (ret) { as102_usb_stop_stream(dev); return ret; } @@ -282,7 +295,8 @@ return 0; } -static void as102_usb_release(struct kref *kref) { +static void as102_usb_release(struct kref *kref) +{ struct as102_dev_t *as102_dev; ENTER(); @@ -296,7 +310,8 @@ LEAVE(); } -static void as102_usb_disconnect(struct usb_interface *intf) { +static void as102_usb_disconnect(struct usb_interface *intf) +{ struct as102_dev_t *as102_dev; ENTER(); @@ -324,14 +339,16 @@ } static int as102_usb_probe(struct usb_interface *intf, - const struct usb_device_id *id) { + const struct usb_device_id *id) +{ int ret; struct as102_dev_t *as102_dev; ENTER(); - if(!(as102_dev = kzalloc(sizeof(struct as102_dev_t), GFP_KERNEL))) { - err("%s: kzalloc failed", __FUNCTION__); + as102_dev = kzalloc(sizeof(struct as102_dev_t), GFP_KERNEL); + if (as102_dev == NULL) { + err("%s: kzalloc failed", __func__); return -ENOMEM; } @@ -352,17 +369,19 @@ as102_dev->bus_adap.usb_dev = usb_get_dev(interface_to_usbdev(intf)); /* we can register the device now, as it is ready */ - if((ret = usb_register_dev(intf, &as102_usb_class_driver)) < 0) {; + ret = usb_register_dev(intf, &as102_usb_class_driver); + if (ret < 0) { /* something prevented us from registering this driver */ err("%s: usb_register_dev() failed (errno = %d)", - __FUNCTION__, ret); + __func__, ret); goto failed; } printk(KERN_INFO "%s: device has been detected\n", DRIVER_NAME); /* request buffer allocation for streaming */ - if ((ret = as102_alloc_usb_stream_buffer(as102_dev)) != 0) + ret = as102_alloc_usb_stream_buffer(as102_dev); + if (ret != 0) goto failed; /* register dvb layer */ @@ -377,7 +396,8 @@ return ret; } -static int as102_open(struct inode *inode, struct file *file) { +static int as102_open(struct inode *inode, struct file *file) +{ int ret = 0, minor = 0; struct usb_interface *intf = NULL; struct as102_dev_t *dev = NULL; @@ -388,15 +408,17 @@ minor = iminor(inode); /* fetch device from usb interface */ - if((intf = usb_find_interface(&as102_usb_driver, minor)) == NULL) { + intf = usb_find_interface(&as102_usb_driver, minor); + if (intf == NULL) { printk(KERN_ERR "%s: can't find device for minor %d\n", - __FUNCTION__, minor); + __func__, minor); ret = -ENODEV; goto exit; } /* get our device */ - if((dev = usb_get_intfdata(intf)) == NULL) { + dev = usb_get_intfdata(intf); + if (dev == NULL) { ret = -EFAULT; goto exit; } @@ -412,13 +434,15 @@ return ret; } -static int as102_release(struct inode *inode, struct file *file) { +static int as102_release(struct inode *inode, struct file *file) +{ int ret = 0; struct as102_dev_t *dev = NULL; ENTER(); - if((dev = file->private_data) != NULL ) { + dev = file->private_data; + if (dev != NULL) { /* decrement the count on our device */ kref_put(&dev->kref, as102_usb_release); } diff --git linux/drivers/staging/media/as102/as102_usb_drv.h linuxb/drivers/media/dvb/as102/as102_usb_drv.h --- linux/drivers/staging/media/as102/as102_usb_drv.h +++ linuxb/drivers/staging/media/as102/as102_usb_drv.h @@ -1,6 +1,7 @@ /* * Abilis Systems Single DVB-T Receiver * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,8 +36,6 @@ #define PCTV_74E_USB_VID 0x2013 #define PCTV_74E_USB_PID 0x0246 -extern struct file_operations as102_dev_fops; - #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)) void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs); #else ^ permalink raw reply [flat|nested] 91+ messages in thread
* [RESEND PATCH 7/14] staging/media/as102: checkpatch fixes 2011-10-18 9:12 ` [PATCH 7/14] " Piotr Chmura @ 2011-10-18 19:57 ` Piotr Chmura 0 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 19:57 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318867 18000 # Node ID 152825226bec049f947a844bea2c530fc9269ae5 # Parent 5916edd6739e9b8e02ff8a1e93161c4d23b50b3e as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as102_usb_drv.c. Priority: normal Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff --git linux/drivers/staging/media/as102/as102_usb_drv.c linuxb/drivers/media/dvb/as102/as102_usb_drv.c --- linux/drivers/staging/media/as102/as102_usb_drv.c +++ linuxb/drivers/staging/media/as102/as102_usb_drv.c @@ -1,6 +1,7 @@ /* * Abilis Systems Single DVB-T Receiver * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,7 +50,7 @@ .id_table = as102_usb_id_table }; -struct file_operations as102_dev_fops = { +static const struct file_operations as102_dev_fops = { .owner = THIS_MODULE, .open = as102_open, .release = as102_release, @@ -63,46 +64,48 @@ static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap, unsigned char *send_buf, int send_buf_len, - unsigned char *recv_buf, int recv_buf_len) { - + unsigned char *recv_buf, int recv_buf_len) +{ int ret = 0; ENTER(); - if(send_buf != NULL) { + if (send_buf != NULL) { ret = usb_control_msg(bus_adap->usb_dev, usb_sndctrlpipe(bus_adap->usb_dev, 0), AS102_USB_DEVICE_TX_CTRL_CMD, - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + USB_DIR_OUT | USB_TYPE_VENDOR | + USB_RECIP_DEVICE, bus_adap->cmd_xid, /* value */ 0, /* index */ send_buf, send_buf_len, USB_CTRL_SET_TIMEOUT /* 200 */); - if(ret < 0) { + if (ret < 0) { dprintk(debug, "usb_control_msg(send) failed, err %i\n", ret); return ret; } - if(ret != send_buf_len) { + if (ret != send_buf_len) { dprintk(debug, "only wrote %d of %d bytes\n", ret, send_buf_len); return -1; } } - if(recv_buf != NULL) { + if (recv_buf != NULL) { #ifdef TRACE dprintk(debug, "want to read: %d bytes\n", recv_buf_len); #endif ret = usb_control_msg(bus_adap->usb_dev, usb_rcvctrlpipe(bus_adap->usb_dev, 0), AS102_USB_DEVICE_RX_CTRL_CMD, - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + USB_DIR_IN | USB_TYPE_VENDOR | + USB_RECIP_DEVICE, bus_adap->cmd_xid, /* value */ 0, /* index */ recv_buf, recv_buf_len, USB_CTRL_GET_TIMEOUT /* 200 */); - if(ret < 0) { + if (ret < 0) { dprintk(debug, "usb_control_msg(recv) failed, err %i\n", ret); return ret; @@ -119,18 +122,19 @@ static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap, unsigned char *send_buf, int send_buf_len, - int swap32) { - + int swap32) +{ int ret = 0, actual_len; - ret = usb_bulk_msg(bus_adap->usb_dev, usb_sndbulkpipe(bus_adap->usb_dev, 1), + ret = usb_bulk_msg(bus_adap->usb_dev, + usb_sndbulkpipe(bus_adap->usb_dev, 1), send_buf, send_buf_len, &actual_len, 200); - if(ret) { + if (ret) { dprintk(debug, "usb_bulk_msg(send) failed, err %i\n", ret); return ret; } - if(actual_len != send_buf_len) { + if (actual_len != send_buf_len) { dprintk(debug, "only wrote %d of %d bytes\n", actual_len, send_buf_len); return -1; @@ -139,21 +143,22 @@ } static int as102_read_ep2(struct as102_bus_adapter_t *bus_adap, - unsigned char *recv_buf, int recv_buf_len) { - + unsigned char *recv_buf, int recv_buf_len) +{ int ret = 0, actual_len; - if(recv_buf == NULL) + if (recv_buf == NULL) return -EINVAL; - ret = usb_bulk_msg(bus_adap->usb_dev, usb_rcvbulkpipe(bus_adap->usb_dev, 2), + ret = usb_bulk_msg(bus_adap->usb_dev, + usb_rcvbulkpipe(bus_adap->usb_dev, 2), recv_buf, recv_buf_len, &actual_len, 200); - if(ret) { + if (ret) { dprintk(debug, "usb_bulk_msg(recv) failed, err %i\n", ret); return ret; } - if(actual_len != recv_buf_len) { + if (actual_len != recv_buf_len) { dprintk(debug, "only read %d of %d bytes\n", actual_len, recv_buf_len); return -1; @@ -169,7 +174,8 @@ .stop_stream = as102_usb_stop_stream, }; -static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb) { +static int as102_submit_urb_stream(struct as102_dev_t *dev, struct urb *urb) +{ int err; usb_fill_bulk_urb(urb, @@ -180,8 +186,9 @@ as102_urb_stream_irq, dev); - if ((err = usb_submit_urb(urb, GFP_ATOMIC))) - dprintk(debug, "%s: usb_submit_urb failed\n", __FUNCTION__); + err = usb_submit_urb(urb, GFP_ATOMIC); + if (err) + dprintk(debug, "%s: usb_submit_urb failed\n", __func__); return err; } @@ -203,7 +210,7 @@ /* do nothing ? */ #endif } else { - if(urb->actual_length == 0) + if (urb->actual_length == 0) memset(urb->transfer_buffer, 0, AS102_USB_BUF_SIZE); } @@ -212,7 +219,8 @@ as102_submit_urb_stream(as102_dev, urb); } -static void as102_free_usb_stream_buffer(struct as102_dev_t *dev) { +static void as102_free_usb_stream_buffer(struct as102_dev_t *dev) +{ int i; ENTER(); @@ -227,7 +235,8 @@ LEAVE(); } -static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) { +static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) +{ int i, ret = 0; ENTER(); @@ -237,7 +246,7 @@ GFP_KERNEL, &dev->dma_addr); if (!dev->stream) { - dprintk(debug, "%s: usb_buffer_alloc failed\n", __FUNCTION__); + dprintk(debug, "%s: usb_buffer_alloc failed\n", __func__); return -ENOMEM; } @@ -247,8 +256,9 @@ for (i = 0; i < MAX_STREAM_URB; i++) { struct urb *urb; - if (!(urb = usb_alloc_urb(0, GFP_ATOMIC))) { - dprintk(debug, "%s: usb_alloc_urb failed\n", __FUNCTION__); + urb = usb_alloc_urb(0, GFP_ATOMIC); + if (urb == NULL) { + dprintk(debug, "%s: usb_alloc_urb failed\n", __func__); as102_free_usb_stream_buffer(dev); return -ENOMEM; } @@ -262,18 +272,21 @@ return ret; } -static void as102_usb_stop_stream(struct as102_dev_t *dev) { +static void as102_usb_stop_stream(struct as102_dev_t *dev) +{ int i; for (i = 0; i < MAX_STREAM_URB; i++) usb_kill_urb(dev->stream_urb[i]); } -static int as102_usb_start_stream(struct as102_dev_t *dev) { +static int as102_usb_start_stream(struct as102_dev_t *dev) +{ int i, ret = 0; for (i = 0; i < MAX_STREAM_URB; i++) { - if ((ret = as102_submit_urb_stream(dev, dev->stream_urb[i]))) { + ret = as102_submit_urb_stream(dev, dev->stream_urb[i]); + if (ret) { as102_usb_stop_stream(dev); return ret; } @@ -282,7 +295,8 @@ return 0; } -static void as102_usb_release(struct kref *kref) { +static void as102_usb_release(struct kref *kref) +{ struct as102_dev_t *as102_dev; ENTER(); @@ -296,7 +310,8 @@ LEAVE(); } -static void as102_usb_disconnect(struct usb_interface *intf) { +static void as102_usb_disconnect(struct usb_interface *intf) +{ struct as102_dev_t *as102_dev; ENTER(); @@ -324,14 +339,16 @@ } static int as102_usb_probe(struct usb_interface *intf, - const struct usb_device_id *id) { + const struct usb_device_id *id) +{ int ret; struct as102_dev_t *as102_dev; ENTER(); - if(!(as102_dev = kzalloc(sizeof(struct as102_dev_t), GFP_KERNEL))) { - err("%s: kzalloc failed", __FUNCTION__); + as102_dev = kzalloc(sizeof(struct as102_dev_t), GFP_KERNEL); + if (as102_dev == NULL) { + err("%s: kzalloc failed", __func__); return -ENOMEM; } @@ -352,17 +369,19 @@ as102_dev->bus_adap.usb_dev = usb_get_dev(interface_to_usbdev(intf)); /* we can register the device now, as it is ready */ - if((ret = usb_register_dev(intf, &as102_usb_class_driver)) < 0) {; + ret = usb_register_dev(intf, &as102_usb_class_driver); + if (ret < 0) { /* something prevented us from registering this driver */ err("%s: usb_register_dev() failed (errno = %d)", - __FUNCTION__, ret); + __func__, ret); goto failed; } printk(KERN_INFO "%s: device has been detected\n", DRIVER_NAME); /* request buffer allocation for streaming */ - if ((ret = as102_alloc_usb_stream_buffer(as102_dev)) != 0) + ret = as102_alloc_usb_stream_buffer(as102_dev); + if (ret != 0) goto failed; /* register dvb layer */ @@ -377,7 +396,8 @@ return ret; } -static int as102_open(struct inode *inode, struct file *file) { +static int as102_open(struct inode *inode, struct file *file) +{ int ret = 0, minor = 0; struct usb_interface *intf = NULL; struct as102_dev_t *dev = NULL; @@ -388,15 +408,17 @@ minor = iminor(inode); /* fetch device from usb interface */ - if((intf = usb_find_interface(&as102_usb_driver, minor)) == NULL) { + intf = usb_find_interface(&as102_usb_driver, minor); + if (intf == NULL) { printk(KERN_ERR "%s: can't find device for minor %d\n", - __FUNCTION__, minor); + __func__, minor); ret = -ENODEV; goto exit; } /* get our device */ - if((dev = usb_get_intfdata(intf)) == NULL) { + dev = usb_get_intfdata(intf); + if (dev == NULL) { ret = -EFAULT; goto exit; } @@ -412,13 +434,15 @@ return ret; } -static int as102_release(struct inode *inode, struct file *file) { +static int as102_release(struct inode *inode, struct file *file) +{ int ret = 0; struct as102_dev_t *dev = NULL; ENTER(); - if((dev = file->private_data) != NULL ) { + dev = file->private_data; + if (dev != NULL) { /* decrement the count on our device */ kref_put(&dev->kref, as102_usb_release); } diff --git linux/drivers/staging/media/as102/as102_usb_drv.h linuxb/drivers/media/dvb/as102/as102_usb_drv.h --- linux/drivers/staging/media/as102/as102_usb_drv.h +++ linuxb/drivers/staging/media/as102/as102_usb_drv.h @@ -1,6 +1,7 @@ /* * Abilis Systems Single DVB-T Receiver * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,8 +36,6 @@ #define PCTV_74E_USB_VID 0x2013 #define PCTV_74E_USB_PID 0x0246 -extern struct file_operations as102_dev_fops; - #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)) void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs); #else ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 8/14] staging/media/as102: checkpatch fixes [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> ` (6 preceding siblings ...) 2011-10-18 9:12 ` [PATCH 7/14] " Piotr Chmura @ 2011-10-18 9:12 ` Piotr Chmura 2011-10-18 19:58 ` [RESEND PATCH " Piotr Chmura 2011-10-18 9:12 ` [PATCH 9/14] staging/media/as102: Add Elgato EyeTV DTT Deluxe Piotr Chmura ` (5 subsequent siblings) 13 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:12 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318909 18000 # Node ID 89de57601df871f6d951ca13bf52b136f9eadddf # Parent 152825226bec049f947a844bea2c530fc9269ae5 as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as10x_cmd_cfg.c. Priority: normal Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> diff --git linux/drivers/staging/media/as102/as10x_cmd_cfg.c linuxb/drivers/media/dvb/as102/as10x_cmd_cfg.c --- linux/drivers/staging/media/as102/as10x_cmd_cfg.c +++ linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c @@ -2,8 +2,6 @@ \file as10x_cmd_cfg.c - \version $Id$ - \author: S. Martinelli ----------------------------------------------------------------------------\n @@ -22,7 +20,8 @@ #include <linux/kernel.h> #include "as102_drv.h" #elif defined(WIN32) - #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) /* win32 ddk implementation */ + #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) + /* win32 ddk implementation */ #include "wdm.h" #include "Device.h" #include "endian_mgmt.h" /* FIXME */ @@ -59,52 +58,52 @@ int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag, uint32_t *pvalue) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.context.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.context.req)); - /* fill command */ - pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); - pcmd->body.context.req.tag = cpu_to_le16(tag); - pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA); + /* fill command */ + pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); + pcmd->body.context.req.tag = cpu_to_le16(tag); + pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.context.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.context.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.context.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.context.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response: context command do not follow the common response */ - /* structure -> specific handling response parse required */ - error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); + /* parse response: context command do not follow the common response */ + /* structure -> specific handling response parse required */ + error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); - if(error == 0) { - /* Response OK -> get response data */ - *pvalue = le32_to_cpu(prsp->body.context.rsp.reg_val.u.value32); - /* value returned is always a 32-bit value */ - } + if (error == 0) { + /* Response OK -> get response data */ + *pvalue = le32_to_cpu(prsp->body.context.rsp.reg_val.u.value32); + /* value returned is always a 32-bit value */ + } out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -118,47 +117,48 @@ int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag, uint32_t value) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.context.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.context.req)); - /* fill command */ - pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); - /* pcmd->body.context.req.reg_val.mode initialization is not required */ - pcmd->body.context.req.reg_val.u.value32 = cpu_to_le32(value); - pcmd->body.context.req.tag = cpu_to_le16(tag); - pcmd->body.context.req.type = cpu_to_le16(SET_CONTEXT_DATA); + /* fill command */ + pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); + /* pcmd->body.context.req.reg_val.mode initialization is not required */ + pcmd->body.context.req.reg_val.u.value32 = cpu_to_le32(value); + pcmd->body.context.req.tag = cpu_to_le16(tag); + pcmd->body.context.req.type = cpu_to_le16(SET_CONTEXT_DATA); - /* send command */ - if(phandle->ops->xfer_cmd){ - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.context.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.context.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.context.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.context.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response: context command do not follow the common response */ - /* structure -> specific handling response parse required */ - error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); + /* parse response: context command do not follow the common response */ + /* structure -> specific handling response parse required */ + error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -175,45 +175,43 @@ */ int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.cfg_change_mode.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.cfg_change_mode.req)); - /* fill command */ - pcmd->body.cfg_change_mode.req.proc_id = - cpu_to_le16(CONTROL_PROC_ELNA_CHANGE_MODE); - pcmd->body.cfg_change_mode.req.mode = mode; + /* fill command */ + pcmd->body.cfg_change_mode.req.proc_id = + cpu_to_le16(CONTROL_PROC_ELNA_CHANGE_MODE); + pcmd->body.cfg_change_mode.req.mode = mode; - /* send command */ - if(phandle->ops->xfer_cmd){ - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.cfg_change_mode.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.cfg_change_mode.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.cfg_change_mode.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.cfg_change_mode.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_ELNA_CHANGE_MODE_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_ELNA_CHANGE_MODE_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -225,15 +223,15 @@ ABILIS_RC_NOK \callgraph */ -int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) { +int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) +{ + int err; - int err; + err = prsp->body.context.rsp.error; - err = prsp->body.context.rsp.error; - - if((err == 0) && - (le16_to_cpu(prsp->body.context.rsp.proc_id) == proc_id)) { - return 0; - } - return AS10X_CMD_ERROR; + if ((err == 0) && + (le16_to_cpu(prsp->body.context.rsp.proc_id) == proc_id)) { + return 0; + } + return AS10X_CMD_ERROR; } ^ permalink raw reply [flat|nested] 91+ messages in thread
* [RESEND PATCH 8/14] staging/media/as102: checkpatch fixes 2011-10-18 9:12 ` [PATCH 8/14] " Piotr Chmura @ 2011-10-18 19:58 ` Piotr Chmura 0 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 19:58 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318909 18000 # Node ID 89de57601df871f6d951ca13bf52b136f9eadddf # Parent 152825226bec049f947a844bea2c530fc9269ae5 as102: checkpatch fixes From: Devin Heitmueller <dheitmueller@kernellabs.com> Fix make checkpatch issues reported against as10x_cmd_cfg.c. Priority: normal Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff --git linux/drivers/staging/media/as102/as10x_cmd_cfg.c linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c --- linux/drivers/staging/media/as102/as10x_cmd_cfg.c +++ linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c @@ -2,8 +2,6 @@ \file as10x_cmd_cfg.c - \version $Id$ - \author: S. Martinelli ----------------------------------------------------------------------------\n @@ -22,7 +20,8 @@ #include <linux/kernel.h> #include "as102_drv.h" #elif defined(WIN32) - #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) /* win32 ddk implementation */ + #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) + /* win32 ddk implementation */ #include "wdm.h" #include "Device.h" #include "endian_mgmt.h" /* FIXME */ @@ -59,52 +58,52 @@ int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag, uint32_t *pvalue) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.context.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.context.req)); - /* fill command */ - pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); - pcmd->body.context.req.tag = cpu_to_le16(tag); - pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA); + /* fill command */ + pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); + pcmd->body.context.req.tag = cpu_to_le16(tag); + pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA); - /* send command */ - if(phandle->ops->xfer_cmd) { - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.context.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.context.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.context.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.context.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response: context command do not follow the common response */ - /* structure -> specific handling response parse required */ - error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); + /* parse response: context command do not follow the common response */ + /* structure -> specific handling response parse required */ + error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); - if(error == 0) { - /* Response OK -> get response data */ - *pvalue = le32_to_cpu(prsp->body.context.rsp.reg_val.u.value32); - /* value returned is always a 32-bit value */ - } + if (error == 0) { + /* Response OK -> get response data */ + *pvalue = le32_to_cpu(prsp->body.context.rsp.reg_val.u.value32); + /* value returned is always a 32-bit value */ + } out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -118,47 +117,48 @@ int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag, uint32_t value) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.context.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.context.req)); - /* fill command */ - pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); - /* pcmd->body.context.req.reg_val.mode initialization is not required */ - pcmd->body.context.req.reg_val.u.value32 = cpu_to_le32(value); - pcmd->body.context.req.tag = cpu_to_le16(tag); - pcmd->body.context.req.type = cpu_to_le16(SET_CONTEXT_DATA); + /* fill command */ + pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT); + /* pcmd->body.context.req.reg_val.mode initialization is not required */ + pcmd->body.context.req.reg_val.u.value32 = cpu_to_le32(value); + pcmd->body.context.req.tag = cpu_to_le16(tag); + pcmd->body.context.req.type = cpu_to_le16(SET_CONTEXT_DATA); - /* send command */ - if(phandle->ops->xfer_cmd){ - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.context.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.context.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, + (uint8_t *) pcmd, + sizeof(pcmd->body.context.req) + + HEADER_SIZE, + (uint8_t *) prsp, + sizeof(prsp->body.context.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response: context command do not follow the common response */ - /* structure -> specific handling response parse required */ - error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); + /* parse response: context command do not follow the common response */ + /* structure -> specific handling response parse required */ + error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -175,45 +175,43 @@ */ int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode) { - int error; - struct as10x_cmd_t *pcmd, *prsp; + int error; + struct as10x_cmd_t *pcmd, *prsp; - ENTER(); + ENTER(); - pcmd = phandle->cmd; - prsp = phandle->rsp; + pcmd = phandle->cmd; + prsp = phandle->rsp; - /* prepare command */ - as10x_cmd_build(pcmd, (++phandle->cmd_xid), - sizeof(pcmd->body.cfg_change_mode.req)); + /* prepare command */ + as10x_cmd_build(pcmd, (++phandle->cmd_xid), + sizeof(pcmd->body.cfg_change_mode.req)); - /* fill command */ - pcmd->body.cfg_change_mode.req.proc_id = - cpu_to_le16(CONTROL_PROC_ELNA_CHANGE_MODE); - pcmd->body.cfg_change_mode.req.mode = mode; + /* fill command */ + pcmd->body.cfg_change_mode.req.proc_id = + cpu_to_le16(CONTROL_PROC_ELNA_CHANGE_MODE); + pcmd->body.cfg_change_mode.req.mode = mode; - /* send command */ - if(phandle->ops->xfer_cmd){ - error = phandle->ops->xfer_cmd(phandle, - (uint8_t *) pcmd, - sizeof(pcmd->body.cfg_change_mode.req) + HEADER_SIZE, - (uint8_t *) prsp, - sizeof(prsp->body.cfg_change_mode.rsp) + HEADER_SIZE); - } - else{ - error = AS10X_CMD_ERROR; - } + /* send command */ + if (phandle->ops->xfer_cmd) { + error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, + sizeof(pcmd->body.cfg_change_mode.req) + + HEADER_SIZE, (uint8_t *) prsp, + sizeof(prsp->body.cfg_change_mode.rsp) + + HEADER_SIZE); + } else { + error = AS10X_CMD_ERROR; + } - if(error < 0) { - goto out; - } + if (error < 0) + goto out; - /* parse response */ - error = as10x_rsp_parse(prsp, CONTROL_PROC_ELNA_CHANGE_MODE_RSP); + /* parse response */ + error = as10x_rsp_parse(prsp, CONTROL_PROC_ELNA_CHANGE_MODE_RSP); out: - LEAVE(); - return(error); + LEAVE(); + return error; } /** @@ -225,15 +223,15 @@ ABILIS_RC_NOK \callgraph */ -int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) { +int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id) +{ + int err; - int err; + err = prsp->body.context.rsp.error; - err = prsp->body.context.rsp.error; - - if((err == 0) && - (le16_to_cpu(prsp->body.context.rsp.proc_id) == proc_id)) { - return 0; - } - return AS10X_CMD_ERROR; + if ((err == 0) && + (le16_to_cpu(prsp->body.context.rsp.proc_id) == proc_id)) { + return 0; + } + return AS10X_CMD_ERROR; } ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 9/14] staging/media/as102: Add Elgato EyeTV DTT Deluxe [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> ` (7 preceding siblings ...) 2011-10-18 9:12 ` [PATCH 8/14] " Piotr Chmura @ 2011-10-18 9:12 ` Piotr Chmura 2011-10-18 19:59 ` [RESEND PATCH " Piotr Chmura 2011-10-18 9:12 ` [PATCH 10/14] staging/media/as102: properly handle multiple product names Piotr Chmura ` (4 subsequent siblings) 13 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:12 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318991 18000 # Node ID 4a82558f6df8b957bc623d854a118a5da32dead2 # Parent 89de57601df871f6d951ca13bf52b136f9eadddf as102: Add Elgato EyeTV DTT Deluxe From: Devin Heitmueller <dheitmueller@kernellabs.com> Add support for the Elgato EyeTV DTT Deluxe. Note that the product name field has not yet been abstracted out, so it will still identify itself as a PCTV 74e. The driver was originally built by the chipset manufacturer so that the product vendor can specify the deivce name via a #define, but wasn't setup to support multiple products from the same build of the driver. Thanks to Joerg Unglaub for suggesting this change. Priority: normal Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> Cc: Joerg Unglaub <joerg.unglaub@gmail.com> diff --git linux/drivers/staging/media/as102/as102_usb_drv.c linuxb/drivers/staging/media/as102/as102_usb_drv.c --- linux/drivers/staging/media/as102/as102_usb_drv.c +++ linuxb/drivers/staging/media/as102/as102_usb_drv.c @@ -40,6 +40,7 @@ static struct usb_device_id as102_usb_id_table[] = { { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) }, { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) }, + { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) }, { } /* Terminating entry */ }; diff --git linux/drivers/staging/media/as102/as102_usb_drv.h linuxb/drivers/staging/media/as102/as102_usb_drv.h --- linux/drivers/staging/media/as102/as102_usb_drv.h +++ linuxb/drivers/staging/media/as102/as102_usb_drv.h @@ -36,6 +36,11 @@ #define PCTV_74E_USB_VID 0x2013 #define PCTV_74E_USB_PID 0x0246 +/* Elgato: EyeTV DTT Deluxe */ +#define ELGATO_EYETV_DTT_NAME "Elgato EyeTV DTT Deluxe" +#define ELGATO_EYETV_DTT_USB_VID 0x0fd9 +#define ELGATO_EYETV_DTT_USB_PID 0x002c + #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)) void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs); #else ^ permalink raw reply [flat|nested] 91+ messages in thread
* [RESEND PATCH 9/14] staging/media/as102: Add Elgato EyeTV DTT Deluxe 2011-10-18 9:12 ` [PATCH 9/14] staging/media/as102: Add Elgato EyeTV DTT Deluxe Piotr Chmura @ 2011-10-18 19:59 ` Piotr Chmura 0 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 19:59 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267318991 18000 # Node ID 4a82558f6df8b957bc623d854a118a5da32dead2 # Parent 89de57601df871f6d951ca13bf52b136f9eadddf as102: Add Elgato EyeTV DTT Deluxe From: Devin Heitmueller <dheitmueller@kernellabs.com> Add support for the Elgato EyeTV DTT Deluxe. Note that the product name field has not yet been abstracted out, so it will still identify itself as a PCTV 74e. The driver was originally built by the chipset manufacturer so that the product vendor can specify the deivce name via a #define, but wasn't setup to support multiple products from the same build of the driver. Thanks to Joerg Unglaub for suggesting this change. Priority: normal Signed-off-by: Joerg Unglaub <joerg.unglaub@gmail.com> Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff --git linux/drivers/staging/media/as102/as102_usb_drv.c linuxb/drivers/staging/media/as102/as102_usb_drv.c --- linux/drivers/staging/media/as102/as102_usb_drv.c +++ linuxb/drivers/staging/media/as102/as102_usb_drv.c @@ -40,6 +40,7 @@ static struct usb_device_id as102_usb_id_table[] = { { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) }, { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) }, + { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) }, { } /* Terminating entry */ }; diff --git linux/drivers/staging/media/as102/as102_usb_drv.h linuxb/drivers/staging/media/as102/as102_usb_drv.h --- linux/drivers/staging/media/as102/as102_usb_drv.h +++ linuxb/drivers/staging/media/as102/as102_usb_drv.h @@ -36,6 +36,11 @@ #define PCTV_74E_USB_VID 0x2013 #define PCTV_74E_USB_PID 0x0246 +/* Elgato: EyeTV DTT Deluxe */ +#define ELGATO_EYETV_DTT_NAME "Elgato EyeTV DTT Deluxe" +#define ELGATO_EYETV_DTT_USB_VID 0x0fd9 +#define ELGATO_EYETV_DTT_USB_PID 0x002c + #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)) void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs); #else ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 10/14] staging/media/as102: properly handle multiple product names [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> ` (8 preceding siblings ...) 2011-10-18 9:12 ` [PATCH 9/14] staging/media/as102: Add Elgato EyeTV DTT Deluxe Piotr Chmura @ 2011-10-18 9:12 ` Piotr Chmura 2011-10-18 20:02 ` [RESEND PATCH " Piotr Chmura 2011-10-18 9:13 ` [PATCH 11/14] staging/media/as102: fix compile warning about unused function Piotr Chmura ` (3 subsequent siblings) 13 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:12 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment:# HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267319051 18000 # Node ID 22ef1bdca69a2781abf397c53a0f7f6125f5359a # Parent 4a82558f6df8b957bc623d854a118a5da32dead2 as102: properly handle multiple product names From: Devin Heitmueller <dheitmueller@kernellabs.com> Properly handle the case where the driver can be associated with multiple different products (as opposed to always saying the device is named after the value in a #define Priority: normal Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> diff --git linux/drivers/staging/media/as102/as102_drv.c linuxb/drivers/media/dvb/as102/as102_drv.c --- linux/drivers/staging/media/as102/as102_drv.c +++ linuxb/drivers/staging/media/as102/as102_drv.c @@ -209,7 +209,7 @@ #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) ret = dvb_register_adapter(&as102_dev->dvb_adap, - DEVICE_FULL_NAME, + as102_dev->name, THIS_MODULE, #if defined(CONFIG_AS102_USB) &as102_dev->bus_adap.usb_dev->dev diff --git linux/drivers/staging/media/as102/as102_drv.h linuxb/drivers/media/dvb/as102/as102_drv.h --- linux/drivers/staging/media/as102/as102_drv.h +++ linuxb/drivers/staging/media/as102/as102_drv.h @@ -106,6 +106,7 @@ }; struct as102_dev_t { + const char *name; struct as102_bus_adapter_t bus_adap; struct list_head device_entry; struct kref kref; diff --git linux/drivers/staging/media/as102/as102_fe.c linuxb/drivers/media/dvb/as102/as102_fe.c --- linux/drivers/staging/media/as102/as102_fe.c +++ linuxb/drivers/staging/media/as102/as102_fe.c @@ -346,7 +346,7 @@ static struct dvb_frontend_ops as102_fe_ops = { .info = { - .name = DEVICE_FULL_NAME, + .name = "Unknown AS102 device", .type = FE_OFDM, .frequency_min = 174000000, .frequency_max = 862000000, @@ -408,6 +408,8 @@ /* init frontend callback ops */ memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops)); + strncpy(dvb_fe->ops.info.name, as102_dev->name, + sizeof(dvb_fe->ops.info.name)); /* register dbvb frontend */ errno = dvb_register_frontend(dvb_adap, dvb_fe); diff --git linux/drivers/staging/media/as102/as102_usb_drv.c linuxb/drivers/media/dvb/as102/as102_usb_drv.c --- linux/drivers/staging/media/as102/as102_usb_drv.c +++ linuxb/drivers/staging/media/as102/as102_usb_drv.c @@ -44,6 +44,15 @@ { } /* Terminating entry */ }; +/* Note that this table must always have the same number of entries as the + as102_usb_id_table struct */ +static const char *as102_device_names[] = { + AS102_REFERENCE_DESIGN, + AS102_PCTV_74E, + AS102_ELGATO_EYETV_DTT_NAME, + NULL /* Terminating entry */ +}; + struct usb_driver as102_usb_driver = { .name = DRIVER_FULL_NAME, .probe = as102_usb_probe, @@ -344,6 +353,7 @@ { int ret; struct as102_dev_t *as102_dev; + int i; ENTER(); @@ -353,6 +363,23 @@ return -ENOMEM; } + /* This should never actually happen */ + if ((sizeof(as102_usb_id_table) / sizeof(struct usb_device_id)) != + (sizeof(as102_device_names) / sizeof(const char *))) { + printk(KERN_ERR "Device names table invalid size"); + return -EINVAL; + } + + /* Assign the user-friendly device name */ + for (i = 0; i < (sizeof(as102_usb_id_table) / + sizeof(struct usb_device_id)); i++) { + if (id == &as102_usb_id_table[i]) + as102_dev->name = as102_device_names[i]; + } + + if (as102_dev->name == NULL) + as102_dev->name = "Unknown AS102 device"; + /* set private callback functions */ as102_dev->bus_adap.ops = &as102_priv_ops; diff --git linux/drivers/staging/media/as102/as102_usb_drv.h linuxb/drivers/media/dvb/as102/as102_usb_drv.h --- linux/drivers/staging/media/as102/as102_usb_drv.h +++ linuxb/drivers/staging/media/as102/as102_usb_drv.h @@ -28,16 +28,17 @@ /* define these values to match the supported devices */ /* Abilis system: "TITAN" */ +#define AS102_REFERENCE_DESIGN "Abilis Systems DVB-Titan" #define AS102_USB_DEVICE_VENDOR_ID 0x1BA6 #define AS102_USB_DEVICE_PID_0001 0x0001 /* PCTV Systems: PCTV picoStick (74e) */ -#define DEVICE_FULL_NAME "PCTV Systems : PCTV picoStick (74e)" +#define AS102_PCTV_74E "PCTV Systems picoStick (74e)" #define PCTV_74E_USB_VID 0x2013 #define PCTV_74E_USB_PID 0x0246 /* Elgato: EyeTV DTT Deluxe */ -#define ELGATO_EYETV_DTT_NAME "Elgato EyeTV DTT Deluxe" +#define AS102_ELGATO_EYETV_DTT_NAME "Elgato EyeTV DTT Deluxe" #define ELGATO_EYETV_DTT_USB_VID 0x0fd9 #define ELGATO_EYETV_DTT_USB_PID 0x002c ^ permalink raw reply [flat|nested] 91+ messages in thread
* [RESEND PATCH 10/14] staging/media/as102: properly handle multiple product names 2011-10-18 9:12 ` [PATCH 10/14] staging/media/as102: properly handle multiple product names Piotr Chmura @ 2011-10-18 20:02 ` Piotr Chmura 2011-10-18 20:28 ` Joe Perches 0 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 20:02 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment:# HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267319051 18000 # Node ID 22ef1bdca69a2781abf397c53a0f7f6125f5359a # Parent 4a82558f6df8b957bc623d854a118a5da32dead2 as102: properly handle multiple product names From: Devin Heitmueller <dheitmueller@kernellabs.com> Properly handle the case where the driver can be associated with multiple different products (as opposed to always saying the device is named after the value in a #define Priority: normal Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff --git linux/drivers/staging/media/as102/as102_drv.c linuxb/drivers/staging/media/as102/as102_drv.c --- linux/drivers/staging/media/as102/as102_drv.c +++ linuxb/drivers/staging/media/as102/as102_drv.c @@ -209,7 +209,7 @@ #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE) ret = dvb_register_adapter(&as102_dev->dvb_adap, - DEVICE_FULL_NAME, + as102_dev->name, THIS_MODULE, #if defined(CONFIG_AS102_USB) &as102_dev->bus_adap.usb_dev->dev diff --git linux/drivers/staging/media/as102/as102_drv.h linuxb/drivers/staging/media/as102/as102_drv.h --- linux/drivers/staging/media/as102/as102_drv.h +++ linuxb/drivers/staging/media/as102/as102_drv.h @@ -106,6 +106,7 @@ }; struct as102_dev_t { + const char *name; struct as102_bus_adapter_t bus_adap; struct list_head device_entry; struct kref kref; diff --git linux/drivers/staging/media/as102/as102_fe.c linuxb/drivers/staging/media/as102/as102_fe.c --- linux/drivers/staging/media/as102/as102_fe.c +++ linuxb/drivers/staging/media/as102/as102_fe.c @@ -346,7 +346,7 @@ static struct dvb_frontend_ops as102_fe_ops = { .info = { - .name = DEVICE_FULL_NAME, + .name = "Unknown AS102 device", .type = FE_OFDM, .frequency_min = 174000000, .frequency_max = 862000000, @@ -408,6 +408,8 @@ /* init frontend callback ops */ memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops)); + strncpy(dvb_fe->ops.info.name, as102_dev->name, + sizeof(dvb_fe->ops.info.name)); /* register dbvb frontend */ errno = dvb_register_frontend(dvb_adap, dvb_fe); diff --git linux/drivers/staging/media/as102/as102_usb_drv.c linuxb/drivers/staging/media/as102/as102_usb_drv.c --- linux/drivers/staging/media/as102/as102_usb_drv.c +++ linuxb/drivers/staging/media/as102/as102_usb_drv.c @@ -44,6 +44,15 @@ { } /* Terminating entry */ }; +/* Note that this table must always have the same number of entries as the + as102_usb_id_table struct */ +static const char *as102_device_names[] = { + AS102_REFERENCE_DESIGN, + AS102_PCTV_74E, + AS102_ELGATO_EYETV_DTT_NAME, + NULL /* Terminating entry */ +}; + struct usb_driver as102_usb_driver = { .name = DRIVER_FULL_NAME, .probe = as102_usb_probe, @@ -344,6 +353,7 @@ { int ret; struct as102_dev_t *as102_dev; + int i; ENTER(); @@ -353,6 +363,23 @@ return -ENOMEM; } + /* This should never actually happen */ + if ((sizeof(as102_usb_id_table) / sizeof(struct usb_device_id)) != + (sizeof(as102_device_names) / sizeof(const char *))) { + printk(KERN_ERR "Device names table invalid size"); + return -EINVAL; + } + + /* Assign the user-friendly device name */ + for (i = 0; i < (sizeof(as102_usb_id_table) / + sizeof(struct usb_device_id)); i++) { + if (id == &as102_usb_id_table[i]) + as102_dev->name = as102_device_names[i]; + } + + if (as102_dev->name == NULL) + as102_dev->name = "Unknown AS102 device"; + /* set private callback functions */ as102_dev->bus_adap.ops = &as102_priv_ops; diff --git linux/drivers/staging/media/as102/as102_usb_drv.h linuxb/drivers/staging/media/as102/as102_usb_drv.h --- linux/drivers/staging/media/as102/as102_usb_drv.h +++ linuxb/drivers/staging/media/as102/as102_usb_drv.h @@ -28,16 +28,17 @@ /* define these values to match the supported devices */ /* Abilis system: "TITAN" */ +#define AS102_REFERENCE_DESIGN "Abilis Systems DVB-Titan" #define AS102_USB_DEVICE_VENDOR_ID 0x1BA6 #define AS102_USB_DEVICE_PID_0001 0x0001 /* PCTV Systems: PCTV picoStick (74e) */ -#define DEVICE_FULL_NAME "PCTV Systems : PCTV picoStick (74e)" +#define AS102_PCTV_74E "PCTV Systems picoStick (74e)" #define PCTV_74E_USB_VID 0x2013 #define PCTV_74E_USB_PID 0x0246 /* Elgato: EyeTV DTT Deluxe */ -#define ELGATO_EYETV_DTT_NAME "Elgato EyeTV DTT Deluxe" +#define AS102_ELGATO_EYETV_DTT_NAME "Elgato EyeTV DTT Deluxe" #define ELGATO_EYETV_DTT_USB_VID 0x0fd9 #define ELGATO_EYETV_DTT_USB_PID 0x002c ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 10/14] staging/media/as102: properly handle multiple product names 2011-10-18 20:02 ` [RESEND PATCH " Piotr Chmura @ 2011-10-18 20:28 ` Joe Perches 2011-10-18 20:54 ` Piotr Chmura 0 siblings, 1 reply; 91+ messages in thread From: Joe Perches @ 2011-10-18 20:28 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, devel, Devin Heitmueller, Patrick Dickey, Greg KH, Stefan Richter, LMML On Tue, 2011-10-18 at 22:02 +0200, Piotr Chmura wrote: > Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ [] > diff --git linux/drivers/staging/media/as102/as102_fe.c linuxb/drivers/staging/media/as102/as102_fe.c [] > @@ -408,6 +408,8 @@ > > /* init frontend callback ops */ > memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops)); > + strncpy(dvb_fe->ops.info.name, as102_dev->name, > + sizeof(dvb_fe->ops.info.name)); strlcpy? ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 10/14] staging/media/as102: properly handle multiple product names 2011-10-18 20:28 ` Joe Perches @ 2011-10-18 20:54 ` Piotr Chmura 2011-10-18 20:56 ` Greg KH 2011-10-18 20:58 ` Joe Perches 0 siblings, 2 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 20:54 UTC (permalink / raw) To: Joe Perches Cc: Mauro Carvalho Chehab, devel, Devin Heitmueller, Patrick Dickey, Greg KH, Stefan Richter, LMML On Tue, 18 Oct 2011 13:28:39 -0700 Joe Perches <joe@perches.com> wrote: > On Tue, 2011-10-18 at 22:02 +0200, Piotr Chmura wrote: > > Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ > [] > > diff --git linux/drivers/staging/media/as102/as102_fe.c linuxb/drivers/staging/media/as102/as102_fe.c > [] > > @@ -408,6 +408,8 @@ > > > > /* init frontend callback ops */ > > memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops)); > > + strncpy(dvb_fe->ops.info.name, as102_dev->name, > > + sizeof(dvb_fe->ops.info.name)); > > strlcpy? > > Can be, but not during moving from another repo. There will be time for such fixes in kernel tree. Am I right ? ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 10/14] staging/media/as102: properly handle multiple product names 2011-10-18 20:54 ` Piotr Chmura @ 2011-10-18 20:56 ` Greg KH 2011-10-18 20:58 ` Joe Perches 1 sibling, 0 replies; 91+ messages in thread From: Greg KH @ 2011-10-18 20:56 UTC (permalink / raw) To: Piotr Chmura Cc: Joe Perches, Mauro Carvalho Chehab, devel, Devin Heitmueller, Patrick Dickey, Stefan Richter, LMML On Tue, Oct 18, 2011 at 10:54:08PM +0200, Piotr Chmura wrote: > On Tue, 18 Oct 2011 13:28:39 -0700 > Joe Perches <joe@perches.com> wrote: > > > On Tue, 2011-10-18 at 22:02 +0200, Piotr Chmura wrote: > > > Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ > > [] > > > diff --git linux/drivers/staging/media/as102/as102_fe.c linuxb/drivers/staging/media/as102/as102_fe.c > > [] > > > @@ -408,6 +408,8 @@ > > > > > > /* init frontend callback ops */ > > > memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops)); > > > + strncpy(dvb_fe->ops.info.name, as102_dev->name, > > > + sizeof(dvb_fe->ops.info.name)); > > > > strlcpy? > > > > > > Can be, but not during moving from another repo. > There will be time for such fixes in kernel tree. > Am I right ? Yes, you are correct, focus on getting the code into the tree first, then work on fixing up the issues. greg k-h ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 10/14] staging/media/as102: properly handle multiple product names 2011-10-18 20:54 ` Piotr Chmura 2011-10-18 20:56 ` Greg KH @ 2011-10-18 20:58 ` Joe Perches 1 sibling, 0 replies; 91+ messages in thread From: Joe Perches @ 2011-10-18 20:58 UTC (permalink / raw) To: Piotr Chmura Cc: Mauro Carvalho Chehab, devel, Devin Heitmueller, Patrick Dickey, Greg KH, Stefan Richter, LMML On Tue, 2011-10-18 at 22:54 +0200, Piotr Chmura wrote: > On Tue, 18 Oct 2011 13:28:39 -0700 > Joe Perches <joe@perches.com> wrote: > > On Tue, 2011-10-18 at 22:02 +0200, Piotr Chmura wrote: > > > Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ > > [] > > > diff --git linux/drivers/staging/media/as102/as102_fe.c linuxb/drivers/staging/media/as102/as102_fe.c > > [] > > > @@ -408,6 +408,8 @@ > > > > > > /* init frontend callback ops */ > > > memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops)); > > > + strncpy(dvb_fe->ops.info.name, as102_dev->name, > > > + sizeof(dvb_fe->ops.info.name)); > > strlcpy? > Can be, but not during moving from another repo. I don't know nor care much really which of these patches are direct moves from another repo and which are "cleanups". It does appear that only patch 1 is a move from some repository to the kernel tree and all the rest are cleanups though. > There will be time for such fixes in kernel tree. > Am I right ? Oh sure, just pointing out what looks odd. cheers, Joe ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 11/14] staging/media/as102: fix compile warning about unused function [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> ` (9 preceding siblings ...) 2011-10-18 9:12 ` [PATCH 10/14] staging/media/as102: properly handle multiple product names Piotr Chmura @ 2011-10-18 9:13 ` Piotr Chmura 2011-10-18 20:03 ` [RESEND PATCH " Piotr Chmura 2011-10-18 9:13 ` [PATCH 12/14] staging/media/as102: fix licensing oversight Piotr Chmura ` (2 subsequent siblings) 13 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:13 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267319685 18000 # Node ID 84b93826c0a19efa114a6808165f91390cb86daa # Parent 22ef1bdca69a2781abf397c53a0f7f6125f5359a as102: fix compile warning about unused function From: Devin Heitmueller <dheitmueller@kernellabs.com> The function in question is only used on old kernels, so we had the call to the function #ifdef'd, but the definition of the function was stil being included. Priority: normal Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> diff --git linux/drivers/staging/media/as102/as102_fe.c linuxb/drivers/media/dvb/as102/as102_fe.c --- linux/drivers/staging/media/as102/as102_fe.c +++ linuxb/drivers/staging/media/as102/as102_fe.c @@ -32,6 +32,7 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst, struct dvb_frontend_parameters *src); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) static void as102_fe_release(struct dvb_frontend *fe) { struct as102_dev_t *dev; @@ -42,7 +43,6 @@ if (dev == NULL) return; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) if (mutex_lock_interruptible(&dev->bus_adap.lock)) return; @@ -50,7 +50,6 @@ as10x_cmd_turn_off(&dev->bus_adap); mutex_unlock(&dev->bus_adap.lock); -#endif /* release frontend callback ops */ memset(&fe->ops, 0, sizeof(struct dvb_frontend_ops)); @@ -66,7 +65,6 @@ LEAVE(); } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) static int as102_fe_init(struct dvb_frontend *fe) { int ret = 0; ^ permalink raw reply [flat|nested] 91+ messages in thread
* [RESEND PATCH 11/14] staging/media/as102: fix compile warning about unused function 2011-10-18 9:13 ` [PATCH 11/14] staging/media/as102: fix compile warning about unused function Piotr Chmura @ 2011-10-18 20:03 ` Piotr Chmura 2011-10-30 20:04 ` Sylwester Nawrocki 0 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 20:03 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment: # HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267319685 18000 # Node ID 84b93826c0a19efa114a6808165f91390cb86daa # Parent 22ef1bdca69a2781abf397c53a0f7f6125f5359a as102: fix compile warning about unused function From: Devin Heitmueller <dheitmueller@kernellabs.com> The function in question is only used on old kernels, so we had the call to the function #ifdef'd, but the definition of the function was stil being included. Priority: normal Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff --git linux/drivers/staging/media/as102/as102_fe.c linuxb/drivers/staging/media/as102/as102_fe.c --- linux/drivers/staging/media/as102/as102_fe.c +++ linuxb/drivers/staging/media/as102/as102_fe.c @@ -32,6 +32,7 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst, struct dvb_frontend_parameters *src); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) static void as102_fe_release(struct dvb_frontend *fe) { struct as102_dev_t *dev; @@ -42,7 +43,6 @@ if (dev == NULL) return; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) if (mutex_lock_interruptible(&dev->bus_adap.lock)) return; @@ -50,7 +50,6 @@ as10x_cmd_turn_off(&dev->bus_adap); mutex_unlock(&dev->bus_adap.lock); -#endif /* release frontend callback ops */ memset(&fe->ops, 0, sizeof(struct dvb_frontend_ops)); @@ -66,7 +65,6 @@ LEAVE(); } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)) static int as102_fe_init(struct dvb_frontend *fe) { int ret = 0; ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 11/14] staging/media/as102: fix compile warning about unused function 2011-10-18 20:03 ` [RESEND PATCH " Piotr Chmura @ 2011-10-30 20:04 ` Sylwester Nawrocki 2011-10-30 21:15 ` Stefan Richter 0 siblings, 1 reply; 91+ messages in thread From: Sylwester Nawrocki @ 2011-10-30 20:04 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Piotr Chmura, devel, Devin Heitmueller, Patrick Dickey, Greg KH, Stefan Richter, LMML On 10/18/2011 10:03 PM, Piotr Chmura wrote: > Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ > > Original source and comment: > # HG changeset patch > # User Devin Heitmueller<dheitmueller@kernellabs.com> > # Date 1267319685 18000 > # Node ID 84b93826c0a19efa114a6808165f91390cb86daa > # Parent 22ef1bdca69a2781abf397c53a0f7f6125f5359a > as102: fix compile warning about unused function > > From: Devin Heitmueller<dheitmueller@kernellabs.com> > > The function in question is only used on old kernels, so we had the call to > the function #ifdef'd, but the definition of the function was stil being > included. > > Priority: normal > > Signed-off-by: Devin Heitmueller<dheitmueller@kernellabs.com> > Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> > > diff --git linux/drivers/staging/media/as102/as102_fe.c linuxb/drivers/staging/media/as102/as102_fe.c > --- linux/drivers/staging/media/as102/as102_fe.c > +++ linuxb/drivers/staging/media/as102/as102_fe.c > @@ -32,6 +32,7 @@ > static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst, > struct dvb_frontend_parameters *src); > > +#if (LINUX_VERSION_CODE< KERNEL_VERSION(2, 6, 19)) I was wondering, could such a conditional compilation be simply skipped when we are merging the driver into exactly known kernel version ? For backports there are separate patches at media_build.git and I can't see such an approach used in any driver upstream. -- Regards, Sylwester ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: [RESEND PATCH 11/14] staging/media/as102: fix compile warning about unused function 2011-10-30 20:04 ` Sylwester Nawrocki @ 2011-10-30 21:15 ` Stefan Richter 0 siblings, 0 replies; 91+ messages in thread From: Stefan Richter @ 2011-10-30 21:15 UTC (permalink / raw) To: Sylwester Nawrocki Cc: Mauro Carvalho Chehab, Piotr Chmura, devel, Devin Heitmueller, Patrick Dickey, Greg KH, LMML On Oct 30 Sylwester Nawrocki wrote: > On 10/18/2011 10:03 PM, Piotr Chmura wrote: > > Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ [...] > > +#if (LINUX_VERSION_CODE< KERNEL_VERSION(2, 6, 19)) > > I was wondering, could such a conditional compilation be simply skipped when > we are merging the driver into exactly known kernel version ? > For backports there are separate patches at media_build.git and I can't see > such an approach used in any driver upstream. Compatibility code is in fact not allowed anymore upstream. But AFAIU, this patch here does not have such a cleanup in its scope. If the compat removal isn't already included later on in Piotr's series, it will be done later before this driver can be moved out of staging. -- Stefan Richter -=====-==-== =-=- ====- http://arcgraph.de/sr/ ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 12/14] staging/media/as102: fix licensing oversight [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> ` (10 preceding siblings ...) 2011-10-18 9:13 ` [PATCH 11/14] staging/media/as102: fix compile warning about unused function Piotr Chmura @ 2011-10-18 9:13 ` Piotr Chmura 2011-10-18 20:05 ` [RESEND PATCH " Piotr Chmura 2011-10-18 9:13 ` [PATCH 13/14] staging/media/as102: fix compile Piotr Chmura 2011-10-18 9:13 ` [PATCH 14/14] staging/media/as102: add nBox Tuner Dongle support Piotr Chmura 13 siblings, 1 reply; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:13 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment:# HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267577404 18000 # Node ID 8557cb6da3e71a350a538e3a0eb41126884289b9 # Parent 84b93826c0a19efa114a6808165f91390cb86daa as102: fix licensing oversight From: Pierrick Hascoet <pierrick.hascoet@abilis.com> Fix a couple of files which were supposed by be relicensed as GPL but were overlooked. Priority: normal Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> Cc: Devin Heitmueller <dheitmueller@kernellabs.com> Cc: Pierrick Hascoet <pierrick.hascoet@abilis.com> diff --git linux/drivers/staging/media/as102/as10x_cmd_cfg.c linuxb/drivers/media/dvb/as102/as10x_cmd_cfg.c --- linux/drivers/staging/media/as102/as10x_cmd_cfg.c +++ linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c @@ -1,20 +1,21 @@ -/** - - \file as10x_cmd_cfg.c - - \author: S. Martinelli - - ----------------------------------------------------------------------------\n - (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n - www.abilis.com \n - ----------------------------------------------------------------------------\n - - \brief AS10x API, configuration services - - AS10x cmd management: build command buffer, send command through - selected port and wait for the response when required. - -*/ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */ #include <linux/kernel.h> diff --git linux/drivers/staging/media/as102/as10x_cmd_stream.c linuxb/drivers/media/dvb/as102/as10x_cmd_stream.c --- linux/drivers/staging/media/as102/as10x_cmd_stream.c +++ linuxb/drivers/staging/media/as102/as10x_cmd_stream.c @@ -1,22 +1,21 @@ -/** - - \file as10x_cmd_stream.c - - \author: S. Martinelli - - ----------------------------------------------------------------------------\n - (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n - www.abilis.com \n - ----------------------------------------------------------------------------\n - - \brief AS10x CMD, stream services - - AS10x CMD management: build command buffer, send command through - selected port and wait for the response when required. - -*/ - - +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */ #include <linux/kernel.h> #include "as102_drv.h" ^ permalink raw reply [flat|nested] 91+ messages in thread
* [RESEND PATCH 12/14] staging/media/as102: fix licensing oversight 2011-10-18 9:13 ` [PATCH 12/14] staging/media/as102: fix licensing oversight Piotr Chmura @ 2011-10-18 20:05 ` Piotr Chmura 0 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 20:05 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/ Original source and comment:# HG changeset patch # User Devin Heitmueller <dheitmueller@kernellabs.com> # Date 1267577404 18000 # Node ID 8557cb6da3e71a350a538e3a0eb41126884289b9 # Parent 84b93826c0a19efa114a6808165f91390cb86daa as102: fix licensing oversight From: Pierrick Hascoet <pierrick.hascoet@abilis.com> Fix a couple of files which were supposed by be relicensed as GPL but were overlooked. Priority: normal Signed-off-by: Pierrick Hascoet <pierrick.hascoet@abilis.com> Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff --git linux/drivers/staging/media/as102/as10x_cmd_cfg.c linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c --- linux/drivers/staging/media/as102/as10x_cmd_cfg.c +++ linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c @@ -1,20 +1,21 @@ -/** - - \file as10x_cmd_cfg.c - - \author: S. Martinelli - - ----------------------------------------------------------------------------\n - (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n - www.abilis.com \n - ----------------------------------------------------------------------------\n - - \brief AS10x API, configuration services - - AS10x cmd management: build command buffer, send command through - selected port and wait for the response when required. - -*/ +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */ #include <linux/kernel.h> diff --git linux/drivers/staging/media/as102/as10x_cmd_stream.c linuxb/drivers/staging/media/as102/as10x_cmd_stream.c --- linux/drivers/staging/media/as102/as10x_cmd_stream.c +++ linuxb/drivers/staging/media/as102/as10x_cmd_stream.c @@ -1,22 +1,21 @@ -/** - - \file as10x_cmd_stream.c - - \author: S. Martinelli - - ----------------------------------------------------------------------------\n - (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n - www.abilis.com \n - ----------------------------------------------------------------------------\n - - \brief AS10x CMD, stream services - - AS10x CMD management: build command buffer, send command through - selected port and wait for the response when required. - -*/ - - +/* + * Abilis Systems Single DVB-T Receiver + * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */ #include <linux/kernel.h> #include "as102_drv.h" ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 13/14] staging/media/as102: fix compile [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> ` (11 preceding siblings ...) 2011-10-18 9:13 ` [PATCH 12/14] staging/media/as102: fix licensing oversight Piotr Chmura @ 2011-10-18 9:13 ` Piotr Chmura 2011-10-18 9:13 ` [PATCH 14/14] staging/media/as102: add nBox Tuner Dongle support Piotr Chmura 13 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:13 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Replace usb_buffer_free() and usb_buffer_alloc() by usb_free_coherent() and usb_alloc_coherent() making it compile in current tree. Add driver to parent Makefile and Kconfig Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff -Nur linux.as102.pulled/drivers/staging/Kconfig linux.as102.compiling/drivers/staging/Kconfig --- linux.as102.pulled/drivers/staging/Kconfig 2011-10-14 15:26:42.000000000 +0200 +++ linux.as102.compiling/drivers/staging/Kconfig 2011-10-17 22:26:48.000000000 +0200 @@ -150,4 +150,6 @@ source "drivers/staging/nvec/Kconfig" +source "drivers/staging/media/as102/Kconfig" + endif # STAGING diff -Nur linux.as102.pulled/drivers/staging/Makefile linux.as102.compiling/drivers/staging/Makefile --- linux.as102.pulled/drivers/staging/Makefile 2011-10-14 15:26:42.000000000 +0200 +++ linux.as102.compiling/drivers/staging/Makefile 2011-10-17 22:17:39.439874425 +0200 @@ -66,3 +66,4 @@ obj-$(CONFIG_DRM_PSB) += gma500/ obj-$(CONFIG_INTEL_MEI) += mei/ obj-$(CONFIG_MFD_NVEC) += nvec/ +obj-$(CONFIG_DVB_AS102) += media/as102/ diff -Nur linux.as102.pulled/drivers/staging/media/as102/as102_usb_drv.c linux.as102.compiling/drivers/staging/media/as102/as102_usb_drv.c --- linux.as102.pulled/drivers/staging/media/as102/as102_usb_drv.c 2011-10-17 22:05:15.996841251 +0200 +++ linux.as102.compiling/drivers/staging/media/as102/as102_usb_drv.c 2011-10-17 22:22:33.317887538 +0200 @@ -238,7 +238,7 @@ for (i = 0; i < MAX_STREAM_URB; i++) usb_free_urb(dev->stream_urb[i]); - usb_buffer_free(dev->bus_adap.usb_dev, + usb_free_coherent(dev->bus_adap.usb_dev, MAX_STREAM_URB * AS102_USB_BUF_SIZE, dev->stream, dev->dma_addr); @@ -251,7 +251,7 @@ ENTER(); - dev->stream = usb_buffer_alloc(dev->bus_adap.usb_dev, + dev->stream = usb_alloc_coherent(dev->bus_adap.usb_dev, MAX_STREAM_URB * AS102_USB_BUF_SIZE, GFP_KERNEL, &dev->dma_addr); ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 14/14] staging/media/as102: add nBox Tuner Dongle support [not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl> ` (12 preceding siblings ...) 2011-10-18 9:13 ` [PATCH 13/14] staging/media/as102: fix compile Piotr Chmura @ 2011-10-18 9:13 ` Piotr Chmura 13 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-18 9:13 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Devin Heitmueller, Stefan Richter, Greg KH, Patrick Dickey, LMML, devel Add support for nBox Tuner Dongle based on the same chip. Signed-off-by: Piotr Chmura <chmooreck@poczta.onet.pl> diff -Nur linux.as102.01-initial/drivers/staging/media/as102/as102_usb_drv.c linux.as102.02-nbox/drivers/staging/media/as102/as102_usb_drv.c --- linux.as102.01-initial/drivers/staging/media/as102/as102_usb_drv.c 2011-10-14 18:00:19.000000000 +0200 +++ linux.as102.02-nbox/drivers/staging/media/as102/as102_usb_drv.c 2011-10-14 18:21:36.000000000 +0200 @@ -41,6 +41,7 @@ { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) }, { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) }, { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) }, + { USB_DEVICE(NBOX_DVBT_DONGLE_USB_VID, NBOX_DVBT_DONGLE_USB_PID) }, { } /* Terminating entry */ }; @@ -50,6 +51,7 @@ AS102_REFERENCE_DESIGN, AS102_PCTV_74E, AS102_ELGATO_EYETV_DTT_NAME, + AS102_NBOX_DVBT_DONGLE_NAME, NULL /* Terminating entry */ }; diff -Nur linux.as102.01-initial/drivers/staging/as102/as102_usb_drv.h linux.as102.02-nbox/drivers/staging/as102/as102_usb_drv.h --- linux.as102.01-initial/drivers/staging/media/as102/as102_usb_drv.h 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.02-nbox/drivers/staging/media/as102/as102_usb_drv.h 2011-10-14 18:20:32.000000000 +0200 @@ -42,6 +42,11 @@ #define ELGATO_EYETV_DTT_USB_VID 0x0fd9 #define ELGATO_EYETV_DTT_USB_PID 0x002c +/* nBox: nBox DVB-T Dongle */ +#define AS102_NBOX_DVBT_DONGLE_NAME "nBox DVB-T Dongle" +#define NBOX_DVBT_DONGLE_USB_VID 0x0b89 +#define NBOX_DVBT_DONGLE_USB_PID 0x0007 + #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)) void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs); #else ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 6/7] staging/as102: cleanup - get rid of editor comments [not found] ` <4E999733.2010802@poczta.onet.pl> 2011-10-15 20:54 ` [PATCH 1/7] Staging submission: PCTV 74e driver (as102) Piotr Chmura @ 2011-10-15 20:55 ` Piotr Chmura 2011-10-15 20:55 ` [PATCH 7/7] staging/as102: cleanup - get rid unnecessary LINUX and WIN32 defines Piotr Chmura 2 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-15 20:55 UTC (permalink / raw) To: Stefan Richter Cc: Greg KH, Devin Heitmueller, Mauro Carvalho Chehab, Patrick Dickey, LMML, devel staging/as102: cleanup - get rid of editor comments Cleanup code: Delete vim formatting comments. Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> Cc: Devin Heitmueller<dheitmueller@kernellabs.com> Cc: Greg HK<gregkh@suse.de> diff -Nur linux.as102.05-pragmapack/drivers/staging/as102/as102_drv.c linux.as102.06-editor/drivers/staging/as102/as102_drv.c --- linux.as102.05-pragmapack/drivers/staging/as102/as102_drv.c 2011-10-14 23:20:05.000000000 +0200 +++ linux.as102.06-editor/drivers/staging/as102/as102_drv.c 2011-10-14 23:42:30.000000000 +0200 @@ -356,5 +356,3 @@ MODULE_DESCRIPTION(DRIVER_FULL_NAME); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Pierrick Hascoet<pierrick.hascoet@abilis.com>"); - -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.as102.05-pragmapack/drivers/staging/as102/as102_drv.h linux.as102.06-editor/drivers/staging/as102/as102_drv.h --- linux.as102.05-pragmapack/drivers/staging/as102/as102_drv.h 2011-10-14 22:21:58.000000000 +0200 +++ linux.as102.06-editor/drivers/staging/as102/as102_drv.h 2011-10-14 23:42:40.000000000 +0200 @@ -143,5 +143,3 @@ int as102_dvb_register_fe(struct as102_dev_t *dev, struct dvb_frontend *fe); int as102_dvb_unregister_fe(struct dvb_frontend *dev); #endif - -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.as102.05-pragmapack/drivers/staging/as102/as102_fe.c linux.as102.06-editor/drivers/staging/as102/as102_fe.c --- linux.as102.05-pragmapack/drivers/staging/as102/as102_fe.c 2011-10-14 23:21:51.000000000 +0200 +++ linux.as102.06-editor/drivers/staging/as102/as102_fe.c 2011-10-14 23:42:47.000000000 +0200 @@ -671,5 +671,3 @@ } } #endif - -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.as102.05-pragmapack/drivers/staging/as102/as102_fw.c linux.as102.06-editor/drivers/staging/as102/as102_fw.c --- linux.as102.05-pragmapack/drivers/staging/as102/as102_fw.c 2011-10-14 23:22:33.000000000 +0200 +++ linux.as102.06-editor/drivers/staging/as102/as102_fw.c 2011-10-14 23:42:54.000000000 +0200 @@ -247,5 +247,3 @@ return errno; } #endif - -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.as102.05-pragmapack/drivers/staging/as102/as102_fw.h linux.as102.06-editor/drivers/staging/as102/as102_fw.h --- linux.as102.05-pragmapack/drivers/staging/as102/as102_fw.h 2011-10-14 23:38:24.000000000 +0200 +++ linux.as102.06-editor/drivers/staging/as102/as102_fw.h 2011-10-14 23:43:00.000000000 +0200 @@ -36,5 +36,3 @@ #ifdef __KERNEL__ int as102_fw_upload(struct as102_bus_adapter_t *bus_adap); #endif - -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.as102.05-pragmapack/drivers/staging/as102/as102_usb_drv.c linux.as102.06-editor/drivers/staging/as102/as102_usb_drv.c --- linux.as102.05-pragmapack/drivers/staging/as102/as102_usb_drv.c 2011-10-14 23:23:14.000000000 +0200 +++ linux.as102.06-editor/drivers/staging/as102/as102_usb_drv.c 2011-10-14 23:43:07.000000000 +0200 @@ -482,5 +482,3 @@ } MODULE_DEVICE_TABLE(usb, as102_usb_id_table); - -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.as102.05-pragmapack/drivers/staging/as102/as102_usb_drv.h linux.as102.06-editor/drivers/staging/as102/as102_usb_drv.h --- linux.as102.05-pragmapack/drivers/staging/as102/as102_usb_drv.h 2011-10-14 22:22:15.000000000 +0200 +++ linux.as102.06-editor/drivers/staging/as102/as102_usb_drv.h 2011-10-14 23:43:13.000000000 +0200 @@ -61,4 +61,3 @@ struct as10x_cmd_t r; }; #endif -/* EOF - vim: set textwidth=80 ts=8 sw=8 sts=8 noet: */ diff -Nur linux.as102.05-pragmapack/drivers/staging/as102/as10x_cmd.h linux.as102.06-editor/drivers/staging/as102/as10x_cmd.h --- linux.as102.05-pragmapack/drivers/staging/as102/as10x_cmd.h 2011-10-14 23:39:06.000000000 +0200 +++ linux.as102.06-editor/drivers/staging/as102/as10x_cmd.h 2011-10-14 23:43:20.000000000 +0200 @@ -534,4 +534,3 @@ } #endif #endif -/* EOF - vim: set textwidth=80 ts=3 sw=3 sts=3 et: */ ^ permalink raw reply [flat|nested] 91+ messages in thread
* [PATCH 7/7] staging/as102: cleanup - get rid unnecessary LINUX and WIN32 defines [not found] ` <4E999733.2010802@poczta.onet.pl> 2011-10-15 20:54 ` [PATCH 1/7] Staging submission: PCTV 74e driver (as102) Piotr Chmura 2011-10-15 20:55 ` [PATCH 6/7] staging/as102: cleanup - get rid of editor comments Piotr Chmura @ 2011-10-15 20:55 ` Piotr Chmura 2 siblings, 0 replies; 91+ messages in thread From: Piotr Chmura @ 2011-10-15 20:55 UTC (permalink / raw) To: Stefan Richter Cc: Greg KH, Devin Heitmueller, Mauro Carvalho Chehab, Patrick Dickey, LMML, devel staging/as102: cleanup - get rid unnecessary LINUX and WIN32 defines Cleanup code: Remove of unnecessary defines WIN32 and LINUX. We are always on linux so code (includes) for WIN32 compatibility is totally useless. Signed-off-by: Piotr Chmura<chmooreck@poczta.onet.pl> Cc: Devin Heitmueller<dheitmueller@kernellabs.com> Cc: Greg HK<gregkh@suse.de> diff -Nur linux.as102.06-editor/drivers/staging/as102/as10x_cmd.c linux.as102.07-defines/drivers/staging/as102/as10x_cmd.c --- linux.as102.06-editor/drivers/staging/as102/as10x_cmd.c 2011-10-14 23:25:27.000000000 +0200 +++ linux.as102.07-defines/drivers/staging/as102/as10x_cmd.c 2011-10-14 23:46:57.000000000 +0200 @@ -18,29 +18,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#if defined(LINUX)&& defined(__KERNEL__) /* linux kernel implementation */ #include<linux/kernel.h> #include "as102_drv.h" -#elif defined(WIN32) -#if defined(__BUILDMACHINE__)&& (__BUILDMACHINE__ == WinDDK) -/* win32 ddk implementation */ -#include "wdm.h" -#include "Device.h" -#include "endian_mgmt.h" /* FIXME */ -#else /* win32 sdk implementation */ -#include<windows.h> -#include "types.h" -#include "util.h" -#include "as10x_handle.h" -#include "endian_mgmt.h" -#endif -#else /* all other cases */ -#include<string.h> -#include "types.h" -#include "util.h" -#include "as10x_handle.h" -#include "endian_mgmt.h" /* FIXME */ -#endif /* __KERNEL__ */ #include "as10x_types.h" #include "as10x_cmd.h" diff -Nur linux.as102.06-editor/drivers/staging/as102/as10x_cmd_cfg.c linux.as102.07-defines/drivers/staging/as102/as10x_cmd_cfg.c --- linux.as102.06-editor/drivers/staging/as102/as10x_cmd_cfg.c 2011-10-14 23:24:05.000000000 +0200 +++ linux.as102.07-defines/drivers/staging/as102/as10x_cmd_cfg.c 2011-10-14 23:46:32.000000000 +0200 @@ -17,29 +17,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#if defined(LINUX)&& defined(__KERNEL__) /* linux kernel implementation */ #include<linux/kernel.h> #include "as102_drv.h" -#elif defined(WIN32) -#if defined(__BUILDMACHINE__)&& (__BUILDMACHINE__ == WinDDK) -/* win32 ddk implementation */ -#include "wdm.h" -#include "Device.h" -#include "endian_mgmt.h" /* FIXME */ -#else /* win32 sdk implementation */ -#include<windows.h> -#include "types.h" -#include "util.h" -#include "as10x_handle.h" -#include "endian_mgmt.h" -#endif -#else /* all other cases */ -#include<string.h> -#include "types.h" -#include "util.h" -#include "as10x_handle.h" -#include "endian_mgmt.h" /* FIXME */ -#endif /* __KERNEL__ */ #include "as10x_types.h" #include "as10x_cmd.h" diff -Nur linux.as102.06-editor/drivers/staging/as102/as10x_cmd_stream.c linux.as102.07-defines/drivers/staging/as102/as10x_cmd_stream.c --- linux.as102.06-editor/drivers/staging/as102/as10x_cmd_stream.c 2011-10-14 23:24:32.000000000 +0200 +++ linux.as102.07-defines/drivers/staging/as102/as10x_cmd_stream.c 2011-10-14 23:46:46.000000000 +0200 @@ -16,28 +16,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#if defined(LINUX)&& defined(__KERNEL__) /* linux kernel implementation */ #include<linux/kernel.h> #include "as102_drv.h" -#elif defined(WIN32) -#if defined(DDK) /* win32 ddk implementation */ -#include "wdm.h" -#include "Device.h" -#include "endian_mgmt.h" /* FIXME */ -#else /* win32 sdk implementation */ -#include<windows.h> -#include "types.h" -#include "util.h" -#include "as10x_handle.h" -#include "endian_mgmt.h" -#endif -#else /* all other cases */ -#include<string.h> -#include "types.h" -#include "util.h" -#include "as10x_handle.h" -#include "endian_mgmt.h" /* FIXME */ -#endif /* __KERNEL__ */ #include "as10x_cmd.h" diff -Nur linux.as102.06-editor/drivers/staging/as102/Makefile linux.as102.07-defines/drivers/staging/as102/Makefile --- linux.as102.06-editor/drivers/staging/as102/Makefile 2011-10-14 17:55:02.000000000 +0200 +++ linux.as102.07-defines/drivers/staging/as102/Makefile 2011-10-14 23:47:30.000000000 +0200 @@ -2,4 +2,4 @@ obj-$(CONFIG_DVB_AS102) += dvb-as102.o -EXTRA_CFLAGS += -DLINUX -DCONFIG_AS102_USB -Idrivers/media/dvb/dvb-core +EXTRA_CFLAGS += -DCONFIG_AS102_USB -Idrivers/media/dvb/dvb-core ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Problems cloning the git repostories 2011-09-25 13:55 ` Devin Heitmueller 2011-09-26 3:25 ` Mauro Carvalho Chehab @ 2011-10-30 21:09 ` Marek Vasut 1 sibling, 0 replies; 91+ messages in thread From: Marek Vasut @ 2011-10-30 21:09 UTC (permalink / raw) To: Devin Heitmueller; +Cc: Patrick Dickey, LMML > On Sun, Sep 25, 2011 at 8:33 AM, Patrick Dickey <pdickeybeta@gmail.com> wrote: > > Hello there, > > > > I tried to follow the steps for cloning both the "media_tree.git" and > > "media_build.git" repositories, and received errors for both. The > > media_tree repository failed on the first line > > > >> git clone > >> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git > >> v4l-dvb > > > > which I'm assuming is because kernel.org is down. > > > > The media_build.git repository fails on the first line also > > > >> git clone git://linuxtv.org/media_build.git > > > > with a fatal: read error: Connection reset by peer. > > > > Is it possible to clone either (or both) repositories at this time, or > > are they down? And in the absence of cloning the kernel for the > > media_tree.git repository, is it possible to simply clone the > > git://linuxtv.org/media_tree.git repository and work from that? > > > > My interest in this is to install some patches created by Devin > > Heitmueller for the Pinnacle PCTV 80e USB tuner (at least the ATSC > > portion of the tuner). Once I'm able to determine exactly what changes > > are made, I would like to either submit the patches to the repository, > > or send them to someone who has more experience in patching the files > > for submission. > > > > One other question (totally unrelated to this post though): When I send > > emails, normally they are GPG signed. Should I disable that for this > > list, or is it acceptable? > > > > Thank you for any information, and have a great day:) > > Patrick. > > Hi Patrick, > > As I said on the blog, the issue isn't getting the driver to work > against current kernels. Merging the driver against the current tree > is a trivial exercise (the patch series should apply trivially against > the current code, with only a few minor conflicts related to board > numbers, etc). > > The bigger issue though is once you do that and have the driver > running, you now have a body of code > 10,000 lines which doesn't meet > the "coding standards". Doing such a refactoring is a relatively > straightforward exercise but very time consuming (you already have a > working driver, so you just have to make sure you don't break > anything). > > The more I think about this, the more it annoys me. I did all the hard > parts: > > * I worked with the product vendor to get the details for the design > * I got Hauppauge/PCTV to compel the chipset vendor to release the > reference code under a GPL compatible license > * I worked out redistribution terms on the firmware > * I ported the driver to Linux > * I integrated the driver and debugged it to achieve signal lock > > And why is it not in the mainline? Because none of the above matters > if I didn't waste a bunch of my time removing a bunch of "#ifdef > WINDOWS" lines and converting whitespace from tabs to spaces. > > It's crap like this that's the reason why some of the best LinuxTV > driver authors still have a bunch of stuff that isn't merged upstream. > We just don't have time for this sort of bullshit that any monkey > could do if he/she was willing to invest the effort. We're just too > busy doing *actual* driver work. > > Five years ago the hard part was finding competent developers, getting > access to datasheets, getting access to reference driver code, and > getting access to the details for a hardware design. Now most of > those problems are not the issue - we have access to all the data but > we want to waste the time of the few competent developers out there > making them do "coding style cleanup" before perfectly good code gets > merged upstream. There has been more than one case where I've > considered doing a driver for a new board and decided against it > because the barrier to getting it upstream is not worth my time. > > Want to see more device support upstream? Optimize the process to > make it easy for the people who know the hardware and how to write the > drivers to get code upstream, and leave it to the "janitors" to work > out the codingstyle issues. Mate, I feel sorry for you :-( ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Problems cloning the git repostories 2011-09-25 12:33 Problems cloning the git repostories Patrick Dickey 2011-09-25 13:55 ` Devin Heitmueller @ 2011-09-25 14:53 ` Anca Emanuel 2011-09-25 18:03 ` Johannes Stezenbach 2 siblings, 0 replies; 91+ messages in thread From: Anca Emanuel @ 2011-09-25 14:53 UTC (permalink / raw) To: Patrick Dickey; +Cc: LMML On Sun, Sep 25, 2011 at 3:33 PM, Patrick Dickey <pdickeybeta@gmail.com> wrote: > Hello there, > > I tried to follow the steps for cloning both the "media_tree.git" and > "media_build.git" repositories, and received errors for both. The > media_tree repository failed on the first line > >> git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git v4l-dvb > > which I'm assuming is because kernel.org is down. > > The media_build.git repository fails on the first line also > >> git clone git://linuxtv.org/media_build.git > > with a fatal: read error: Connection reset by peer. > The linux tree is at: https://github.com/torvalds/linux git clone git://github.com/torvalds/linux.git The Mauro's media tree is at: http://git.linuxtv.org/mchehab/media-next.git ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Problems cloning the git repostories 2011-09-25 12:33 Problems cloning the git repostories Patrick Dickey 2011-09-25 13:55 ` Devin Heitmueller 2011-09-25 14:53 ` Anca Emanuel @ 2011-09-25 18:03 ` Johannes Stezenbach 2011-09-26 2:56 ` Mauro Carvalho Chehab 2 siblings, 1 reply; 91+ messages in thread From: Johannes Stezenbach @ 2011-09-25 18:03 UTC (permalink / raw) To: Patrick Dickey; +Cc: LMML On Sun, Sep 25, 2011 at 07:33:57AM -0500, Patrick Dickey wrote: > > I tried to follow the steps for cloning both the "media_tree.git" and > "media_build.git" repositories, and received errors for both. The > media_tree repository failed on the first line > > > git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git v4l-dvb > > which I'm assuming is because kernel.org is down. > > The media_build.git repository fails on the first line also > > > git clone git://linuxtv.org/media_build.git > > with a fatal: read error: Connection reset by peer. The git error should be fixed now. But please don't clone from linuxtv.org, intead use git clone git://github.com/torvalds/linux.git and then add linuxtv to your repo like described on http://git.linuxtv.org/media_tree.git Johannes ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Problems cloning the git repostories 2011-09-25 18:03 ` Johannes Stezenbach @ 2011-09-26 2:56 ` Mauro Carvalho Chehab 2011-09-26 10:15 ` Scott Jiang 2011-09-26 11:27 ` Patrick Dickey 0 siblings, 2 replies; 91+ messages in thread From: Mauro Carvalho Chehab @ 2011-09-26 2:56 UTC (permalink / raw) To: Johannes Stezenbach; +Cc: Patrick Dickey, LMML Em 25-09-2011 15:03, Johannes Stezenbach escreveu: > On Sun, Sep 25, 2011 at 07:33:57AM -0500, Patrick Dickey wrote: >> >> I tried to follow the steps for cloning both the "media_tree.git" and >> "media_build.git" repositories, and received errors for both. The >> media_tree repository failed on the first line >> >>> git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git v4l-dvb >> >> which I'm assuming is because kernel.org is down. >> >> The media_build.git repository fails on the first line also >> >>> git clone git://linuxtv.org/media_build.git >> >> with a fatal: read error: Connection reset by peer. > > The git error should be fixed now. > > But please don't clone from linuxtv.org, intead use > git clone git://github.com/torvalds/linux.git > and then add linuxtv to your repo like described on > http://git.linuxtv.org/media_tree.git I've updated the instructions together with the git tree to point to the github tree. Btw, the media_build had an issue due to the move of tm6000 and altera-stapl out of staging. I've fixed it. At least here with 3.0 kernel, everything is compiling fine. Cheers, Mauro > > > Johannes > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Problems cloning the git repostories 2011-09-26 2:56 ` Mauro Carvalho Chehab @ 2011-09-26 10:15 ` Scott Jiang 2011-09-26 19:24 ` Johannes Stezenbach 2011-09-26 11:27 ` Patrick Dickey 1 sibling, 1 reply; 91+ messages in thread From: Scott Jiang @ 2011-09-26 10:15 UTC (permalink / raw) To: Mauro Carvalho Chehab; +Cc: Johannes Stezenbach, Patrick Dickey, LMML 2011/9/26 Mauro Carvalho Chehab <maurochehab@gmail.com>: > Em 25-09-2011 15:03, Johannes Stezenbach escreveu: >> On Sun, Sep 25, 2011 at 07:33:57AM -0500, Patrick Dickey wrote: >>> >>> I tried to follow the steps for cloning both the "media_tree.git" and >>> "media_build.git" repositories, and received errors for both. The >>> media_tree repository failed on the first line >>> >>>> git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git v4l-dvb >>> >>> which I'm assuming is because kernel.org is down. >>> >>> The media_build.git repository fails on the first line also >>> >>>> git clone git://linuxtv.org/media_build.git >>> >>> with a fatal: read error: Connection reset by peer. >> >> The git error should be fixed now. >> >> But please don't clone from linuxtv.org, intead use >> git clone git://github.com/torvalds/linux.git >> and then add linuxtv to your repo like described on >> http://git.linuxtv.org/media_tree.git > > I've updated the instructions together with the git tree to point to the > github tree. > I followed your instructions using http instead, but I found it's not up to date. scott@scott-desktop:~/Projects/git-kernel/v4l-dvb$ git log commit 69d232ae8e95a229e7544989d6014e875deeb121 Author: Sakari Ailus <sakari.ailus@iki.fi> Date: Wed Jun 15 15:58:48 2011 -0300 [media] omap3isp: ccdc: Use generic frame sync event instead of private HS_VS event scott@scott-desktop:~/Projects/git-kernel/v4l-dvb$ git remote -v linuxtv http://linuxtv.org/git/media_tree.git (fetch) linuxtv http://linuxtv.org/git/media_tree.git (push) origin http://github.com/torvalds/linux.git (fetch) origin http://github.com/torvalds/linux.git (push) Can anybody tell me why? ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Problems cloning the git repostories 2011-09-26 10:15 ` Scott Jiang @ 2011-09-26 19:24 ` Johannes Stezenbach 0 siblings, 0 replies; 91+ messages in thread From: Johannes Stezenbach @ 2011-09-26 19:24 UTC (permalink / raw) To: Scott Jiang; +Cc: Mauro Carvalho Chehab, Patrick Dickey, LMML On Mon, Sep 26, 2011 at 06:15:07PM +0800, Scott Jiang wrote: > 2011/9/26 Mauro Carvalho Chehab <maurochehab@gmail.com>: > > Em 25-09-2011 15:03, Johannes Stezenbach escreveu: > >> > >> But please don't clone from linuxtv.org, intead use > >> git clone git://github.com/torvalds/linux.git > >> and then add linuxtv to your repo like described on > >> http://git.linuxtv.org/media_tree.git > > > > I've updated the instructions together with the git tree to point to the > > github tree. > > > I followed your instructions using http instead, but I found it's not > up to date. What I meant is the follow the instructions on the http://git.linuxtv.org/media_tree.git web page, to use git:// protocol: git remote add linuxtv git://linuxtv.org/media_tree.git git remote update git checkout -b media-master remotes/linuxtv/staging/for_v3.2 Anyway, I did the git update-server-info thing so http should work, too. But git over http sucks, if you can then use git protocol. Johannes ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: Problems cloning the git repostories 2011-09-26 2:56 ` Mauro Carvalho Chehab 2011-09-26 10:15 ` Scott Jiang @ 2011-09-26 11:27 ` Patrick Dickey 1 sibling, 0 replies; 91+ messages in thread From: Patrick Dickey @ 2011-09-26 11:27 UTC (permalink / raw) To: Mauro Carvalho Chehab; +Cc: Johannes Stezenbach, LMML -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I ran into that issue yesterday, but figured that I'd caused enough of a headache asking about the problems already--so I decided to wait and see if it was fixed this morning. Thank you (even though I didn't report the issue), and have a great day:) Patrick. On 09/25/2011 09:56 PM, Mauro Carvalho Chehab wrote: > Em 25-09-2011 15:03, Johannes Stezenbach escreveu: >> On Sun, Sep 25, 2011 at 07:33:57AM -0500, Patrick Dickey wrote: >>> >>> I tried to follow the steps for cloning both the "media_tree.git" and >>> "media_build.git" repositories, and received errors for both. The >>> media_tree repository failed on the first line >>> >>>> git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git v4l-dvb >>> >>> which I'm assuming is because kernel.org is down. >>> >>> The media_build.git repository fails on the first line also >>> >>>> git clone git://linuxtv.org/media_build.git >>> >>> with a fatal: read error: Connection reset by peer. >> >> The git error should be fixed now. >> >> But please don't clone from linuxtv.org, intead use >> git clone git://github.com/torvalds/linux.git >> and then add linuxtv to your repo like described on >> http://git.linuxtv.org/media_tree.git > > I've updated the instructions together with the git tree to point to the > github tree. > > Btw, the media_build had an issue due to the move of tm6000 and altera-stapl > out of staging. I've fixed it. At least here with 3.0 kernel, everything > is compiling fine. > > Cheers, > Mauro >> >> >> Johannes >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-media" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk6AYZ0ACgkQMp6rvjb3CAQj1QCffarBsYJw3Dx8sowrXF0i0gnF tugAoKBFVFcRcX8jHyQM1vMKpX3qz6Ks =GGGa -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 91+ messages in thread
end of thread, other threads:[~2011-10-31 11:47 UTC | newest]
Thread overview: 91+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-25 12:33 Problems cloning the git repostories Patrick Dickey
2011-09-25 13:55 ` Devin Heitmueller
2011-09-26 3:25 ` Mauro Carvalho Chehab
2011-09-27 2:20 ` Devin Heitmueller
2011-09-27 7:44 ` Staging submission: PCTV 80e and PCTV 74e drivers (was Re: Problems cloning the git repostories) Stefan Richter
2011-09-27 17:43 ` Greg KH
2011-09-27 19:33 ` Stefan Richter
2011-10-15 20:54 ` [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup (was: Staging submission: PCTV 80e and PCTV 74e drivers) Piotr Chmura
2011-10-17 22:31 ` Greg KH
2011-10-19 12:36 ` Staging questions: WAS Re: [PATCH 0/7] Staging submission: PCTV 74e drivers and some cleanup Patrick Dickey
2011-10-19 13:57 ` Devin Heitmueller
2011-10-20 3:44 ` Mauro Carvalho Chehab
2011-10-20 10:53 ` Patrick Dickey
2011-10-20 11:22 ` Mauro Carvalho Chehab
[not found] ` <4E9992F9.7000101@poczta.onet.pl>
2011-10-15 20:54 ` [PATCH 2/7] staging/as102: add new device nBox DVB-T Dongle Piotr Chmura
2011-10-15 20:54 ` [PATCH 3/7] staging/as102: cleanup - get rid of typedefs Piotr Chmura
2011-10-15 20:54 ` [PATCH 4/7] staging/as102: cleanup - formatting code Piotr Chmura
2011-10-16 12:23 ` Julian Andres Klode
2011-10-16 12:40 ` Devin Heitmueller
2011-10-16 21:53 ` Dan Carpenter
2011-10-15 20:54 ` [PATCH 5/7] staging as102: cleanup - get rid of pragma(pack) Piotr Chmura
[not found] ` <4E999733.2010802@poczta.onet.pl>
2011-10-15 20:54 ` [PATCH 1/7] Staging submission: PCTV 74e driver (as102) Piotr Chmura
2011-10-16 8:57 ` Stefan Richter
2011-10-16 11:45 ` Devin Heitmueller
2011-10-16 13:44 ` Mauro Carvalho Chehab
2011-10-18 9:10 ` [PATCH 0/14] staging/media/as102: new driver submission (was " Piotr Chmura
2011-10-18 15:52 ` Devin Heitmueller
2011-10-18 17:20 ` Piotr Chmura
2011-10-19 11:41 ` Javier Martinez Canillas
2011-10-19 11:44 ` Mauro Carvalho Chehab
2011-10-19 13:07 ` Piotr Chmura
[not found] ` <20111018094647.d4982eb2.chmooreck@poczta.onet.pl>
2011-10-18 9:11 ` [PATCH 1/14] staging/media/as102: initial import from Abilis Piotr Chmura
2011-10-18 16:24 ` Dan Carpenter
2011-10-18 16:38 ` Mauro Carvalho Chehab
2011-10-18 22:33 ` Dan Carpenter
2011-10-18 19:46 ` [RESEND PATCH " Piotr Chmura
2011-10-30 21:03 ` Piotr Chmura
2011-10-30 21:25 ` Stefan Richter
2011-10-31 10:24 ` Sylwester Nawrocki
2011-10-18 9:11 ` [PATCH 2/14] staging/media/as102: checkpatch fixes Piotr Chmura
2011-10-18 19:48 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:11 ` [PATCH 3/14] " Piotr Chmura
2011-10-18 19:50 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:11 ` [PATCH 4/14] " Piotr Chmura
2011-10-18 19:51 ` [RESEND PATCH " Piotr Chmura
2011-10-29 10:22 ` Sylwester Nawrocki
2011-10-29 13:17 ` Piotr Chmura
2011-10-29 16:14 ` Sylwester Nawrocki
2011-10-29 17:48 ` Piotr Chmura
2011-10-29 21:37 ` Sylwester Nawrocki
2011-10-30 7:11 ` [PATCH v3 " Piotr Chmura
2011-10-30 11:17 ` Stefan Richter
2011-10-31 10:48 ` Stefan Richter
2011-10-31 11:47 ` Mauro Carvalho Chehab
2011-10-29 16:25 ` [RESEND PATCH " Piotr Chmura
2011-10-29 16:39 ` Sylwester Nawrocki
2011-10-29 17:00 ` Dan Carpenter
2011-10-18 9:11 ` [PATCH 5/14] " Piotr Chmura
2011-10-18 19:54 ` [RESEND PATCH " Piotr Chmura
2011-10-30 13:53 ` [PATCH v3 " Piotr Chmura
2011-10-18 9:12 ` [PATCH 6/14] " Piotr Chmura
2011-10-18 19:56 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:12 ` [PATCH 7/14] " Piotr Chmura
2011-10-18 19:57 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:12 ` [PATCH 8/14] " Piotr Chmura
2011-10-18 19:58 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:12 ` [PATCH 9/14] staging/media/as102: Add Elgato EyeTV DTT Deluxe Piotr Chmura
2011-10-18 19:59 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:12 ` [PATCH 10/14] staging/media/as102: properly handle multiple product names Piotr Chmura
2011-10-18 20:02 ` [RESEND PATCH " Piotr Chmura
2011-10-18 20:28 ` Joe Perches
2011-10-18 20:54 ` Piotr Chmura
2011-10-18 20:56 ` Greg KH
2011-10-18 20:58 ` Joe Perches
2011-10-18 9:13 ` [PATCH 11/14] staging/media/as102: fix compile warning about unused function Piotr Chmura
2011-10-18 20:03 ` [RESEND PATCH " Piotr Chmura
2011-10-30 20:04 ` Sylwester Nawrocki
2011-10-30 21:15 ` Stefan Richter
2011-10-18 9:13 ` [PATCH 12/14] staging/media/as102: fix licensing oversight Piotr Chmura
2011-10-18 20:05 ` [RESEND PATCH " Piotr Chmura
2011-10-18 9:13 ` [PATCH 13/14] staging/media/as102: fix compile Piotr Chmura
2011-10-18 9:13 ` [PATCH 14/14] staging/media/as102: add nBox Tuner Dongle support Piotr Chmura
2011-10-15 20:55 ` [PATCH 6/7] staging/as102: cleanup - get rid of editor comments Piotr Chmura
2011-10-15 20:55 ` [PATCH 7/7] staging/as102: cleanup - get rid unnecessary LINUX and WIN32 defines Piotr Chmura
2011-10-30 21:09 ` Problems cloning the git repostories Marek Vasut
2011-09-25 14:53 ` Anca Emanuel
2011-09-25 18:03 ` Johannes Stezenbach
2011-09-26 2:56 ` Mauro Carvalho Chehab
2011-09-26 10:15 ` Scott Jiang
2011-09-26 19:24 ` Johannes Stezenbach
2011-09-26 11:27 ` Patrick Dickey
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).