From patchwork Thu Feb 6 03:17:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11367623 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D6851395 for ; Thu, 6 Feb 2020 03:19:59 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 141D520674 for ; Thu, 6 Feb 2020 03:19:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="KSXYjvji"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="t6ozdDcW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 141D520674 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 641D7168D; Thu, 6 Feb 2020 04:19:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 641D7168D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1580959197; bh=jqzzkrQXnD4ID1h2SBOUaw6OALb+V6fimUp3bSOZHw0=; h=Date:In-Reply-To:References:From:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KSXYjvjiPrH2U9840A9WlTbAlBkqkHGsvbJadtXg5umKaGeTovtlX+6lyAThIHUdL bAuPEwehwxJa5lX90xoxa6gR0mn/ej7t9X6gDdjvGFzlMgkgJxsEKEW8eCSQBMmLSC EEnuIv8wtz746P1NYC7VMYEtjcIZuVJ0MN/k3Q78= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E9678F80212; Thu, 6 Feb 2020 04:18:23 +0100 (CET) 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 3578CF80255; Thu, 6 Feb 2020 04:18:22 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=disabled version=3.4.0 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) (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 52E7CF801DB for ; Thu, 6 Feb 2020 04:18:17 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 52E7CF801DB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="t6ozdDcW" Received: by mail-pl1-x649.google.com with SMTP id w11so2385420plp.22 for ; Wed, 05 Feb 2020 19:18:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=KEIH1qwXja/ZmU3/27elfahliyGtpPNLFM8jJAbIPe0=; b=t6ozdDcWXnqlycYXVvxHhOWC41qF8dQhtkxMgc3cj9ys3LWT7swok1SnhBVAqh4iIK 8NGSfV4wb+JIYUnOBtkwGiKW7JzQK9Fbhjvr2h71WZluUnlT9W0Bgr8EhRAlKqKxDztE 0d9+GSbN9KCNqXWGRSEM/FSn/rRn+D8W6XEcFtH27mvwDZUFKXCYgdT3hVS5EWHVu/gw PF+v4DFja2f+vDZtTesIeq+13RktcT/86fnEUJd6gxFj9jDTQ/A4tu/vpr5NXiqjgmwY sKlio/9K9cB+vXBOcyXXIYz+P3CWg0IwHwRwAVQ5UJU7ydufexjk2HoQyc1cdNCiCFN7 DDng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=KEIH1qwXja/ZmU3/27elfahliyGtpPNLFM8jJAbIPe0=; b=piQ6jXOpAdgb1d+UtIoLGkOM4Dtw+muV9HKezHxV5G8O+DrrBVIpMii8F81aIJABMI KYkIpUL34ZqSfOgwkbEs1Db/o/lmtC18aEdP6+kE016Mu9F97twmUvus2b+LMpCKs08/ RmtE+uq8UPgbcfv+1mKVuc2e8cpaHDe9zeR2DToW0CqP8uRcCyY4DxuUlKgajMdf/N4C 4LYfADJmfHD/ToSqFdYauQRen7I8mrPNQmUe8vF1QT8Q4eyJ/eeP/79mjuCQBiOI+ZQ9 ReJgTCHRyMjgQYyb7uAp2cM7W7BEKLPPi4AAZ6AYh1333yvPbKYUunHsnviOJXByoS4W JJZw== X-Gm-Message-State: APjAAAXdbyB57bGIbjM7E4utROmw5+hdwp9tYEze8aUx5o4vyBFbEwZx jchyA6CCOmUsR68yv/cC+XD6qqVomHn3 X-Google-Smtp-Source: APXvYqwvYH4hqfpVMgHnlTJXAR9wXcKrV1aylz6TVB7wVNgSuffWm5cIKjVzB2ZMIRRMPL4bBaqkFWGwqZ2Y X-Received: by 2002:a63:ff5c:: with SMTP id s28mr1290924pgk.196.1580959095995; Wed, 05 Feb 2020 19:18:15 -0800 (PST) Date: Thu, 6 Feb 2020 11:17:50 +0800 In-Reply-To: <20200206031752.193298-1-tzungbi@google.com> Message-Id: <20200206102509.1.Ieba8d422486264eb7aaa3aa257620a1b0c74c6db@changeid> Mime-Version: 1.0 References: <20200206031752.193298-1-tzungbi@google.com> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog From: Tzung-Bi Shih To: broonie@kernel.org, airlied@linux.ie, daniel@ffwll.ch Cc: alsa-devel@alsa-project.org, cychiang@google.com, tzungbi@google.com, dri-devel@lists.freedesktop.org, ck.hu@mediatek.com, linux-mediatek@lists.infradead.org, p.zabel@pengutronix.de, matthias.bgg@gmail.com, dgreid@google.com, linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH v2 1/3] drm/mediatek: exit earlier if failed to register audio driver 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" Exits earlier if register_audio_driver() returns errors. Signed-off-by: Tzung-Bi Shih Acked-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_hdmi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index c79b1f855d89..23c2b0e8693d 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1656,7 +1656,7 @@ static const struct hdmi_codec_ops mtk_hdmi_audio_codec_ops = { .get_eld = mtk_hdmi_audio_get_eld, }; -static void mtk_hdmi_register_audio_driver(struct device *dev) +static int mtk_hdmi_register_audio_driver(struct device *dev) { struct hdmi_codec_pdata codec_data = { .ops = &mtk_hdmi_audio_codec_ops, @@ -1669,9 +1669,10 @@ static void mtk_hdmi_register_audio_driver(struct device *dev) PLATFORM_DEVID_AUTO, &codec_data, sizeof(codec_data)); if (IS_ERR(pdev)) - return; + return PTR_ERR(pdev); DRM_INFO("%s driver bound to HDMI\n", HDMI_CODEC_DRV_NAME); + return 0; } static int mtk_drm_hdmi_probe(struct platform_device *pdev) @@ -1705,7 +1706,11 @@ static int mtk_drm_hdmi_probe(struct platform_device *pdev) return ret; } - mtk_hdmi_register_audio_driver(dev); + ret = mtk_hdmi_register_audio_driver(dev); + if (ret) { + dev_err(dev, "Failed to register audio driver: %d\n", ret); + return ret; + } hdmi->bridge.funcs = &mtk_hdmi_bridge_funcs; hdmi->bridge.of_node = pdev->dev.of_node; From patchwork Thu Feb 6 03:17:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11367625 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 82B3014D5 for ; Thu, 6 Feb 2020 03:20:46 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0E69720674 for ; Thu, 6 Feb 2020 03:20:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="RoaxT2Hn"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="naFzHNYg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E69720674 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 46D20169E; Thu, 6 Feb 2020 04:20:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 46D20169E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1580959244; bh=K7jvHd/nyqsObtlZMvNtIpR/YFMMIuT/KyeoouBobG8=; h=Date:In-Reply-To:References:From:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=RoaxT2HnfIyJZvUJaUdcaYI+faggaB0oWffG4EQdRyTqAhnkZ94Ot26xW51UKCeAH us5+gBY2+TOcwfY/LoDFNeNkgXndGxUbgqdDp33mxlOWAStCyBMp9/JI/n3Q/O8ZfY 0qa8W1R4eHl240HwwXB2hTBFprobCYmL8Gxdl8t0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 427D0F80274; Thu, 6 Feb 2020 04:18:31 +0100 (CET) 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 E0E40F80274; Thu, 6 Feb 2020 04:18:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=disabled version=3.4.0 Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) (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 08765F80248 for ; Thu, 6 Feb 2020 04:18:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 08765F80248 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="naFzHNYg" Received: by mail-qt1-x84a.google.com with SMTP id r9so2906478qtc.4 for ; Wed, 05 Feb 2020 19:18:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=GKdSBpWKS5JubKvYHooQ1tsJLs+L1G4clF+7s5FbyHw=; b=naFzHNYgTkl6FjZpBOkCA2X/QrskO3Nyj3+Up6Q4sv70fhZlsQ9OfLbIfk1r0c13f4 eZ7iIngf+0/feqrVf4l2k8moJ1SVAXQLPEgJmjMmLuiAAM62o0X1gRX7fFP7t6Mr4H36 0+tUG3s5KDIURJ7Z1Rk1MINTJQ76nBZiKGmkjah2srKyBHJuv9h4O7MfxPvMBZK1fY6M wiMDH4EIJkavj55219XnSvbSenUmn+5oNJblgUzaI2YDjn6mPonp1jk3SsKy5ukJVDVO t+iWto0HpgeelkmDD2dNdvWDV9C80RAhjpVNvaLx92zuCH5OS92Vsn3t90c9w2TAruRG +bSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=GKdSBpWKS5JubKvYHooQ1tsJLs+L1G4clF+7s5FbyHw=; b=mcy7VG/UDTVangvE2/hwg2CHnouZph7JYl2X2uI9+do+APbZDpooRAWi5ojsKQ3pAP WlsSdCwSqlZx/rbKsHKkBVx1JjRCXuWHa6BqeZS5VDbzMQsoT6mjgXS8TlWIvSW7m5mi DUnmbg0VfSLz/wbiDCnT1h/LiHe6j0muQGU6wlZwl8gSRbAPFflC7sOZzswhMWIpVIie AVVim+OzE50cF/nu7ptp0YYSeIFJmtPyRuynZeEtNjQ0ipip35o6BC9bh9Ek3OVTLP5h HMjASrvYPuGrib5Dwc1DjwoOyz/P97Grnn938W+FGKdnaw3jxEYyLSnmdTGgxZLRxeIY j8ug== X-Gm-Message-State: APjAAAV3Vl0LmBbI/h+LvhnP/UVUnLTcHWe6bv0u6V9l0Y+mlEwoefqz mGcGzUEdZLg16mFz29Z7rRMJWY+MYY6R X-Google-Smtp-Source: APXvYqyJ0n0UFWdJRGiNBcfGeJ9XTuOgIvFLDSVvgEpiQSthosjpQX4dk4r4oRet+K8HdyV3vkafiTKoFhUX X-Received: by 2002:a0c:ffc4:: with SMTP id h4mr662384qvv.233.1580959101083; Wed, 05 Feb 2020 19:18:21 -0800 (PST) Date: Thu, 6 Feb 2020 11:17:51 +0800 In-Reply-To: <20200206031752.193298-1-tzungbi@google.com> Message-Id: <20200206102509.2.I230fd59de28e73934a91cb01424e25b9e84727f4@changeid> Mime-Version: 1.0 References: <20200206031752.193298-1-tzungbi@google.com> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog From: Tzung-Bi Shih To: broonie@kernel.org, airlied@linux.ie, daniel@ffwll.ch Cc: alsa-devel@alsa-project.org, cychiang@google.com, tzungbi@google.com, dri-devel@lists.freedesktop.org, ck.hu@mediatek.com, linux-mediatek@lists.infradead.org, p.zabel@pengutronix.de, matthias.bgg@gmail.com, dgreid@google.com, linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH v2 2/3] drm/mediatek: support HDMI jack status reporting 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" 1. Provides a callback (i.e. mtk_hdmi_audio_hook_plugged_cb) to hdmi-codec. When ASoC machine driver calls hdmi_codec_set_jack_detect(), the callback will be invoked to save plugged_cb and codec_dev parameters. +---------+ set_jack_ +------------+ plugged_cb +----------+ | machine | ----------> | hdmi-codec | ----------> | mtk-hdmi | +---------+ detect() +------------+ codec_dev +----------+ 2. When there is any jack status changes, mtk-hdmi will call the plugged_cb() to notify hdmi-codec. And then hdmi-codec will call snd_soc_jack_report(). +----------+ plugged_cb +------------+ | mtk-hdmi | ----------> | hdmi-codec | -> snd_soc_jack_report() +----------+ codec_dev +------------+ connector_status Signed-off-by: Tzung-Bi Shih --- drivers/gpu/drm/mediatek/mtk_hdmi.c | 34 ++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index 23c2b0e8693d..fccdd975947d 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -169,6 +169,8 @@ struct mtk_hdmi { bool audio_enable; bool powered; bool enabled; + hdmi_codec_plugged_cb plugged_cb; + struct device *codec_dev; }; static inline struct mtk_hdmi *hdmi_ctx_from_bridge(struct drm_bridge *b) @@ -1194,13 +1196,23 @@ static void mtk_hdmi_clk_disable_audio(struct mtk_hdmi *hdmi) clk_disable_unprepare(hdmi->clk[MTK_HDMI_CLK_AUD_SPDIF]); } +static enum drm_connector_status +mtk_hdmi_update_plugged_status(struct mtk_hdmi *hdmi) +{ + bool connected = mtk_cec_hpd_high(hdmi->cec_dev); + + if (hdmi->plugged_cb && hdmi->codec_dev) + hdmi->plugged_cb(hdmi->codec_dev, connected); + + return connected ? + connector_status_connected : connector_status_disconnected; +} + static enum drm_connector_status hdmi_conn_detect(struct drm_connector *conn, bool force) { struct mtk_hdmi *hdmi = hdmi_ctx_from_conn(conn); - - return mtk_cec_hpd_high(hdmi->cec_dev) ? - connector_status_connected : connector_status_disconnected; + return mtk_hdmi_update_plugged_status(hdmi); } static void hdmi_conn_destroy(struct drm_connector *conn) @@ -1648,20 +1660,36 @@ static int mtk_hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf, return 0; } +static int mtk_hdmi_audio_hook_plugged_cb(struct device *dev, void *data, + hdmi_codec_plugged_cb fn, + struct device *codec_dev) +{ + struct mtk_hdmi *hdmi = data; + + hdmi->plugged_cb = fn; + hdmi->codec_dev = codec_dev; + mtk_hdmi_update_plugged_status(hdmi); + + return 0; +} + static const struct hdmi_codec_ops mtk_hdmi_audio_codec_ops = { .hw_params = mtk_hdmi_audio_hw_params, .audio_startup = mtk_hdmi_audio_startup, .audio_shutdown = mtk_hdmi_audio_shutdown, .digital_mute = mtk_hdmi_audio_digital_mute, .get_eld = mtk_hdmi_audio_get_eld, + .hook_plugged_cb = mtk_hdmi_audio_hook_plugged_cb, }; static int mtk_hdmi_register_audio_driver(struct device *dev) { + struct mtk_hdmi *hdmi = dev_get_drvdata(dev); struct hdmi_codec_pdata codec_data = { .ops = &mtk_hdmi_audio_codec_ops, .max_i2s_channels = 2, .i2s = 1, + .data = hdmi, }; struct platform_device *pdev; From patchwork Thu Feb 6 03:17:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11367627 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 795331395 for ; Thu, 6 Feb 2020 03:21:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0EA1B20720 for ; Thu, 6 Feb 2020 03:21:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="uEEoTJ5A"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="ueuYkYfz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0EA1B20720 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 531DA16A6; Thu, 6 Feb 2020 04:20:45 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 531DA16A6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1580959289; bh=uzq0zuDqOYCJ90ejD0z8FRESahyYoUZEm6jpVbv5GDg=; h=Date:In-Reply-To:References:From:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=uEEoTJ5A9/KoDYsSRC/eXOtaJGOj/cH/mJBP3Zk7bOSZcIjZ9soSlRILfcoLDTIZm jBTNAUDncGZ4SoWKpQBBo2OKzShZ9eNV+13/WoEO84HfSPmvOk3TlDa6zRprOg4yAv XDTvrA0/mBrvrspzbVZOo6RMJJRdXaEKZOO9GX6k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 78980F8028B; Thu, 6 Feb 2020 04:18:33 +0100 (CET) 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 10BD4F80278; Thu, 6 Feb 2020 04:18:32 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=disabled version=3.4.0 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) (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 0A33FF8025F for ; Thu, 6 Feb 2020 04:18:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0A33FF8025F Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ueuYkYfz" Received: by mail-qv1-xf49.google.com with SMTP id f17so2859758qvi.6 for ; Wed, 05 Feb 2020 19:18:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=3xSqtFmkuhmH7fZvAamf8hbYq+ufSxebJYVWVye4C7Y=; b=ueuYkYfzd1J7mUX84rods+zZPBEDPeQEpjWo1fKgNXmmkJRjFmQ57clQ25FbxVrB81 0BoeuWRSAlLi4ikcBydPblOqMIIYdUZlWt96IlppvTopxt4MrWxe1NJNb00pEILdALIL mwP9m3shNI4otFS5JNL2mDva9EvmqHjaLpSPV+4fWAoYFTZp1nvG0CRMuMvaQQpiTocd RdQCWBIwo+BGVgpp3NbIEtfA/GO13BcJrwl9r2EoO9jqfv5ogBgO5W/6Q7nyLCxted8+ Q/tls29mCNiLAHzFozF2uSg8V5VCuOfUUjtgXE6vmEdrV5rvwC9qaa9Tedzul30Dx9L2 FkGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=3xSqtFmkuhmH7fZvAamf8hbYq+ufSxebJYVWVye4C7Y=; b=G0o0MlGXKR3A8zvpUIGMzU2mJWypkQtkW202BT3top5JHP84swKate+y42HtS8qGQv nRJ+W+ONnkJRmJZZ/IxFap/Hw3g9I3R0aAhdwb6pGccxlZrNYKsncJiz3f711KwD/JUe D0N6aLjRIhsDOC/aIC426stcWvY3pp8bUWNmxPmvpsVkkq4YAQtZpHDAHtMer0iaJhy4 hRye11V52SfRGFNSRqTH9UwW+2tT0bpEQCcom3SrcaxEPR1T2CDnylTXq7lzysQmopyK f8I84ncqfMLSQfE31bx88Kwr8sZ3eMeSo2779BCldvji5s0VARPGj/4gCzkYIkWbtkfm TFwA== X-Gm-Message-State: APjAAAVDvXv5YGKNq27cmADdcDk77KNIQQ9h5ZFHtrfEvkPC7nfP3SYW 08/hDoDbLrfqyd8G53rahTQZYMrJYOER X-Google-Smtp-Source: APXvYqz/fAMuYGvIwuayOCKaf8jH3Jt4uA2sxWoRh0ciqFGB/O4svWNUa/d29O7qRqPWaudemfa9s6lehhZc X-Received: by 2002:a0c:fe8e:: with SMTP id d14mr705336qvs.106.1580959106204; Wed, 05 Feb 2020 19:18:26 -0800 (PST) Date: Thu, 6 Feb 2020 11:17:52 +0800 In-Reply-To: <20200206031752.193298-1-tzungbi@google.com> Message-Id: <20200206102509.3.I253f51edff62df1d88005de12ba601aa029b1e99@changeid> Mime-Version: 1.0 References: <20200206031752.193298-1-tzungbi@google.com> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog From: Tzung-Bi Shih To: broonie@kernel.org, airlied@linux.ie, daniel@ffwll.ch Cc: alsa-devel@alsa-project.org, cychiang@google.com, tzungbi@google.com, dri-devel@lists.freedesktop.org, ck.hu@mediatek.com, linux-mediatek@lists.infradead.org, p.zabel@pengutronix.de, matthias.bgg@gmail.com, dgreid@google.com, linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH v2 3/3] ASoC: mediatek: mt8173-rt5650: support HDMI jack reporting 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" Uses hdmi-codec to support HDMI jack reporting. Signed-off-by: Tzung-Bi Shih --- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek/mt8173/mt8173-rt5650.c index ef6f23675286..849b050a54d1 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "../../codecs/rt5645.h" #define MCLK_FOR_CODECS 12288000 @@ -98,7 +99,7 @@ static const struct snd_soc_ops mt8173_rt5650_ops = { .hw_params = mt8173_rt5650_hw_params, }; -static struct snd_soc_jack mt8173_rt5650_jack; +static struct snd_soc_jack mt8173_rt5650_jack, mt8173_rt5650_hdmi_jack; static int mt8173_rt5650_init(struct snd_soc_pcm_runtime *runtime) { @@ -144,6 +145,19 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime *runtime) &mt8173_rt5650_jack); } +static int mt8173_rt5650_hdmi_init(struct snd_soc_pcm_runtime *rtd) +{ + int ret; + + ret = snd_soc_card_jack_new(rtd->card, "HDMI Jack", SND_JACK_LINEOUT, + &mt8173_rt5650_hdmi_jack, NULL, 0); + if (ret) + return ret; + + return hdmi_codec_set_jack_detect(rtd->codec_dai->component, + &mt8173_rt5650_hdmi_jack); +} + enum { DAI_LINK_PLAYBACK, DAI_LINK_CAPTURE, @@ -222,6 +236,7 @@ static struct snd_soc_dai_link mt8173_rt5650_dais[] = { .name = "HDMI BE", .no_pcm = 1, .dpcm_playback = 1, + .init = mt8173_rt5650_hdmi_init, SND_SOC_DAILINK_REG(hdmi_be), }, };