Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3232820ybg; Mon, 28 Oct 2019 09:29:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxqzm7l3e3bJa8cTG+hfj2CrBbLoUzly6ojSQlkeM/k8CFSYb8KlAs6uxUSIPjStSrwnJJI X-Received: by 2002:a05:6402:713:: with SMTP id w19mr3022293edx.239.1572280181131; Mon, 28 Oct 2019 09:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572280181; cv=none; d=google.com; s=arc-20160816; b=K2OCF6UWlHnMgutswPfb7hViuxMJjtvkWUmnJi2a6nDHyRUqkQEBxsUb081AzPh4g1 ePJM7Dx0v2QnQbBl/RVcU32wYPmtRmBMk8jbhbrKM+kqUqnXrGrUe7ZP7GITWnIIIpb2 uhTl4/2lyK9dSJMq8kCAMTP8vl5syXk9rL3CielFm6QWosIh4gkKRqgEIsCElFXCJaNt 6uTV5agRj3jt6rLqGYFksBoq80cIS77Lq5xO7bwIOvPulxdekZIZ8rE6TJf1JZ2LaFii LrEcvVWDz4P5+4REC77JscjjGxHvJSGRQULc388a3q6XeyX7GqaqrVWTsjFUNpGCa13T yGpA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZUhk5jTAsWRL5Pgp1XZmlvQGKoI7BAgOCvrW+D56pp8=; b=yeYTrxYb8Ob70GqGU7F3GDQr1rCqPts74zo0a0R6B1I+pNTWxCtW8B5wiPllNLZ6vA lSijkzwWduwFjwlm3OYv1/PK/pe4fMBw8m0Cd4nAA8wztunNRY1hpdPYViIRE7KnPcmG UQ/53OWJ0w112Ry9e3hgrxdrrGojFHTRRD+cALkTaeH6FthgyHsVj1VDq69C6J9pcI5d AxLcYfqXtMRa6prkTOcoOCs5M0Vz7AJ6h6CSlCqLzYY5jhUU1FGd0QGx/rdkQ5GzKTzL 9i+e22tjyzMjnrBLHNTPM8xk06DFBudr4ao2FjlF22awE2OAa64uOCYRMxVTHpNThL8P DSkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Yo43dKTs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jp2si6416344ejb.178.2019.10.28.09.29.17; Mon, 28 Oct 2019 09:29:41 -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=@chromium.org header.s=google header.b=Yo43dKTs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732861AbfJ1HVR (ORCPT + 99 others); Mon, 28 Oct 2019 03:21:17 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:35787 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730755AbfJ1HVQ (ORCPT ); Mon, 28 Oct 2019 03:21:16 -0400 Received: by mail-pg1-f194.google.com with SMTP id c8so6306682pgb.2 for ; Mon, 28 Oct 2019 00:21:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZUhk5jTAsWRL5Pgp1XZmlvQGKoI7BAgOCvrW+D56pp8=; b=Yo43dKTsLFI2tpCk/GgsHgDLpV+n2oMVkqjTgO+WYW98xLPnu23m035x0k0FFAwWD/ gczA73kwm3uhx7jLU5FLzQZw/Ubg0uP8yeTUVnnyhEvFgMAEQNKsSnuElq/670f6y+Ku z3qyMCqSVAu4461D9BPtH/1Axex3l9sm48Zgw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZUhk5jTAsWRL5Pgp1XZmlvQGKoI7BAgOCvrW+D56pp8=; b=LCgvZaVZeVeGTzeiBYFqNDdR1Tr7OnetMYk6zvSfHJr54SccljEvQ0rI+GDUpVZ/Yh BvfM+1jVrut5jEbKUevjiLhDIrIHKOt+A38vfuhrMqD2ruYd0LWmysuG3PxYzXku0MgY zkXqWLAVZ7RzgEbWez7v1vyC98YmfeOBITvd8XMmsTUdAc2JusOnZxJzbGkuD2vydhXM yEQGDk6ITYwv9XehrK2buCdBiK6N+NxUASiIvNtAfeLnVOHShQSXFmqrz8TIJvLfD/LA 3pq+3A/A6LrAJTk34fjtXXuZjkVsUf4xpCv0IAouoJRyhmuK08QgDsOMWUHonv+LLjXr XbUA== X-Gm-Message-State: APjAAAWzDoobOSb5vuSrgkPkf2uDQbxt4KTswSzCYWsRQbaPR6g1FBVS NQ1ryAs1189D2hJFpXquAMdsh4gJl+87+g== X-Received: by 2002:a63:734e:: with SMTP id d14mr12627496pgn.357.1572247275466; Mon, 28 Oct 2019 00:21:15 -0700 (PDT) Received: from localhost ([2401:fa00:1:10:79b4:bd83:e4a5:a720]) by smtp.gmail.com with ESMTPSA id r28sm9256164pfl.37.2019.10.28.00.21.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Oct 2019 00:21:14 -0700 (PDT) From: Cheng-Yi Chiang To: linux-kernel@vger.kernel.org Cc: Neil Armstrong , Jerome Brunet , Jernej Skrabec , Jonas Karlman , Hans Verkuil , Mark Brown , Liam Girdwood , Takashi Iwai , Jaroslav Kysela , Russell King , Andrzej Hajda , Laurent Pinchart , David Airlie , Daniel Vetter , Heiko Stuebner , Rob Herring , Mark Rutland , dianders@chromium.org, dgreid@chromium.org, tzungbi@chromium.org, alsa-devel@alsa-project.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, Cheng-Yi Chiang Subject: [PATCH v9 4/6] ASoC: rockchip_max98090: Add HDMI jack support Date: Mon, 28 Oct 2019 15:19:28 +0800 Message-Id: <20191028071930.145899-5-cychiang@chromium.org> X-Mailer: git-send-email 2.24.0.rc0.303.g954a862665-goog In-Reply-To: <20191028071930.145899-1-cychiang@chromium.org> References: <20191028071930.145899-1-cychiang@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In machine driver, create a jack and let hdmi-codec report jack status. Signed-off-by: Cheng-Yi Chiang --- sound/soc/rockchip/Kconfig | 3 ++- sound/soc/rockchip/rockchip_max98090.c | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig index b43657e6e655..d610b553ea3b 100644 --- a/sound/soc/rockchip/Kconfig +++ b/sound/soc/rockchip/Kconfig @@ -40,9 +40,10 @@ config SND_SOC_ROCKCHIP_MAX98090 select SND_SOC_ROCKCHIP_I2S select SND_SOC_MAX98090 select SND_SOC_TS3A227E + select SND_SOC_HDMI_CODEC help Say Y or M here if you want to add support for SoC audio on Rockchip - boards using the MAX98090 codec, such as Veyron. + boards using the MAX98090 codec and HDMI codec, such as Veyron. config SND_SOC_ROCKCHIP_RT5645 tristate "ASoC support for Rockchip boards using a RT5645/RT5650 codec" diff --git a/sound/soc/rockchip/rockchip_max98090.c b/sound/soc/rockchip/rockchip_max98090.c index 50ef9b8e7ce4..5c2504a465f4 100644 --- a/sound/soc/rockchip/rockchip_max98090.c +++ b/sound/soc/rockchip/rockchip_max98090.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -218,6 +219,25 @@ enum { DAILINK_HDMI, }; +static struct snd_soc_jack rk_hdmi_jack; + +static int rk_hdmi_init(struct snd_soc_pcm_runtime *runtime) +{ + struct snd_soc_card *card = runtime->card; + struct snd_soc_component *component = runtime->codec_dai->component; + int ret; + + /* enable jack detection */ + ret = snd_soc_card_jack_new(card, "HDMI Jack", SND_JACK_LINEOUT, + &rk_hdmi_jack, NULL, 0); + if (ret) { + dev_err(card->dev, "Can't new HDMI Jack %d\n", ret); + return ret; + } + + return hdmi_codec_set_jack_detect(component, &rk_hdmi_jack); +} + /* max98090 dai_link */ static struct snd_soc_dai_link rk_max98090_dailinks[] = { { @@ -237,6 +257,7 @@ static struct snd_soc_dai_link rk_hdmi_dailinks[] = { { .name = "HDMI", .stream_name = "HDMI", + .init = rk_hdmi_init, .ops = &rk_aif1_ops, .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, @@ -259,6 +280,7 @@ static struct snd_soc_dai_link rk_max98090_hdmi_dailinks[] = { [DAILINK_HDMI] = { .name = "HDMI", .stream_name = "HDMI", + .init = rk_hdmi_init, .ops = &rk_aif1_ops, .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, -- 2.24.0.rc0.303.g954a862665-goog