All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Trent Piepho <xyzzy@speakeasy.org>
Cc: Takashi Iwai <tiwai@suse.de>, alsa-devel@alsa-project.org
Subject: Re: [PATCH] Improved support for different	bt87x	board configurations
Date: Wed, 05 Sep 2007 07:54:35 +0100	[thread overview]
Message-ID: <1188975275.6158.34.camel@areia> (raw)
In-Reply-To: <Pine.LNX.4.58.0709041339540.31808@shell4.speakeasy.net>

Em Ter, 2007-09-04 às 14:04 -0700, Trent Piepho escreveu:
> On Tue, 4 Sep 2007, Takashi Iwai wrote:
> > At Tue, 04 Sep 2007 14:54:39 +0100,
> > Mauro Carvalho Chehab wrote:
> > > > +       SND_BT87X_BOARD_HAUPPAUGE878,
> > > > +       SND_BT87X_BOARD_OSPREY2x0,
> > > > +       SND_BT87X_BOARD_OSPREY440,
> > > > +       SND_BT87X_BOARD_ATI_TVWONDER,
> > > > +       SND_BT87X_BOARD_WINFAST2000,
> > > > +       SND_BT87X_BOARD_VOODOOTV_200,
> > > > +       SND_BT87X_BOARD_AVPHONE98,
> > >
> > > Hmm... Maybe it would be a good idea to move the board numbers from
> > > linux/drivers/media/video/bt8xx/bttv.h to a separate header (maybe
> > > something like /include/media/bt8xx-cards.h) and use the same board IDs
> > > for both -alsa and -v4l drivers.
> > >
> > > This will make easier to associate the audio and video parts for
> > > troubleshooting and newer developments.
> >
> > Yes, it sounds like a good idea.
> 
> There are few drawbacks.
> 
> First, there are like 20x more cards supported by the bttv driver than by
> the bt87x driver.  It's going to produce a very sparse card database in the
> ALSA driver.  Note that for the most part, __initdata doesn't work, so you
> can't say "it'll just be dropped after the driver loads."

You should notice that even the way you've mapped is a a little sparse,
since just two boards use digital_fmt.

Maybe one solution for that is to use a different code or data
structure. 

For example, instead of using a data struct, you could use some sort of
code like (*) (**):

static void fill_board (struct snd_bt87x_board &board, int board_id)
{
        board->dig_rate = 32000;
        switch (board_id) {
        case BTTV_BOARD_AVPHONE98:
                board.dig_rate = 48000,
		break;
        case BTTV_BOARD_OSPREY2xx:
                board->dig_rate =44100;
                board->digital_fmt = CTL_DA_LRI | (1 << CTL_DA_LRD_SHIFT);
		break;
        case BTTV_BOARD_OSPREY440:
                board->digital_fmt = CTL_DA_LRI | (1 << CTL_DA_LRD_SHIFT);
		break;
        }
}

(*) GCC optimizer probably will even merge the two digital_fmt changes
into just one line of object code, and even transform this into an
inline. I suspect that this code will be smaller than the data struct.

(**) I didn't found where SND_BT87X_BOARD_ANALOG is used. An usage would
be just a case for each analog board, like:
	case BTTV_BOARD_PV_BT878P_PLUS:
	case BTTV_BOARD_PV_BT878P_9B:
		board->no_digital=1;

> Secondly, before this patch there was virtually no difference in the
> configuration for the different supported cards.  After it, most of the
> cards are still exactly the same.  It possible to re-use the same generic
> configuration entry for most of the supported cards.  If you use the bttv
> IDs, it's not.
See above.

> And finally, bt87x is under ALSA but bttv is under linuxtv.  What would
> include/media/bt8xx-cards.h be under, alsa or linuxtv?  Will people have to
> submit patches to both projects (which use different repository formats
> locally, so you can't just CC the same patch)?  I did one patch that
> touched both linuxtv and alsa files, and it was a PITA, for a very simple
> patch.  Took a month.  Emails to different people.  Merge conflicts.

This seems quite simple to me: it makes not much sense to provide ALSA
support if the video is not supported. So, adding a newer board will
always add a new entry at the video support. The opposite is not true,
since most boards have just an analog card to be connected to the video
device. Also, as you said, most boards will just use the default config.

So, the file will be touched more frequently when adding the video
entries. My suggestion is that this file would be maintained together
with the video counterpart. 

> And if both linuxtv and alsa use the same header, what happens if they
> don't push the changes to GIT at the exact same time?  You'll have patches
> in one subsystem that are dependant on the other subsystem.  How will they
> make the same merge window?

This should be coordinated between me and Takashi. I have no objections
if he pull such patch, if he is willing to send the pull request before
myself.

I don't see this as a big trouble. There are other cases like this
already (pci_ids.h, i2c_id.h). Also, currently, there are not much bttv
board additions anymore.

Cheers,
Mauro

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2007-09-05  6:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-30 10:21 [PATCH] Improved support for different bt87x board configurations Trent Piepho
2007-08-30 11:03 ` Takashi Iwai
2007-09-02 23:21   ` Trent Piepho
2007-09-03  6:36     ` Clemens Ladisch
2007-09-04 11:49       ` Trent Piepho
2007-09-04 13:54         ` Mauro Carvalho Chehab
2007-09-04 20:29           ` Takashi Iwai
2007-09-04 21:04             ` Trent Piepho
2007-09-05  6:54               ` Mauro Carvalho Chehab [this message]
2007-09-05  9:09                 ` [alsa-devel] " Trent Piepho
2007-09-05 10:07                   ` Takashi Iwai
2007-09-05 10:32                     ` Mauro Carvalho Chehab
2007-09-05 22:34                       ` Trent Piepho
2007-09-06 20:17                         ` [alsa-devel] " Mauro Carvalho Chehab
2007-09-07 23:50                           ` Takashi Iwai
2007-09-08  0:33                             ` [alsa-devel] " Mauro Carvalho Chehab
2007-09-05 10:16         ` Takashi Iwai
2007-09-05 22:23           ` Trent Piepho
2007-09-06 13:13             ` Takashi Iwai

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=1188975275.6158.34.camel@areia \
    --to=mchehab@infradead.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    --cc=xyzzy@speakeasy.org \
    /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.