From patchwork Wed Jul 17 08:33:27 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: 11047463 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 AB6536C5 for ; Wed, 17 Jul 2019 08:36:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B6B9286A2 for ; Wed, 17 Jul 2019 08:36:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FACE286C6; Wed, 17 Jul 2019 08:36:03 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3A13B286A2 for ; Wed, 17 Jul 2019 08:36:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=T5LBBOSWFTn5rzt+p/pvhQ3xkpB2Rd29TNCNm+GxgSU=; b=F4QqLmKFOnPfBf 3pyui7l3cQzPLg7255XZHXLfHL8Z5wvMw7bSNt7DxvuFHZEn63c5OdZQGZIiinIGI7ivl0/Py8wQq F1dDC7DErygjdEwN3eqIaeqjsuuYAtfuImWI90wL2Rq+EhU/786CoyRhPo5Pi+hps7Yr3nUtlelCa mRSGLVKAz9cb6dS6p8eS3olEFhAp8Qy9xY0NReRWjxcBoVatkl1PTgKuPXxHn+VvUP5GtVYQMaHxt dw7FWku//wuDJkom3CIQCiqtH16W+oMde8/a0h2aNUXQ8uwAFOT8WLK9Zr6Iryr6UUzQ8bIDaUE9Y vJjAOVNapEHzRF6kcPDQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hnfPp-0007jP-Pc; Wed, 17 Jul 2019 08:35:57 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hnfOJ-0005GU-FF for linux-arm-kernel@lists.infradead.org; Wed, 17 Jul 2019 08:34:26 +0000 Received: by mail-pf1-x441.google.com with SMTP id i189so10480728pfg.10 for ; Wed, 17 Jul 2019 01:34:23 -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=cidGTqyDmTdA37+BpWIU23tti1Aef+vr+fIqWe45Ips=; b=Pd9rMXqrPjeccHxZLywI63NSXDq23LfJH4aCPFLK7QnpkUPTxZgry6WuFZisQlBS6z wF7jGO9ojokkzEIb+2RQrPLLNnOiyW45ESsKQjm2fRb/dMnHljP0rhhOVlh5Y/dJ7HWq boBtCwQJdcRxbtnVIy7b+VEjhNf+UN+Y+UMZA= 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=cidGTqyDmTdA37+BpWIU23tti1Aef+vr+fIqWe45Ips=; b=k5qRCmtajd3xz6ESn7KFewXHezk6+88UHiYsSw7UyH+Cy1ZwNRs8klALQIuZ915LOZ 8L93iUKnK331/GqxEdEK+yXaGIKO4mlEGNCUntCkP6fqIr9XrgycRadbQbkN9Ep2jxiO Jo4FGPmWj9GlD8SfFFZ+wfbYKYsokMdrDL1DxK0V9h3aOwTL/CoOPE3OE9689j5oO6S4 htQEFOwAk5iSvFGmxJSOYAnLwavpsWxyXTNpeWPVWN+tFWSy5+kL+twd0JJhPDXlvlEl ujPAhekOVGUmwjy/wdE6GBeNZKRrLCTzk0cxfsTNarBbL3//0j+xNdNoVvyOPtWJiARl zZSQ== X-Gm-Message-State: APjAAAX72iAS3/RiwOr8SvKKKGktxdlB9ot83vU62QedWrUcTbGI5fgv p4Xxc1fiU/AHT0z6Fl9YNt19Sg== X-Google-Smtp-Source: APXvYqzlpXfBkcYTJYh+zRzHNs0eeuRkE1NZqTwzR7hx5d1u6W8AZyHHRlNHdrM7cO2RviT7Cn4/cQ== X-Received: by 2002:a63:4185:: with SMTP id o127mr1878619pga.82.1563352463012; Wed, 17 Jul 2019 01:34:23 -0700 (PDT) Received: from localhost ([2401:fa00:1:b:e688:dfd2:a1a7:2956]) by smtp.gmail.com with ESMTPSA id x9sm27902875pfn.177.2019.07.17.01.34.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jul 2019 01:34:22 -0700 (PDT) From: Cheng-Yi Chiang To: linux-kernel@vger.kernel.org Subject: [PATCH v5 5/5] ASoC: rockchip_max98090: Add HDMI jack support Date: Wed, 17 Jul 2019 16:33:27 +0800 Message-Id: <20190717083327.47646-6-cychiang@chromium.org> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog In-Reply-To: <20190717083327.47646-1-cychiang@chromium.org> References: <20190717083327.47646-1-cychiang@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190717_013423_724385_D957C2BE X-CRM114-Status: GOOD ( 13.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, Jaroslav Kysela , Hans Verkuil , Andrzej Hajda , Russell King , Mark Brown , Laurent Pinchart , Daniel Vetter , dgreid@chromium.org, linux-arm-kernel@lists.infradead.org, Cheng-Yi Chiang Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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/Kconfig | 3 ++- sound/soc/rockchip/rockchip_max98090.c | 20 ++++++++++++++++++++ 2 files changed, 22 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 c82948e383da..c81c4acda917 100644 --- a/sound/soc/rockchip/rockchip_max98090.c +++ b/sound/soc/rockchip/rockchip_max98090.c @@ -134,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] = { @@ -151,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), } };