2005-11-01 08:17:50

by Michael Krufky

[permalink] [raw]
Subject: [PATCH 30/37] dvb: add nxt200x frontend module




Attachments:
2407.patch (35.32 kB)

2005-11-03 04:11:47

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 30/37] dvb: add nxt200x frontend module

Michael Krufky <[email protected]> wrote:
>
>
> From: Kirk Lapray <[email protected]>
>
> * nxt200x.c, nxt200x.h
> - New frontend module that supports both NXT2002 and NXT2004.
> So far, only tested on NXT2004. After testing on NXT2002, we should
> deprecate the nxt2002 module, and implement this one instead on the
> applicable cards.
>
> * get_dvb_firmware:
> - Added support for the NXT2004 firmware. This firmware works with both
> the ATI HDTV Wonder and the AVerTVHD MCE a180.
> This was originally written by Jean-Francois Thibert
>
> * dvb-pll.c
> - Fixed minimum frequency for tuv1236d. It seems that the data sheets
> are wrong.
>
> ...
> +static int nxt200x_writebytes (struct nxt200x_state* state, u8 reg, u8 *buf, u8 len)
> +{
> + u8 buf2 [len+1];

hm, a variable-sized array, with the size defined by the caller. I guess as the size is
in a u8 it's unlikely to cause too much trouble.

(Wonders what the compiler will do if len==255. 256, I think.)

> +static int nxt200x_readreg_multibyte (struct nxt200x_state* state, u8 reg, u8* data, u8 len)
> +{
> + int i;
> + u8 buf, len2, attr;
> + dprintk("%s\n", __FUNCTION__);
> +
> + /* set mutli register register */
> + nxt200x_writebytes(state, 0x35, &reg, 1);
> +
> + switch (state->demod_chip) {
> + case NXT2002:
> + /* set multi register length */
> + len2 = len & 0x80;
> + nxt200x_writebytes(state, 0x34, &len2, 1);
> +
> + /* read the actual data */
> + nxt200x_readbytes(state, reg, data, len);
> + return 0;
> + break;
> + case NXT2004:
> + /* probably not right, but gives correct values */
> + attr = 0x02;
> + if (reg & 0x80) {
> + attr = attr << 1;
> + if (reg & 0x04)
> + attr = attr >> 1;
> + }
> +
> + /* set multi register length */
> + len2 = (attr << 4) | len;
> + nxt200x_writebytes(state, 0x34, &len2, 1);
> +
> + /* toggle the multireg bit*/
> + buf = 0x80;
> + nxt200x_writebytes(state, 0x21, &buf, 1);
> +
> + /* read status */
> + nxt200x_readbytes(state, 0x21, &buf, 1);
> +
> + if (buf == 0)
> + {
> + /* read the actual data */
> + for(i = 0; i < len; i++) {
> + nxt200x_readbytes(state, 0x36 + i, &data[i], 1);
> + }
> + return 0;

whitespace broke.

> + }
> + break;
> + default:
> + return -EINVAL;
> + break;
> + }

We usually indent the body of a switch statement one tab further to the left.

> +
> +static int nxt200x_writetuner (struct nxt200x_state* state, u8* data)
> +{
> + u8 buf, count = 0;
> +
> + dprintk("%s\n", __FUNCTION__);
> +
> + dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]);
> +
> + /* if pll is a Philips TUV1236D then write directly to tuner */
> + if (strcmp(state->config->pll_desc->name, "Philips TUV1236D") == 0) {

Does DVB have a better way of identifying a device type than strcmp?


2005-11-03 22:57:33

by Michael Ira Krufky

[permalink] [raw]
Subject: Re: [PATCH 30/37] dvb: add nxt200x frontend module

Andrew Morton wrote:

>Michael Krufky <[email protected]> wrote:
>
>>+
>>+static int nxt200x_writetuner (struct nxt200x_state* state, u8* data)
>>+{
>>+ u8 buf, count = 0;
>>+
>>+ dprintk("%s\n", __FUNCTION__);
>>+
>>+ dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]);
>>+
>>+ /* if pll is a Philips TUV1236D then write directly to tuner */
>>+ if (strcmp(state->config->pll_desc->name, "Philips TUV1236D") == 0) {
>>
>>
>Does DVB have a better way of identifying a device type than strcmp?
>
>
I said the same thing when I first saw this, but I wanted to send the
patches separately, because Kirk wrote the driver, and I corrected the
above issue in a separate patch:

dvb-determine-tuner-write-method-based-on-nxt-chip.patch

Feel free to fold them if you like... I was only trying to indicate separate authorship.

As for the other comments for the rest of the patch series, some of the fixes are trivial. Should I expect that you will correct these? or do you need me to send you more patches?

For now, I think the corrections should wait for Johannes' return,
unless you want to take care of them. I think he comes back JUST after
the end of the merge window... not quite sure.

I have 3 or 4 more patches coming.... I plan to send before the end of
tonight.

Regards,

Michael Krufky


2005-11-04 05:13:08

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 30/37] dvb: add nxt200x frontend module

Mike Krufky <[email protected]> wrote:
>
> Andrew Morton wrote:
>
> >Michael Krufky <[email protected]> wrote:
> >
> >>+
> >>+static int nxt200x_writetuner (struct nxt200x_state* state, u8* data)
> >>+{
> >>+ u8 buf, count = 0;
> >>+
> >>+ dprintk("%s\n", __FUNCTION__);
> >>+
> >>+ dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]);
> >>+
> >>+ /* if pll is a Philips TUV1236D then write directly to tuner */
> >>+ if (strcmp(state->config->pll_desc->name, "Philips TUV1236D") == 0) {
> >>
> >>
> >Does DVB have a better way of identifying a device type than strcmp?
> >
> >
> I said the same thing when I first saw this, but I wanted to send the
> patches separately, because Kirk wrote the driver, and I corrected the
> above issue in a separate patch:
>
> dvb-determine-tuner-write-method-based-on-nxt-chip.patch
>
> Feel free to fold them if you like... I was only trying to indicate separate authorship.

OK.

> As for the other comments for the rest of the patch series, some of the fixes are trivial. Should I expect that you will correct these? or do you need me to send you more patches?

I got lazy and didn't alter the patches in any way. Mostly this was a
"please do it this way in the future" exercise.

> For now, I think the corrections should wait for Johannes' return,
> unless you want to take care of them. I think he comes back JUST after
> the end of the merge window... not quite sure.

At your convenience.

> I have 3 or 4 more patches coming.... I plan to send before the end of
> tonight.

Oh good. More patches ;)