[linux-dvb] Suspend/resume for Mantis 2033 driver

Manu Abraham abraham.manu at gmail.com
Wed Aug 8 11:03:54 CEST 2007

Hi Marko,

On 8/7/07, Marko Ristola <marko.ristola at kolumbus.fi> wrote:
> Hi Manu,
> Here is the first version of the patch
> that will implement Suspend/resume S2DISK
> (no remote control support).
> S2DISK works for me on cu1216.c on kernel.
> For another Mantis device, you have to
> - introduce  tuner_ops.sleep and tuner_ops.init in mantis_dvb.c (two
> lines after dvb_attach(cu1216)).
> - implement fe->ops.init to do something if necessary (I did it on
> cu1216.c).
> - implement fe->ops.set_frontend() to accept NULL for "set those params
> that were active during suspend".
> - If tuner_ops.init is defined, resume in mantis_dvb.c assumes that
> set_frontend() accepts NULL argument.
> I tried to make the patch so, that you could check it into your version
> control as such.
> Unfortunately I couldn't compile your v4l-dvb branch, and thus
> I converted your v4l-dvb branch into the very latest LinuxTV v4l-dvb
> version for testing.

Ok. i will have to port the tree again. Some other changes as well, I
need to add in support for the DVB-S2 cards as well. But it needs a
bit of time from my side on it. I will club it alongwith the DVB-S2

> This patch doesn't include remote control support,
> because mantis_rc.c is not yet in the version control.
> cu1216.c: many small adjustments.
> - Fixes rmmod/insmod "lost frontend" problem.
> - Fixes inversion=1 support requirement for Finland DVB-C.
> - dvb_core is able to reset cu1216 module if it fails.
> dvb/mantis: many suspend related adjustments.
> - Suspend/resume support for S2DISK: it works for cu1216. See
> mantis_dvb.c if you
>   like to add support for other frontend.
> - mantis_dvb.c: will not load all Mantis frontend modules, but just the
> ones that are needed.
> - mantis_dvb.c: will turn off tuner (tuner_ops.sleep) , and turn it on
> again for cu1216.c (tuner_ops.init).
> - mantis_dvb.c: suspend/resume support takes advantage of the tuner
> power functions and fe->ops.set_frontend(fe,NULL) if tuner_ops.init is
> defined.
> - mantis_pci.c: share code with probe and resume and with exit and suspend.
> - mantis_i2c.c: suspend/resume support.
> - mantis_i2c.c: mantis_i2c_init and mantis_i2c_exit altered a lot, but
> those changes aren't necessary anymore.
>     Maybe remove those unnecessary changes?
> - mantis_dma.c: suspend/resume support. mantis_start_dma and
> mantis_stop_dma calls are enough  though.

You wouldn't need to touch I2C/DMA for that. It will Resume as soon as
the PCI device is enabled back. What you will have in the RISC FIFO
will be garbage after you Resume, the only disadvantage is on Resume,
you initially have a few blocks of garbage, but considering the DVB
stream, that's nothing an extremely short period, which might not be
noticeable even in some cases.

What _really_ that's need to be done is:

In the suspend call back
* Switch off tuner power, the function already is there.
* disable the device, this is achieved by the "Suspend code in kernel"
by writing to the PCI config space directly. You don't need to
manually toggle it. Already handled by the PCI Subsystem, AFAIK.

In the resume in the case of the 2033, you just need to tune back,
that's all. in the current code all initialization is by code, rather
than values from an init table. That's the only difference, but that
doesn't make any difference.

>     Maybe just remove all suspend/resume code from mantis_start/stop_dma?
> - mantis_common.h: suspend/resume support. Some suspend status support
> added and introduced some functions.
> - mantis_core.h: suspend/resume support: Introduced some functions.
> - mantis/Makefile: Use += for flags: this is the way in current v4l-dvb
> main branch.



Do you need to do so much ? AFAICS, for suspend/resume you need to do
just very little.
Julian has a tested patch for the KNC1 cards, which makes it look
quite neat. Would appreciate, if you would take a look at it as well.

If you have any comments or need any suggestions/help, please do let me know.

> Now you have my code to be seen and even applied into your Mantis
> branch, if you want.
> mantis_rc.c: This code is not yet to be seen, but at least I had to
> enable Mantis IRQ for
> remote control during resume.
>         Developer's Certificate of Origin 1.1
>         By making a contribution to this project, I certify that:
>         (b) The contribution is based upon previous work that, to the best
>             of my knowledge, is covered under an appropriate open source
>             license and I have the right under that license to submit that
>             work with modifications, whether created in whole or in part
>             by me, under the same open source license (unless I am
>             permitted to submit under a different license), as indicated
>             in the file.
>         (d) I understand and agree that this project and the contribution
>             are public and that a record of the contribution (including all
>             personal information I submit with it, including my sign-off) is
>             maintained indefinitely and may be redistributed consistent with
>             this project or the open source license(s) involved.
> Signed-off-by: Marko M Ristola <marko.ristola at kolumbus.fi>
> Regards,
> Marko Ristola

What all problems that brings in after the recent licensing thread on
some modules for everyone .. Bah.


More information about the linux-dvb mailing list