Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9934194ybi; Wed, 24 Jul 2019 12:36:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzp7wzv/cJP8HC0YhEZ+uWd8gJuzGLgXsgfnEk4/AVa0rULGH3PH+5McgGS1qVed5H2LF/E X-Received: by 2002:a17:90a:b903:: with SMTP id p3mr87747811pjr.79.1563996963730; Wed, 24 Jul 2019 12:36:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563996963; cv=none; d=google.com; s=arc-20160816; b=cpNmzVUL65meFbyGSjQG9MMMPyeKGCL7xsOLJwiUc3LrNzFVNSzcj5W+Ux85eFgzya K/cGE+1NhRwuQsbbkhm+vJs7ka9eS2nWZzB22Bbk3gg2YyGlUhwqzGfl4Y0U2vk1rJVX 7nY/B88KFg4w/+3yx/ogwQJYw1eBCxdPRvpXMhM/sTVf24VsqiSofZk3xUMRix/YiWtX /ssuecmN+j9OzboJXXpTYPKXCTXat9EN3IZFfrylWoIEk8gwmp2SA9mEEkCKJMqbnE8R XbytRxTW+siKNbFveSIs6Jk+M45EL1PkiWsciiGVxSTDhhvqZS+j84muRJ5fYiYPZ5/O Ungw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Cat+6Lh7gEN1N/8HNIUW4kKnu4gyb3GvG4FUFdSNRqw=; b=Fr7ZG6nRm24JlRehRmUlyFcnbnJ9HQBODhBM4SZvH0442cDhpayRVzRcWYJ/4I2WXc rTJpeR6JcE6/p5+w14+m4fqT1+4E9PPdwHpsxpxVRj/6hd85groYl0746ZUtXXFeLiXz oA6GfoYqtThi+9F6gn4xDQEzL3StQUPmg47kfR3tel4AnUhpcQeHuFAQIQp5GueVhYTD ctUvu2ovFEOwUE0Q2i6lUgupu2Yv7f1EvZm2M8T/BNlP0IkM3FbFISmJSDyfn39ESo1X 3B6IwgAdajp3kNq/u8QdFxTVKedbhP2KzlxdBMXQ71tUlUJK0SzBhofoC7M9yKyD0zPd VFNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oaYHBNkU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i3si3946018pgm.163.2019.07.24.12.35.49; Wed, 24 Jul 2019 12:36:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oaYHBNkU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388362AbfGXTdk (ORCPT + 99 others); Wed, 24 Jul 2019 15:33:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:55484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388846AbfGXTdg (ORCPT ); Wed, 24 Jul 2019 15:33:36 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 38638229FA; Wed, 24 Jul 2019 19:33:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996815; bh=3uFTwaDHAmJ73S7JmU9w0woFrRgrA8PUMRkK9FBCeew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oaYHBNkU6lTFpP4psXvfXZrNo+j9vwUjBHWXCcl2a+1TtZLMgexzXLNNJUhVLOUGX sNEmE47XA2OwX0Szvc/uDyEIInr/XMkVuPS4BxrbOhxLjEYzgB4VroJH2Q4y2GMl53 7C8sTEGeyNvNys92EjEcM1+hj6+TLPlu86ly2p7s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Rander Wang , Sasha Levin Subject: [PATCH 5.2 209/413] ALSA: hda: Fix a headphone detection issue when using SOF Date: Wed, 24 Jul 2019 21:18:20 +0200 Message-Id: <20190724191749.456916644@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 7c2b3629d09ddec810dc4c1d3a6657c32def8f71 ] To save power, the hda hdmi driver in ASoC invokes snd_hdac_ext_bus_link_put to disable CORB/RIRB buffers DMA if there is no user of bus and invokes snd_hdac_ext_bus_link_get to set up CORB/RIRB buffers when it is used. Unsolicited responses is disabled in snd_hdac_bus_stop_cmd_io called by snd_hdac_ext_bus_link_put , but it is not enabled in snd_hdac_bus_init_cmd_io called by snd_hdac_ext_bus_link_get. So for put-get sequence, Unsolicited responses is disabled and headphone can't be detected by hda codecs. Now unsolicited responses is only enabled in snd_hdac_bus_reset_link which resets controller. The function is only called for setup of controller. This patch enables Unsolicited responses after RIRB is initialized in snd_hdac_bus_init_cmd_io which works together with snd_hdac_bus_reset_link to set up controller. Tested legacy hda driver and SOF driver on intel whiskeylake. Reviewed-by: Takashi Iwai Signed-off-by: Rander Wang Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/hda/hdac_controller.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c index b02f74528b66..812dc144fb5b 100644 --- a/sound/hda/hdac_controller.c +++ b/sound/hda/hdac_controller.c @@ -79,6 +79,8 @@ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus) snd_hdac_chip_writew(bus, RINTCNT, 1); /* enable rirb dma and response irq */ snd_hdac_chip_writeb(bus, RIRBCTL, AZX_RBCTL_DMA_EN | AZX_RBCTL_IRQ_EN); + /* Accept unsolicited responses */ + snd_hdac_chip_updatel(bus, GCTL, AZX_GCTL_UNSOL, AZX_GCTL_UNSOL); spin_unlock_irq(&bus->reg_lock); } EXPORT_SYMBOL_GPL(snd_hdac_bus_init_cmd_io); @@ -415,9 +417,6 @@ int snd_hdac_bus_reset_link(struct hdac_bus *bus, bool full_reset) return -EBUSY; } - /* Accept unsolicited responses */ - snd_hdac_chip_updatel(bus, GCTL, AZX_GCTL_UNSOL, AZX_GCTL_UNSOL); - /* detect codecs */ if (!bus->codec_mask) { bus->codec_mask = snd_hdac_chip_readw(bus, STATESTS); -- 2.20.1