2021-03-05 03:44:39

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 3/4] ALSA: hda/cirrus: Add jack detect interrupt support from CS42L42 companion codec.

Hi Vitaly,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on sound/for-next]
[also build test WARNING on v5.12-rc1 next-20210304]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Vitaly-Rodionov/ALSA-hda-cirrus-Add-support-for-CS8409-HDA-bridge-and-CS42L42-companion-codec/20210305-030714
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: alpha-randconfig-r035-20210305 (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/9d4c2aa0fd6872aa8b866929c1537ce2905a6dba
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Vitaly-Rodionov/ALSA-hda-cirrus-Add-support-for-CS8409-HDA-bridge-and-CS42L42-companion-codec/20210305-030714
git checkout 9d4c2aa0fd6872aa8b866929c1537ce2905a6dba
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> sound/pci/hda/patch_cirrus.c:1686:6: warning: no previous prototype for 'cs8409_jack_unsol_event' [-Wmissing-prototypes]
1686 | void cs8409_jack_unsol_event(struct hda_codec *codec, unsigned int res)
| ^~~~~~~~~~~~~~~~~~~~~~~


vim +/cs8409_jack_unsol_event +1686 sound/pci/hda/patch_cirrus.c

1678
1679 /*
1680 * In the case of CS8409 we do not have unsolicited events from NID's 0x24
1681 * and 0x34 where hs mic and hp are connected. Companion codec CS42L42 will
1682 * generate interrupt via gpio 4 to notify jack events. We have to overwrite
1683 * generic snd_hda_jack_unsol_event(), read CS42L42 jack detect status registers
1684 * and then notify status via generic snd_hda_jack_unsol_event() call.
1685 */
> 1686 void cs8409_jack_unsol_event(struct hda_codec *codec, unsigned int res)
1687 {
1688 struct cs_spec *spec = codec->spec;
1689 int status_changed = 0;
1690 unsigned int reg_cdc_status = 0;
1691 unsigned int reg_hs_status = 0;
1692 unsigned int reg_ts_status = 0;
1693 int type = 0;
1694 struct hda_jack_tbl *jk;
1695
1696 /* jack_unsol_event() will be called every time gpio line changing state.
1697 * In this case gpio4 line goes up as a result of reading interrupt status
1698 * registers in previous cs8409_jack_unsol_event() call.
1699 * We don't need to handle this event, ignoring...
1700 */
1701 if ((res & (1 << 4)))
1702 return;
1703
1704 mutex_lock(&spec->cs8409_i2c_mux);
1705
1706 /* Read jack detect status registers */
1707 reg_cdc_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1308, 1);
1708 reg_hs_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1124, 1);
1709 reg_ts_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130f, 1);
1710
1711 /* Clear interrupts */
1712 cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1b7b, 1);
1713 cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1308, 1);
1714 cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130f, 1);
1715
1716 mutex_unlock(&spec->cs8409_i2c_mux);
1717
1718 /* HSDET_AUTO_DONE */
1719 if (reg_cdc_status & CS42L42_HSDET_AUTO_DONE) {
1720
1721 type = ((reg_hs_status & CS42L42_HSTYPE_MASK) + 1);
1722 /* CS42L42 reports optical jack as type 4
1723 * We don't handle optical jack
1724 */
1725 if (type != 4) {
1726 if (!spec->cs42l42_hp_jack_in) {
1727 status_changed = 1;
1728 spec->cs42l42_hp_jack_in = 1;
1729 }
1730 /* type = 3 has no mic */
1731 if ((!spec->cs42l42_mic_jack_in) && (type != 3)) {
1732 status_changed = 1;
1733 spec->cs42l42_mic_jack_in = 1;
1734 }
1735 }
1736
1737 } else {
1738 /* TIP_SENSE INSERT/REMOVE */
1739 switch (reg_ts_status) {
1740 case CS42L42_JACK_INSERTED:
1741 cs8409_cs42l42_run_jack_detect(codec);
1742 break;
1743
1744 case CS42L42_JACK_REMOVED:
1745 if (spec->cs42l42_hp_jack_in || spec->cs42l42_mic_jack_in) {
1746 status_changed = 1;
1747 spec->cs42l42_hp_jack_in = 0;
1748 spec->cs42l42_mic_jack_in = 0;
1749 }
1750 break;
1751
1752 default:
1753 /* jack in transition */
1754 status_changed = 0;
1755 break;
1756 }
1757 }
1758
1759 if (status_changed) {
1760
1761 snd_hda_set_pin_ctl(codec, CS8409_CS42L42_SPK_PIN_NID,
1762 (spec->cs42l42_hp_jack_in)?0 : PIN_OUT);
1763
1764 /* Report jack*/
1765 jk = snd_hda_jack_tbl_get_mst(codec, CS8409_CS42L42_HP_PIN_NID, 0);
1766 if (jk) {
1767 snd_hda_jack_unsol_event(codec,
1768 (jk->tag << AC_UNSOL_RES_TAG_SHIFT) & AC_UNSOL_RES_TAG);
1769 }
1770 /* Report jack*/
1771 jk = snd_hda_jack_tbl_get_mst(codec, CS8409_CS42L42_AMIC_PIN_NID, 0);
1772 if (jk) {
1773 snd_hda_jack_unsol_event(codec,
1774 (jk->tag << AC_UNSOL_RES_TAG_SHIFT) & AC_UNSOL_RES_TAG);
1775 }
1776 }
1777 }
1778

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (5.60 kB)
.config.gz (35.31 kB)
Download all attachments