Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab5a6ebe authored by Vitaliy Kulikov's avatar Vitaliy Kulikov Committed by Takashi Iwai
Browse files

ALSA: hda - Adding support for new IDT 92HD90BXX and 92HD91BXX codecs



Adding support for digital MIC in 92HD83/90/91XXX codecs family.

Signed-off-by: default avatarVitaliy Kulikov <Vitaliy.Kulikov@idt.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 83c0de89
Loading
Loading
Loading
Loading
+46 −33
Original line number Diff line number Diff line
@@ -382,6 +382,11 @@ static unsigned int stac92hd83xxx_pwr_mapping[4] = {
	0x03, 0x0c, 0x20, 0x40,
};

#define STAC92HD83XXX_NUM_DMICS	 2
static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = {
	0x11, 0x20, 0
};

#define STAC92HD83XXX_NUM_CAPS	2
static unsigned long stac92hd83xxx_capvols[] = {
	HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
@@ -4695,6 +4700,36 @@ static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid)
	}
}

/* get the pin connection (fixed, none, etc) */
static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx)
{
	struct sigmatel_spec *spec = codec->spec;
	unsigned int cfg;

	cfg = snd_hda_codec_get_pincfg(codec, spec->pin_nids[idx]);
	return get_defcfg_connect(cfg);
}

static int stac92xx_connected_ports(struct hda_codec *codec,
					 hda_nid_t *nids, int num_nids)
{
	struct sigmatel_spec *spec = codec->spec;
	int idx, num;
	unsigned int def_conf;

	for (num = 0; num < num_nids; num++) {
		for (idx = 0; idx < spec->num_pins; idx++)
			if (spec->pin_nids[idx] == nids[num])
				break;
		if (idx >= spec->num_pins)
			break;
		def_conf = stac_get_defcfg_connect(codec, idx);
		if (def_conf == AC_JACK_PORT_NONE)
			break;
	}
	return num;
}

static void stac92xx_mic_detect(struct hda_codec *codec)
{
	struct sigmatel_spec *spec = codec->spec;
@@ -5325,6 +5360,8 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
	spec->linear_tone_beep = 1;
	codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
	spec->digbeep_nid = 0x21;
	spec->dmic_nids = stac92hd83xxx_dmic_nids;
	spec->dmux_nids = stac92hd83xxx_mux_nids;
	spec->mux_nids = stac92hd83xxx_mux_nids;
	spec->num_muxes = ARRAY_SIZE(stac92hd83xxx_mux_nids);
	spec->adc_nids = stac92hd83xxx_adc_nids;
@@ -5370,9 +5407,13 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
	case 0x111d76d4:
	case 0x111d7605:
	case 0x111d76d5:
	case 0x111d76e7:
		if (spec->board_config == STAC_92HD83XXX_PWR_REF)
			break;
		spec->num_pwrs = 0;
		spec->num_dmics = stac92xx_connected_ports(codec,
				stac92hd83xxx_dmic_nids,
				STAC92HD83XXX_NUM_DMICS);
		break;
	}

@@ -5431,36 +5472,6 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
	return 0;
}

/* get the pin connection (fixed, none, etc) */
static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx)
{
	struct sigmatel_spec *spec = codec->spec;
	unsigned int cfg;

	cfg = snd_hda_codec_get_pincfg(codec, spec->pin_nids[idx]);
	return get_defcfg_connect(cfg);
}

static int stac92hd71bxx_connected_ports(struct hda_codec *codec,
					 hda_nid_t *nids, int num_nids)
{
	struct sigmatel_spec *spec = codec->spec;
	int idx, num;
	unsigned int def_conf;

	for (num = 0; num < num_nids; num++) {
		for (idx = 0; idx < spec->num_pins; idx++)
			if (spec->pin_nids[idx] == nids[num])
				break;
		if (idx >= spec->num_pins)
			break;
		def_conf = stac_get_defcfg_connect(codec, idx);
		if (def_conf == AC_JACK_PORT_NONE)
			break;
	}
	return num;
}

static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec,
					  hda_nid_t dig0pin)
{
@@ -5599,7 +5610,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
	case 0x111d76b5:
		spec->init = stac92hd71bxx_core_init;
		codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
		spec->num_dmics = stac92hd71bxx_connected_ports(codec,
		spec->num_dmics = stac92xx_connected_ports(codec,
					stac92hd71bxx_dmic_nids,
					STAC92HD71BXX_NUM_DMICS);
		break;
@@ -5631,7 +5642,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
		snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0);
		snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3);
		stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS - 1] = 0;
		spec->num_dmics = stac92hd71bxx_connected_ports(codec,
		spec->num_dmics = stac92xx_connected_ports(codec,
					stac92hd71bxx_dmic_nids,
					STAC92HD71BXX_NUM_DMICS - 1);
		break;
@@ -5645,7 +5656,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
	default:
		spec->init = stac92hd71bxx_core_init;
		codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
		spec->num_dmics = stac92hd71bxx_connected_ports(codec,
		spec->num_dmics = stac92xx_connected_ports(codec,
					stac92hd71bxx_dmic_nids,
					STAC92HD71BXX_NUM_DMICS);
		break;
@@ -6327,6 +6338,8 @@ static struct hda_codec_preset snd_hda_preset_sigmatel[] = {
	{ .id = 0x111d76cc, .name = "92HD89F3", .patch = patch_stac92hd73xx },
	{ .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx },
	{ .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx },
	{ .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx},
	{ .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx},
	{} /* terminator */
};