[alsa-devel] [PATCH] hda: add support for jack detection on IDT/Sigmatel

Matthew Ranostay mranostay at embeddedalley.com
Wed Oct 15 17:45:23 CEST 2008


Mark Brown wrote:
> On Wed, Oct 15, 2008 at 10:43:28AM -0400, Matthew Ranostay wrote:
> 
>> @@ -3639,6 +3640,12 @@ static int stac92xx_init(struct hda_codec *codec)
>>  		stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
>>  					 AC_PINCTL_OUT_EN);
>>  		stac92xx_auto_init_hp_out(codec);
>> +		/* jack detection */
>> +		err = snd_jack_new(codec->bus->card,
>> +			"Headphone Jack Detection",
>> +			SND_JACK_HEADPHONE, &codec->jack);
>> +		if (err < 0)
> 
> That should probably just be "Headphone Jack".
> 
>> +			return err;
> 
> ...
> 
>> +	if (codec->jack)
>> +		snd_jack_report(codec->jack,
>> +			presence ? SND_JACK_HEADPHONE : 0);
>> +
> 
> Since you appear to fail init if you can't create the jack there should
> be no need to check for the jack being initialised here.  For ease of
> use I'll just submit a patch folding that check into snd_jack_report(),
> though.
> 

Good catch.

Thanks,

Matt Ranostay


More information about the Alsa-devel mailing list