From patchwork Wed Jul 10 07:07:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-yi Chiang X-Patchwork-Id: 11038019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A07114F6 for ; Wed, 10 Jul 2019 07:12:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 373B6288B3 for ; Wed, 10 Jul 2019 07:12:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2AE0E288EE; Wed, 10 Jul 2019 07:12:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7ADBA288B3 for ; Wed, 10 Jul 2019 07:12:21 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E14B715F2; Wed, 10 Jul 2019 09:11:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E14B715F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1562742740; bh=YHzR9LQGTe8E1kVPnb9B6ScantFqJv6YgVhjYUTKXwk=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=n74X0JV3RT92horxPLw75DlWmWVTacmMqt4Capnfu7LqjGwsytfG2PG2VJH3B1QP0 6BQKx+s77kXvstGGNigMWpXG3Oh41q5xu0AGow7Gm8iAEH39BPcqhgHtlMH576TYbq 2nLQmpAoLCA2T7zEL3tXXLZtfdu2c45boRGPJKoA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 10C03F8038F; Wed, 10 Jul 2019 09:09:01 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 54DC2F80390; Wed, 10 Jul 2019 09:09:00 +0200 (CEST) Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 82FA1F80376 for ; Wed, 10 Jul 2019 09:08:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 82FA1F80376 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="RjICyuOq" Received: by mail-pg1-x542.google.com with SMTP id u17so763028pgi.6 for ; Wed, 10 Jul 2019 00:08:54 -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=opTBgfSTSFi3V1ce9YlYEnYQO/1kKdgFofPaGYJTBOY=; b=RjICyuOquidt6LyqOASElFqobDNn4mo6EWt1hQsD6iwRx26+bMSTRwY0lCmMrVaHSG 6a47JWfUcXiJfqoCtNQ7lq7rjKXQcz2UUkE2pHMU2JgLeyFB7HyoZ+a4e8q03awEvrPl 4wQTV2TDpVxnBFrbqJ7OGM83LJNpTu4ZxCalU= 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=opTBgfSTSFi3V1ce9YlYEnYQO/1kKdgFofPaGYJTBOY=; b=FLNpYTwclSwfdC/IDtjIkRt2vozynulCO4qIA59DIcIm17D9hhUcudGddxTi5yOOPx n5fguaxdzypCJLSUZYbMoa+VwmL+30Jrv9nRCXvNXRU5HakuE4S5EzIwzqkkwcJJN7vC E/3EhW641MlQPIhNGercKsWPSaaRSMSO/Rp7IIR3TlIpe3676MnM0DOI3BhRl937tuhX o8mQrXIMCIfv5RXt+zSuifzz6sU2gqfEKxJpHlTIyx3QYuOhrTNI1u5X2tBGmlcEszQT /UioCSXC3KcOe5lZxkGotcEf8frEulTiAIW+hTNg+CTHSGXfRi6ZNIyqS/fU4ylD0iMK TkfQ== X-Gm-Message-State: APjAAAXRxJe/2x8L4GDxmjzmQBOPbRirEgdqIIAdGtDfdQIkaC1E4dXw m3JRNPgp37DPGAY3fSaDcjq5NA== X-Google-Smtp-Source: APXvYqyla6Le8Sl5C5IFq+BMbhDM8PgxLabMwmqWmWurGv0zA2QcXauHAgdORrx2hOafDqZMEhT1zA== X-Received: by 2002:a65:4045:: with SMTP id h5mr36503650pgp.247.1562742532604; Wed, 10 Jul 2019 00:08:52 -0700 (PDT) Received: from localhost ([2401:fa00:1:b:e688:dfd2:a1a7:2956]) by smtp.gmail.com with ESMTPSA id b36sm3319370pjc.16.2019.07.10.00.08.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jul 2019 00:08:52 -0700 (PDT) From: Cheng-Yi Chiang To: linux-kernel@vger.kernel.org Date: Wed, 10 Jul 2019 15:07:51 +0800 Message-Id: <20190710070751.260061-5-cychiang@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190710070751.260061-1-cychiang@chromium.org> References: <20190710070751.260061-1-cychiang@chromium.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, dianders@chromium.org, Heiko Stuebner , linux-rockchip@lists.infradead.org, David Airlie , dri-devel@lists.freedesktop.org, Takashi Iwai , Liam Girdwood , tzungbi@chromium.org, Hans Verkuil , Andrzej Hajda , Russell King , Mark Brown , Laurent Pinchart , Daniel Vetter , dgreid@chromium.org, linux-arm-kernel@lists.infradead.org, Cheng-Yi Chiang Subject: [alsa-devel] [PATCH v2 4/4] ASoC: rockchip_max98090: Add HDMI jack support X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP In machine driver, create a jack and let hdmi-codec report jack status. Signed-off-by: Cheng-Yi Chiang --- sound/soc/rockchip/rockchip_max98090.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sound/soc/rockchip/rockchip_max98090.c b/sound/soc/rockchip/rockchip_max98090.c index 3617012692ea..177c8a7ec8de 100644 --- a/sound/soc/rockchip/rockchip_max98090.c +++ b/sound/soc/rockchip/rockchip_max98090.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "rockchip_i2s.h" #include "../codecs/ts3a227e.h" @@ -133,6 +134,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 and HDMI codec dai_link */ static struct snd_soc_dai_link rk_dailinks[] = { [DAILINK_MAX98090] = { @@ -150,6 +170,7 @@ static struct snd_soc_dai_link rk_dailinks[] = { .ops = &rk_aif1_ops, .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, + .init = rk_hdmi_init, SND_SOC_DAILINK_REG(hdmi), } };