示例#1
0
int
main (int argc, char **argv)
{
  FILE *vias_file;


  via_t *via;
  char *a_via;
  char *dest;
  char *res;

  vias_file = fopen (argv[1], "r");
  if (vias_file == NULL)
    {
      fprintf (stdout, "Failed to open %s file.\nUsage: tvia vias.txt\n",
	       argv[1]);
      exit (0);
    }

  a_via = (char *) smalloc (200);
  res = fgets (a_via, 200, vias_file);	/* lines are under 200 */
  while (res != NULL)
    {

      int errcode;

      /* remove the last '\n' before parsing */
      sstrncpy (a_via + strlen (a_via) - 1, "\0", 1);

      if (0 != strncmp (a_via, "#", 1))
	{
	  /* allocate & init via */
	  via_init (&via);
	  printf ("=================================================\n");
	  printf ("VIA TO PARSE: |%s|\n", a_via);
	  errcode = via_parse (via, a_via);
	  if (errcode != -1)
	    {
	      if (via_2char (via, &dest) != -1)
		{
		  printf ("result:       |%s|\n", dest);
		  sfree (dest);
		}
	    }
	  else
	    printf ("Bad via format: %s\n", a_via);
	  via_free (via);
	  sfree (via);
	  printf ("=================================================\n");
	}
      res = fgets (a_via, 200, vias_file);	/* lines are under 200 */
    }
  sfree (a_via);

  return 0;
}
示例#2
0
static int patch_vt1708(struct hda_codec *codec)
{
	struct via_spec *spec;
	int err;

	/* create a codec specific record */
	spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
	if (spec == NULL)
		return -ENOMEM;

	codec->spec = spec;

	/* automatic parse from the BIOS config */
	err = vt1708_parse_auto_config(codec);
	if (err < 0) {
		via_free(codec);
		return err;
	} else if (!err) {
		printk(KERN_INFO "hda_codec: Cannot set up configuration "
		       "from BIOS.  Using genenic mode...\n");
	}

	
	spec->stream_name_analog = "VT1708 Analog";
	spec->stream_analog_playback = &vt1708_pcm_analog_playback;
	spec->stream_analog_capture = &vt1708_pcm_analog_capture;

	spec->stream_name_digital = "VT1708 Digital";
	spec->stream_digital_playback = &vt1708_pcm_digital_playback;
	spec->stream_digital_capture = &vt1708_pcm_digital_capture;

	
	if (!spec->adc_nids && spec->input_mux) {
		spec->adc_nids = vt1708_adc_nids;
		spec->num_adc_nids = ARRAY_SIZE(vt1708_adc_nids);
		spec->mixers[spec->num_mixers] = vt1708_capture_mixer;
		spec->num_mixers++;
	}

	codec->patch_ops = via_patch_ops;

	codec->patch_ops.init = via_auto_init;
#ifdef CONFIG_SND_HDA_POWER_SAVE
	spec->loopback.amplist = vt1708_loopbacks;
#endif

	return 0;
}