[alsa-devel] [PATCH 1/2] ASoC: rt5645: Adds push button support for rt5650

Mark Brown broonie at kernel.org
Mon Apr 20 22:41:14 CEST 2015


On Mon, Apr 20, 2015 at 10:37:21AM +0800, Bard Liao wrote:

> --- a/sound/soc/codecs/rt5645.c
> +++ b/sound/soc/codecs/rt5645.c
> @@ -198,7 +198,6 @@ static const struct reg_default rt5645_reg[] = {
>  	{ 0xda, 0x0000 },
>  	{ 0xdb, 0x0003 },
>  	{ 0xdc, 0x0049 },
> -	{ 0xdd, 0x001b },
>  	{ 0xdf, 0x0008 },
>  	{ 0xe0, 0x4000 },
>  	{ 0xe6, 0x8000 },

That's a bit weird, why is this in here?

> +	if (rt5645->btn_jack && rt5645->codec_type == CODEC_TYPE_RT5650) {

Can we have a switch statement for the device type so it's easier to add
other devices if there's new derivatives please?

> +			btn_type = rt5645_button_detect(rt5645->codec);
> +			switch (btn_type) {
> +			case 0x8000:
> +			case 0x4000:
> +			case 0x2000:
> +				report |= SND_JACK_BTN_0;
> +				break;

Why do we mash all these values together?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20150420/6696cfe0/attachment.sig>


More information about the Alsa-devel mailing list