Re: [PATCH v4 12/13] ALSA: hda/ca0132: add ca0132_alt_set_vipsource

From: kbuild test robot
Date: Tue May 08 2018 - 06:00:33 EST


Hi Connor,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on sound/for-next]
[also build test ERROR on v4.17-rc4 next-20180507]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Connor-McAdams/ALSA-hda-ca0132-Patch-Series-for-Recon3Di-and-Sound-Blaster-Z-Support/20180508-144100
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: x86_64-randconfig-x012-201818 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

Note: the linux-review/Connor-McAdams/ALSA-hda-ca0132-Patch-Series-for-Recon3Di-and-Sound-Blaster-Z-Support/20180508-144100 HEAD 387bca1ff38f9c470b8965899c62b3bfc400ea88 builds fine.
It only hurts bisectibility.

All errors (new ones prefixed by >>):

sound/pci/hda/patch_ca0132.c: In function 'ca0132_alt_select_in':
>> sound/pci/hda/patch_ca0132.c:4210:2: error: implicit declaration of function 'ca0132_cvoice_switch_set'; did you mean 'ca0132_mic_boost_set'? [-Werror=implicit-function-declaration]
ca0132_cvoice_switch_set(codec);
^~~~~~~~~~~~~~~~~~~~~~~~
ca0132_mic_boost_set
sound/pci/hda/patch_ca0132.c: At top level:
>> sound/pci/hda/patch_ca0132.c:4403:12: error: static declaration of 'ca0132_cvoice_switch_set' follows non-static declaration
static int ca0132_cvoice_switch_set(struct hda_codec *codec)
^~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/hda/patch_ca0132.c:4210:2: note: previous implicit declaration of 'ca0132_cvoice_switch_set' was here
ca0132_cvoice_switch_set(codec);
^~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +4210 sound/pci/hda/patch_ca0132.c

4099
4100 /*
4101 * Select the active input.
4102 * Mic detection isn't used, because it's kind of pointless on the SBZ.
4103 * The front mic has no jack-detection, so the only way to switch to it
4104 * is to do it manually in alsamixer.
4105 */
4106 static int ca0132_alt_select_in(struct hda_codec *codec)
4107 {
4108 struct ca0132_spec *spec = codec->spec;
4109 unsigned int tmp;
4110
4111 codec_dbg(codec, "%s\n", __func__);
4112
4113 snd_hda_power_up_pm(codec);
4114
4115 chipio_set_stream_control(codec, 0x03, 0);
4116 chipio_set_stream_control(codec, 0x04, 0);
4117
4118 spec->cur_mic_type = spec->in_enum_val;
4119
4120 switch (spec->cur_mic_type) {
4121 case REAR_MIC:
4122 switch (spec->quirk) {
4123 case QUIRK_SBZ:
4124 writew(0x0000, spec->mem_base + 0x320);
4125 tmp = FLOAT_THREE;
4126 break;
4127 case QUIRK_R3DI:
4128 r3di_gpio_mic_set(codec, R3DI_REAR_MIC);
4129 tmp = FLOAT_ONE;
4130 break;
4131 default:
4132 tmp = FLOAT_ONE;
4133 break;
4134 }
4135
4136 chipio_set_conn_rate(codec, MEM_CONNID_MICIN1, SR_96_000);
4137 chipio_set_conn_rate(codec, MEM_CONNID_MICOUT1, SR_96_000);
4138 if (spec->quirk == QUIRK_R3DI)
4139 chipio_set_conn_rate(codec, 0x0F, SR_96_000);
4140
4141 dspio_set_uint_param(codec, 0x80, 0x00, tmp);
4142
4143 chipio_set_stream_control(codec, 0x03, 1);
4144 chipio_set_stream_control(codec, 0x04, 1);
4145
4146 if (spec->quirk == QUIRK_SBZ) {
4147 chipio_write(codec, 0x18B098, 0x0000000C);
4148 chipio_write(codec, 0x18B09C, 0x0000000C);
4149 }
4150 break;
4151 case REAR_LINE_IN:
4152 ca0132_mic_boost_set(codec, 0);
4153 switch (spec->quirk) {
4154 case QUIRK_SBZ:
4155 writew(0x0000, spec->mem_base + 0x320);
4156 break;
4157 case QUIRK_R3DI:
4158 r3di_gpio_mic_set(codec, R3DI_REAR_MIC);
4159 break;
4160 }
4161
4162 chipio_set_conn_rate(codec, MEM_CONNID_MICIN1, SR_96_000);
4163 chipio_set_conn_rate(codec, MEM_CONNID_MICOUT1, SR_96_000);
4164 if (spec->quirk == QUIRK_R3DI)
4165 chipio_set_conn_rate(codec, 0x0F, SR_96_000);
4166
4167 tmp = FLOAT_ZERO;
4168 dspio_set_uint_param(codec, 0x80, 0x00, tmp);
4169
4170 if (spec->quirk == QUIRK_SBZ) {
4171 chipio_write(codec, 0x18B098, 0x00000000);
4172 chipio_write(codec, 0x18B09C, 0x00000000);
4173 }
4174
4175 chipio_set_stream_control(codec, 0x03, 1);
4176 chipio_set_stream_control(codec, 0x04, 1);
4177 break;
4178 case FRONT_MIC:
4179 switch (spec->quirk) {
4180 case QUIRK_SBZ:
4181 writew(0x0100, spec->mem_base + 0x320);
4182 writew(0x0005, spec->mem_base + 0x320);
4183 tmp = FLOAT_THREE;
4184 break;
4185 case QUIRK_R3DI:
4186 r3di_gpio_mic_set(codec, R3DI_FRONT_MIC);
4187 tmp = FLOAT_ONE;
4188 break;
4189 default:
4190 tmp = FLOAT_ONE;
4191 break;
4192 }
4193
4194 chipio_set_conn_rate(codec, MEM_CONNID_MICIN1, SR_96_000);
4195 chipio_set_conn_rate(codec, MEM_CONNID_MICOUT1, SR_96_000);
4196 if (spec->quirk == QUIRK_R3DI)
4197 chipio_set_conn_rate(codec, 0x0F, SR_96_000);
4198
4199 dspio_set_uint_param(codec, 0x80, 0x00, tmp);
4200
4201 chipio_set_stream_control(codec, 0x03, 1);
4202 chipio_set_stream_control(codec, 0x04, 1);
4203
4204 if (spec->quirk == QUIRK_SBZ) {
4205 chipio_write(codec, 0x18B098, 0x0000000C);
4206 chipio_write(codec, 0x18B09C, 0x000000CC);
4207 }
4208 break;
4209 }
> 4210 ca0132_cvoice_switch_set(codec);
4211
4212 snd_hda_power_down_pm(codec);
4213 return 0;
4214
4215 }
4216
4217 /*
4218 * Check if VNODE settings take effect immediately.
4219 */
4220 static bool ca0132_is_vnode_effective(struct hda_codec *codec,
4221 hda_nid_t vnid,
4222 hda_nid_t *shared_nid)
4223 {
4224 struct ca0132_spec *spec = codec->spec;
4225 hda_nid_t nid;
4226
4227 switch (vnid) {
4228 case VNID_SPK:
4229 nid = spec->shared_out_nid;
4230 break;
4231 case VNID_MIC:
4232 nid = spec->shared_mic_nid;
4233 break;
4234 default:
4235 return false;
4236 }
4237
4238 if (shared_nid)
4239 *shared_nid = nid;
4240
4241 return true;
4242 }
4243
4244 /*
4245 * The following functions are control change helpers.
4246 * They return 0 if no changed. Return 1 if changed.
4247 */
4248 static int ca0132_voicefx_set(struct hda_codec *codec, int enable)
4249 {
4250 struct ca0132_spec *spec = codec->spec;
4251 unsigned int tmp;
4252
4253 /* based on CrystalVoice state to enable VoiceFX. */
4254 if (enable) {
4255 tmp = spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID] ?
4256 FLOAT_ONE : FLOAT_ZERO;
4257 } else {
4258 tmp = FLOAT_ZERO;
4259 }
4260
4261 dspio_set_uint_param(codec, ca0132_voicefx.mid,
4262 ca0132_voicefx.reqs[0], tmp);
4263
4264 return 1;
4265 }
4266
4267 /*
4268 * Set the effects parameters
4269 */
4270 static int ca0132_effects_set(struct hda_codec *codec, hda_nid_t nid, long val)
4271 {
4272 struct ca0132_spec *spec = codec->spec;
4273 unsigned int on, tmp;
4274 int num_fx = OUT_EFFECTS_COUNT + IN_EFFECTS_COUNT;
4275 int err = 0;
4276 int idx = nid - EFFECT_START_NID;
4277
4278 if ((idx < 0) || (idx >= num_fx))
4279 return 0; /* no changed */
4280
4281 /* for out effect, qualify with PE */
4282 if ((nid >= OUT_EFFECT_START_NID) && (nid < OUT_EFFECT_END_NID)) {
4283 /* if PE if off, turn off out effects. */
4284 if (!spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID])
4285 val = 0;
4286 }
4287
4288 /* for in effect, qualify with CrystalVoice */
4289 if ((nid >= IN_EFFECT_START_NID) && (nid < IN_EFFECT_END_NID)) {
4290 /* if CrystalVoice if off, turn off in effects. */
4291 if (!spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID])
4292 val = 0;
4293
4294 /* Voice Focus applies to 2-ch Mic, Digital Mic */
4295 if ((nid == VOICE_FOCUS) && (spec->cur_mic_type != DIGITAL_MIC))
4296 val = 0;
4297
4298 /* If Voice Focus on SBZ, set to two channel. */
4299 if ((nid == VOICE_FOCUS) && (spec->quirk == QUIRK_SBZ)
4300 && (spec->cur_mic_type != REAR_LINE_IN)) {
4301 if (spec->effects_switch[CRYSTAL_VOICE -
4302 EFFECT_START_NID]) {
4303
4304 if (spec->effects_switch[VOICE_FOCUS -
4305 EFFECT_START_NID]) {
4306 tmp = FLOAT_TWO;
4307 val = 1;
4308 } else
4309 tmp = FLOAT_ONE;
4310
4311 dspio_set_uint_param(codec, 0x80, 0x00, tmp);
4312 }
4313 }
4314 /*
4315 * For SBZ noise reduction, there's an extra command
4316 * to module ID 0x47. No clue why.
4317 */
4318 if ((nid == NOISE_REDUCTION) && (spec->quirk == QUIRK_SBZ)
4319 && (spec->cur_mic_type != REAR_LINE_IN)) {
4320 if (spec->effects_switch[CRYSTAL_VOICE -
4321 EFFECT_START_NID]) {
4322 if (spec->effects_switch[NOISE_REDUCTION -
4323 EFFECT_START_NID])
4324 tmp = FLOAT_ONE;
4325 else
4326 tmp = FLOAT_ZERO;
4327 } else
4328 tmp = FLOAT_ZERO;
4329
4330 dspio_set_uint_param(codec, 0x47, 0x00, tmp);
4331 }
4332
4333 /* If rear line in disable effects. */
4334 if (spec->use_alt_functions &&
4335 spec->in_enum_val == REAR_LINE_IN)
4336 val = 0;
4337 }
4338
4339 codec_dbg(codec, "ca0132_effect_set: nid=0x%x, val=%ld\n",
4340 nid, val);
4341
4342 on = (val == 0) ? FLOAT_ZERO : FLOAT_ONE;
4343 err = dspio_set_uint_param(codec, ca0132_effects[idx].mid,
4344 ca0132_effects[idx].reqs[0], on);
4345
4346 if (err < 0)
4347 return 0; /* no changed */
4348
4349 return 1;
4350 }
4351
4352 /*
4353 * Turn on/off Playback Enhancements
4354 */
4355 static int ca0132_pe_switch_set(struct hda_codec *codec)
4356 {
4357 struct ca0132_spec *spec = codec->spec;
4358 hda_nid_t nid;
4359 int i, ret = 0;
4360
4361 codec_dbg(codec, "ca0132_pe_switch_set: val=%ld\n",
4362 spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]);
4363
4364 if (spec->use_alt_functions)
4365 ca0132_alt_select_out(codec);
4366
4367 i = OUT_EFFECT_START_NID - EFFECT_START_NID;
4368 nid = OUT_EFFECT_START_NID;
4369 /* PE affects all out effects */
4370 for (; nid < OUT_EFFECT_END_NID; nid++, i++)
4371 ret |= ca0132_effects_set(codec, nid, spec->effects_switch[i]);
4372
4373 return ret;
4374 }
4375
4376 /* Check if Mic1 is streaming, if so, stop streaming */
4377 static int stop_mic1(struct hda_codec *codec)
4378 {
4379 struct ca0132_spec *spec = codec->spec;
4380 unsigned int oldval = snd_hda_codec_read(codec, spec->adcs[0], 0,
4381 AC_VERB_GET_CONV, 0);
4382 if (oldval != 0)
4383 snd_hda_codec_write(codec, spec->adcs[0], 0,
4384 AC_VERB_SET_CHANNEL_STREAMID,
4385 0);
4386 return oldval;
4387 }
4388
4389 /* Resume Mic1 streaming if it was stopped. */
4390 static void resume_mic1(struct hda_codec *codec, unsigned int oldval)
4391 {
4392 struct ca0132_spec *spec = codec->spec;
4393 /* Restore the previous stream and channel */
4394 if (oldval != 0)
4395 snd_hda_codec_write(codec, spec->adcs[0], 0,
4396 AC_VERB_SET_CHANNEL_STREAMID,
4397 oldval);
4398 }
4399
4400 /*
4401 * Turn on/off CrystalVoice
4402 */
> 4403 static int ca0132_cvoice_switch_set(struct hda_codec *codec)
4404 {
4405 struct ca0132_spec *spec = codec->spec;
4406 hda_nid_t nid;
4407 int i, ret = 0;
4408 unsigned int oldval;
4409
4410 codec_dbg(codec, "ca0132_cvoice_switch_set: val=%ld\n",
4411 spec->effects_switch[CRYSTAL_VOICE - EFFECT_START_NID]);
4412
4413 i = IN_EFFECT_START_NID - EFFECT_START_NID;
4414 nid = IN_EFFECT_START_NID;
4415 /* CrystalVoice affects all in effects */
4416 for (; nid < IN_EFFECT_END_NID; nid++, i++)
4417 ret |= ca0132_effects_set(codec, nid, spec->effects_switch[i]);
4418
4419 /* including VoiceFX */
4420 ret |= ca0132_voicefx_set(codec, (spec->voicefx_val ? 1 : 0));
4421
4422 /* set correct vipsource */
4423 oldval = stop_mic1(codec);
4424 if (spec->use_alt_functions)
4425 ret |= ca0132_alt_set_vipsource(codec, 1);
4426 else
4427 ret |= ca0132_set_vipsource(codec, 1);
4428 resume_mic1(codec, oldval);
4429 return ret;
4430 }
4431

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip