All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jemma Denson <jdenson@gmail.com>
To: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Patrick Boettcher <patrick.boettcher@posteo.de>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PULL] For 4.2 (or even 4.1?) add support for cx24120/Technisat SkyStar S2
Date: Mon, 27 Apr 2015 22:29:52 +0100	[thread overview]
Message-ID: <553EAA50.4010405@gmail.com> (raw)
In-Reply-To: <20150427171628.5ba22752@recife.lan>

(Resending to fix reply-all)

Hi Mauro,

Thanks for taking the time to look into this. I'll let Patrick respond 
to the first part regards the pull request - I'll just respond to the 
points you've made about the driver itself.

On 27/04/15 21:16, Mauro Carvalho Chehab wrote:
 > +
 > +
 > +/* Write multiple registers */
 > +static int cx24120_writeregN(struct cx24120_state *state,
 > +            u8 reg, const u8 *values, u16 len, u8 incr)
 > +{
 > +    int ret;
 > +    u8 buf[5]; /* maximum 4 data bytes at once - flexcop limitation
 > +            (very limited i2c-interface this one) */
 > Hmm... if the limit is at flexcop, then the best is to not be add such
 > restriction here, but at the flexcop code, and passing the max limit that
 > used for the I2C transfer as a parameter at the attach structure, just
 > like other frontend and tuner drivers do.
I had considered doing that - the cx24116 driver does have i2c_wr_max as 
part of it's config struct. The only reason I didn't however was that I 
did consider that it's now quite unlikely this demod would be used in 
anything else so it could probably safely stay fixed for a while yet.

As you say though it would be nicer as a config item, and it shouldn't 
be too much to add in so I'll look into doing it that way.
 >
 > Also, this limit is hardcoded here. Please use a define instead.
So, if I do have this as a config item then this and the following 
hardcoded values should all disappear...
 >
 >> +
 >> +    struct i2c_msg msg = {
 >> +        .addr = state->config->i2c_addr,
 >> +        .flags = 0,
 >> +        .buf = buf,
 >> +        .len = len };
 >> +
 >> +    while (len) {
 >> +        buf[0] = reg;
 >> +        msg.len = len > 4 ? 4 : len;
 > Again, don't hardcode the max buf size here.

 >
 > +
 > +    /* Wait for tuning */
 > +    while (delay_cnt >= 0) {
 > +        cx24120_read_status(fe, &status);
 > +        if (status & FE_HAS_LOCK)
 > +            goto tuned;
 > +        msleep(20);
 > +        delay_cnt -= 20;
 > +    }
 > I don't see any need for waiting for tune here. This is generally done in
 > userspace and at the kthread inside dvb_frontend.c.
 >
 > Any reason why this has to be done here?

Some point after tuning the cx24120_set_clock_ratios function needs to 
be called and the firmware command CMD_CLOCK_SET sent. The ratios sent 
to this command depend on delivery system, fec & pilot - the latter two 
only available to read after tuning. If this isn't done then the mpeg 
stream doesn't appear.

Is there a better point to set the ratios? Or for another way of asking 
that, is there some other function that will always get hit after tuning?

 > +
 > +/* Calculate vco from config */
 > +static u64 cx24120_calculate_vco(struct cx24120_state *state)
 > +{
 > +    u32 vco;
 > +    u64 inv_vco, res, xxyyzz;
 > +    u32 xtal_khz = state->config->xtal_khz;
 > +
 > +    xxyyzz = 0x400000000ULL;
 > xxyyzz? Weird name for a var.
Yes... one of the oddities left from the dissasembled driver I hadn't 
ironed out yet! I'll look into what it's supposed to be doing and rename 
that to something far more sensible.


As time allows I'll get this fixed up as required - would it be best if 
I send patches to here made against Patrick's tree? I presume also one 
patch for each of the coding styles, and then one patch for each of the 
other issues?


Jemma.



  parent reply	other threads:[~2015-04-27 21:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20  7:27 [PULL] For 4.2 (or even 4.1?) add support for cx24120/Technisat SkyStar S2 Patrick Boettcher
2015-04-27 20:16 ` Mauro Carvalho Chehab
2015-04-27 21:25   ` Patrick Boettcher
2015-04-28  0:40     ` Mauro Carvalho Chehab
2015-04-29 11:35       ` Patrick Boettcher
2015-04-29 11:55         ` Mauro Carvalho Chehab
2015-05-14 21:40           ` Mauro Carvalho Chehab
2015-05-15  8:24             ` Patrick Boettcher
2015-05-15 14:24               ` Mauro Carvalho Chehab
2015-05-15 15:18                 ` Jemma Denson
2015-05-19 10:57                   ` Mauro Carvalho Chehab
2015-05-19 11:25                     ` Jemma Denson
2015-05-19 12:09                       ` Patrick Boettcher
2015-04-27 21:29   ` Jemma Denson [this message]
2015-05-18 10:11   ` [PULL v2] for 4.2: " Patrick Boettcher
2015-05-20  8:05     ` [PULL v3] " Patrick Boettcher
2015-05-20 11:46       ` Jemma Denson
2015-05-20 12:07         ` Mauro Carvalho Chehab
2015-05-20 12:34           ` Patrick Boettcher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=553EAA50.4010405@gmail.com \
    --to=jdenson@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=patrick.boettcher@posteo.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.