From patchwork Tue Oct 22 11:45:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11204313 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 0411C14E5 for ; Tue, 22 Oct 2019 11:48:41 +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 8A3E521783 for ; Tue, 22 Oct 2019 11:48:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="d7mCou+D"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="fvUU4X0S" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A3E521783 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 ECADC165E; Tue, 22 Oct 2019 13:47:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz ECADC165E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1571744918; bh=N0Ra5v6ncfivvR4ViBN4JpOh91qMtywBhzQ0bM6Qgek=; h=Date:In-Reply-To:References:From:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=d7mCou+DzujrfwwBJAywy+24BOyY1Ii0wernDj32B4R+fK4gwR+GioYnMRR8aoTHp COhsTO7pT0pEb3zgw0MNVwHVIHAM9pj1pihWsJRe+szBcGxgOTE/OUkOcE+ETYIxov jX0dqxkyTTF34rUgIM/GeYuKqoLL3RqCKz9yEZJo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6B334F80377; Tue, 22 Oct 2019 13:47: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 9614CF80539; Tue, 22 Oct 2019 13:46:54 +0200 (CEST) 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-vk1-xa49.google.com (mail-vk1-xa49.google.com [IPv6:2607:f8b0:4864:20::a49]) (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 CC834F80112 for ; Tue, 22 Oct 2019 13:46:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CC834F80112 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="fvUU4X0S" Received: by mail-vk1-xa49.google.com with SMTP id i20so7455655vkk.21 for ; Tue, 22 Oct 2019 04:46:51 -0700 (PDT) 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=q90rWJEkGm2l9nI3fLz2Cj+itxcilYQDCfUCXu1yWQg=; b=fvUU4X0Sib4BfXVWA9CPePFVHefO+pH8Ci8fFdRiFSB5iTPQA+ra5mL+VLYXS7IZNR zt4DCioEFPM6+qZU7/V76QviJtdzE8pWUIIYz25OGqu8fcCg/ad/mBFD0X3VMj6iE6sl 5e5jBG8G1FjxHr/xlaM66aihrErDmJqsgHtVlTctEF8nGdpQyh3/iGguis1EpaVIXxFc r9FVu8lnN5mq2/lZJKIog6SciWR7ePKbkaMVHBwIX4gQOmsutILG/GhOmCeRGTxxkxUJ a75pPUwAB59Lx1guwRD0KIOKxiPcMXxt31Pn9IJzZN9q+c/Rv4tOuPJCaKinGj7AQDa0 0CQg== 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=q90rWJEkGm2l9nI3fLz2Cj+itxcilYQDCfUCXu1yWQg=; b=KCgwF2foBVOW5NVV2U+pOsIfizNsvE2euYIu+jF1wgh/V/Ytiri2AdTUjT7ON2I7rK FGGcNT1utfpmgGyK38jVPiTz/LbKRKcSuPNtQIEn95GRZUimGzwWhRte7B1A5jGLkI9s CUegvthfxenQNq1Wp6utJW0Z+FQHxOHkRs5MyDEliRKP8VN99m0Zk4+rFhjk0FahjXsb 2mw+uWYlJ/Kw2PfT9ZjJJX2H7ZORpG5/Bj8gnycc0ZIOqZ63qOuwzIbywWv81Yr1/XYd fLlSqq4OijoctemwgSm8lRmqXDMBflDNjyKEiVLovoIargvr4bvK6u4Gv9i6m6Q2F7po /TIQ== X-Gm-Message-State: APjAAAVqOlJfQjWyFXRomYvjCjm0At5SKeRDDjnRIhbgakJH5j+32HpD HfAa5LUG7HDkp9LcZCfzrhZ6b9vHq8IA X-Google-Smtp-Source: APXvYqzsB+mP+SYK0nkZDI+E5ctlzYSDa2qZV3FsZvCzlBqBSD0WoJVKv1DehaXyYVIbfl0rJsvRLOUyAOTG X-Received: by 2002:a67:8841:: with SMTP id k62mr1532968vsd.101.1571744809794; Tue, 22 Oct 2019 04:46:49 -0700 (PDT) Date: Tue, 22 Oct 2019 19:45:00 +0800 In-Reply-To: <20191022114505.196852-1-tzungbi@google.com> Message-Id: <20191022193301.1.I3039014cf259de5e4d6315fc05dff111591a0901@changeid> Mime-Version: 1.0 References: <20191022114505.196852-1-tzungbi@google.com> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog From: Tzung-Bi Shih To: broonie@kernel.org, robh+dt@kernel.org, narmstrong@baylibre.com Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, cychiang@google.com, jonas@kwiboo.se, allen.chen@ite.com.tw, jernej.skrabec@siol.net, dri-devel@lists.freedesktop.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, tzungbi@google.com, dgreid@google.com Subject: [alsa-devel] [PATCH 1/6] ASoC: hdmi-codec: add PCM trigger operator 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" HDMI codec may be also interested in PCM triggers. Add PCM trigger operator. Signed-off-by: Tzung-Bi Shih --- include/sound/hdmi-codec.h | 13 +++++++++++++ sound/soc/codecs/hdmi-codec.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h index 83b17682e01c..9de462ef170d 100644 --- a/include/sound/hdmi-codec.h +++ b/include/sound/hdmi-codec.h @@ -50,6 +50,13 @@ struct hdmi_codec_params { typedef void (*hdmi_codec_plugged_cb)(struct device *dev, bool plugged); +enum { + HDMI_CODEC_TRIGGER_EVENT_STOP, + HDMI_CODEC_TRIGGER_EVENT_START, + HDMI_CODEC_TRIGGER_EVENT_SUSPEND, + HDMI_CODEC_TRIGGER_EVENT_RESUME, +}; + struct hdmi_codec_pdata; struct hdmi_codec_ops { /* @@ -66,6 +73,12 @@ struct hdmi_codec_ops { struct hdmi_codec_daifmt *fmt, struct hdmi_codec_params *hparms); + /* + * PCM trigger callback. + * Optional + */ + int (*trigger)(struct device *dev, int event); + /* * Shuts down the audio stream. * Mandatory diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index b5fd8f08726e..1ba2fa26ba03 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -565,12 +565,42 @@ static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute) return 0; } +static int hdmi_codec_trigger(struct snd_pcm_substream *substream, int cmd, + struct snd_soc_dai *dai) +{ + struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); + int event; + + if (!hcp->hcd.ops->trigger) + return 0; + + switch (cmd) { + case SNDRV_PCM_TRIGGER_STOP: + event = HDMI_CODEC_TRIGGER_EVENT_STOP; + break; + case SNDRV_PCM_TRIGGER_START: + event = HDMI_CODEC_TRIGGER_EVENT_START; + break; + case SNDRV_PCM_TRIGGER_SUSPEND: + event = HDMI_CODEC_TRIGGER_EVENT_SUSPEND; + break; + case SNDRV_PCM_TRIGGER_RESUME: + event = HDMI_CODEC_TRIGGER_EVENT_RESUME; + break; + default: + return -EINVAL; + } + + return hcp->hcd.ops->trigger(dai->dev->parent, event); +} + static const struct snd_soc_dai_ops hdmi_codec_i2s_dai_ops = { .startup = hdmi_codec_startup, .shutdown = hdmi_codec_shutdown, .hw_params = hdmi_codec_hw_params, .set_fmt = hdmi_codec_i2s_set_fmt, .digital_mute = hdmi_codec_digital_mute, + .trigger = hdmi_codec_trigger, }; static const struct snd_soc_dai_ops hdmi_codec_spdif_dai_ops = { @@ -578,6 +608,7 @@ static const struct snd_soc_dai_ops hdmi_codec_spdif_dai_ops = { .shutdown = hdmi_codec_shutdown, .hw_params = hdmi_codec_hw_params, .digital_mute = hdmi_codec_digital_mute, + .trigger = hdmi_codec_trigger, }; #define HDMI_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\ From patchwork Tue Oct 22 11:45:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11204319 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 EB92F14E5 for ; Tue, 22 Oct 2019 11:49:27 +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 7F227218AE for ; Tue, 22 Oct 2019 11:49:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="X/IcQACh"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="v/XhJrE4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F227218AE 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 B53A583D; Tue, 22 Oct 2019 13:48:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B53A583D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1571744965; bh=WfWnPENLBYdVwatXeqJjh+oXGFDwcScRke2w0vXCpm0=; h=Date:In-Reply-To:References:From:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=X/IcQAChNwYI+c0U8WPucOOycfzbupgbgwR6hYv6MTFdNwayAVZyFYxwp5IuZUbxF BPadWYqYjnOXOAAdQMPGxBFjvkI5/PHJ/pglj1cZdIoAlQDjkIxI5u/xD9hdFh50yT zYPzie9cZl+TnGcQQKkBtT9L+2KaYRF0bZCgsui0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7736DF805FB; Tue, 22 Oct 2019 13:47:02 +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 76AACF80390; Tue, 22 Oct 2019 13:46:59 +0200 (CEST) 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,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=disabled version=3.4.0 Received: from mail-ua1-x949.google.com (mail-ua1-x949.google.com [IPv6:2607:f8b0:4864:20::949]) (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 CAA81F80112 for ; Tue, 22 Oct 2019 13:46:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CAA81F80112 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="v/XhJrE4" Received: by mail-ua1-x949.google.com with SMTP id g23so159560uan.5 for ; Tue, 22 Oct 2019 04:46:56 -0700 (PDT) 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=6PvO4YGcBPU7HqTKrAMBpr5jWnrEO6vhCWHVgxtCZF0=; b=v/XhJrE4hvhwOzEGcKs+eQoCDnnCj5mUo5POIAosRXGG9AR786k5ivdMEx0u1rAa0G 6FwQqiAnM4B6RlupEtxMjyDNTPzx34+E+/70eATGUSkjoJ8W8GvCVILVpBm2wwS0OLtF FsHUuxV6o+LY4rkICqCZ2pv588XXJ85QW0p3TajaPFxkmYIuxmsJAgn01++mJD7sr8FX qQK7k3vaWYUeu/1UDlFrcRHs8lKDl5yseG5047lhqeRkvc7QVEOoMnskxTlBn2dviIYF WvDKYhDmT/6v2QcIjvBcyBFdj5zYQORvKyeT9rKwpfGTE+vQjTOHSioHV293JvSx2+5k jm2g== 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=6PvO4YGcBPU7HqTKrAMBpr5jWnrEO6vhCWHVgxtCZF0=; b=FMmMSGxABSa7+Oo55x3UCOYd2vnrWdSnEzfggwgPJ8BjlwxAZOQXwz0ePpvFTgUSet Q6P88LGGjkHLhGP9NjVyhzgDcr02WdIAllWqa/Qi2jrfmK3avPmFkAVSdPNOQXY4pzGn QQvmhbbxSM8MEEbmOC1tvWA+DvZO4R2eHWnxPtnYP4F3JZNVUBuNzP+mfLLB1EdEEKOi Z3e0qmXxefpIY6uBvGyOpUN8ShD+NuNKIFjWTwJVUVFNwxKk/P10w/QTEr6A1OdxxRlH 06FB5/faST7v9C3C/18Lld1MCIRrrrGjgRuGT9mgfsqOM3ZLTJt/iV+jKu+WIFp4U8gv rXVg== X-Gm-Message-State: APjAAAX6qwv3YkM38ESpsj+aCXo+NjCEQk+lFmk1H1M7kk937twZbR3Z dW3PaF9mU+MJohq2I4Jd9BrrcG9W583s X-Google-Smtp-Source: APXvYqwY1rlBy1N3hHiRYbjJlOMwfLIOQOq0dmz2amkEN+2rQ4+TI3BcHF+QmqbKwaRye4ZzLeXpjHYP/Bkz X-Received: by 2002:a67:f2da:: with SMTP id a26mr1534141vsn.60.1571744814867; Tue, 22 Oct 2019 04:46:54 -0700 (PDT) Date: Tue, 22 Oct 2019 19:45:01 +0800 In-Reply-To: <20191022114505.196852-1-tzungbi@google.com> Message-Id: <20191022193301.2.I66284413ef7dbbf4b6ea7735f71807ebd35bf7e8@changeid> Mime-Version: 1.0 References: <20191022114505.196852-1-tzungbi@google.com> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog From: Tzung-Bi Shih To: broonie@kernel.org, robh+dt@kernel.org, narmstrong@baylibre.com Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, cychiang@google.com, jonas@kwiboo.se, allen.chen@ite.com.tw, jernej.skrabec@siol.net, dri-devel@lists.freedesktop.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, tzungbi@google.com, dgreid@google.com Subject: [alsa-devel] [PATCH 2/6] drm: bridge: it6505: bridge to hdmi-codec 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" From: Allen Chen Bridge to hdmi-codec to support audio feature. It is observed that some DP-to-HDMI dongles will get into bad states if sending InfoFrame without audio data. Defer to enable it6505's audio feature when PCM triggers START or RESUME. Signed-off-by: Allen Chen Signed-off-by: Tzung-Bi Shih --- drivers/gpu/drm/bridge/ite-it6505.c | 152 ++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c index 5e046f677343..1d19184d2056 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -26,6 +26,8 @@ #include #include +#include + #define AX 0 #define BX 1 #define AUDSEL I2S @@ -146,6 +148,7 @@ struct it6505 { struct notifier_block event_nb; struct extcon_dev *extcon; struct work_struct extcon_wq; + struct delayed_work delayed_audio; enum sys_status status; bool hbr; u8 en_ssc; @@ -1223,6 +1226,149 @@ static void it6505_set_audio(struct it6505 *it6505) dptxset(it6505, 0xD3, 0x20, 0x00); } +static void it6505_delayed_audio(struct work_struct *work) +{ + struct it6505 *it6505 = container_of(work, struct it6505, + delayed_audio.work); + + it6505_set_audio(it6505); + it6505->en_audio = 1; +} + +static int it6505_audio_hw_params(struct device *dev, void *data, + struct hdmi_codec_daifmt *daifmt, + struct hdmi_codec_params *params) +{ + struct it6505 *it6505 = dev_get_drvdata(dev); + unsigned int channel_num = params->cea.channels; + + DRM_DEV_DEBUG_DRIVER(dev, "setting %d Hz, %d bit, %d channels\n", + params->sample_rate, params->sample_width, + channel_num); + + if (!it6505->bridge.encoder) + return -ENODEV; + + switch (params->sample_rate) { + case 24000: + it6505->aud_fs = AUD24K; + break; + case 32000: + it6505->aud_fs = AUD32K; + break; + case 44100: + it6505->aud_fs = AUD44P1K; + break; + case 48000: + it6505->aud_fs = AUD48K; + break; + case 88200: + it6505->aud_fs = AUD88P2K; + break; + case 96000: + it6505->aud_fs = AUD96K; + break; + case 176400: + it6505->aud_fs = AUD176P4K; + break; + case 192000: + it6505->aud_fs = AUD192K; + break; + default: + DRM_DEV_DEBUG_DRIVER(dev, "sample rate: %d Hz not support", + params->sample_rate); + return -EINVAL; + } + + switch (params->sample_width) { + case 16: + it6505->audwordlength = AUD16BIT; + break; + case 18: + it6505->audwordlength = AUD18BIT; + break; + case 20: + it6505->audwordlength = AUD20BIT; + break; + case 24: + case 32: + it6505->audwordlength = AUD24BIT; + break; + default: + DRM_DEV_DEBUG_DRIVER(dev, "wordlength: %d bit not support", + params->sample_width); + return -EINVAL; + } + + if (channel_num == 0 || channel_num % 2) { + DRM_DEV_DEBUG_DRIVER(dev, "channel number: %d not support", + channel_num); + return -EINVAL; + } + it6505->aud_ch = channel_num; + + return 0; +} + +static int it6505_audio_trigger(struct device *dev, int event) +{ + struct it6505 *it6505 = dev_get_drvdata(dev); + + DRM_DEV_DEBUG_DRIVER(dev, "event: %d", event); + switch (event) { + case HDMI_CODEC_TRIGGER_EVENT_START: + case HDMI_CODEC_TRIGGER_EVENT_RESUME: + queue_delayed_work(system_wq, &it6505->delayed_audio, + msecs_to_jiffies(180)); + break; + case HDMI_CODEC_TRIGGER_EVENT_STOP: + case HDMI_CODEC_TRIGGER_EVENT_SUSPEND: + cancel_delayed_work(&it6505->delayed_audio); + break; + default: + return -EINVAL; + } + + return 0; +} + +static void it6505_audio_shutdown(struct device *dev, void *data) +{ + struct it6505 *it6505 = dev_get_drvdata(dev); + + dptxset(it6505, 0xE8, 0x22, 0x00); + dptxset(it6505, 0x05, 0x02, 0x02); + it6505->en_audio = 0; +} + +static const struct hdmi_codec_ops it6505_audio_codec_ops = { + .hw_params = it6505_audio_hw_params, + .trigger = it6505_audio_trigger, + .audio_shutdown = it6505_audio_shutdown, +}; + +static int it6505_register_audio_driver(struct device *dev) +{ + struct it6505 *it6505 = dev_get_drvdata(dev); + struct hdmi_codec_pdata codec_data = { + .ops = &it6505_audio_codec_ops, + .max_i2s_channels = 8, + .i2s = 1, + }; + struct platform_device *pdev; + + pdev = platform_device_register_data(dev, HDMI_CODEC_DRV_NAME, + PLATFORM_DEVID_AUTO, &codec_data, + sizeof(codec_data)); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + + INIT_DELAYED_WORK(&it6505->delayed_audio, it6505_delayed_audio); + + DRM_DEV_DEBUG_DRIVER(dev, "bound to %s", HDMI_CODEC_DRV_NAME); + return 0; +} + /*************************************************************************** * DPCD Read and EDID ***************************************************************************/ @@ -2460,6 +2606,12 @@ static int it6505_i2c_probe(struct i2c_client *client, return err; } + err = it6505_register_audio_driver(dev); + if (err < 0) { + DRM_DEV_ERROR(dev, "Failed to register audio driver: %d", err); + return err; + } + /* Register aux channel */ it6505->aux.name = "DP-AUX"; it6505->aux.dev = dev; From patchwork Tue Oct 22 11:45:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11204321 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 307FE14ED for ; Tue, 22 Oct 2019 11:50:17 +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 B6CFE21872 for ; Tue, 22 Oct 2019 11:50:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="NXibA2US"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="rWB904Gc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6CFE21872 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 D9A771654; Tue, 22 Oct 2019 13:49:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D9A771654 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1571745014; bh=yzbXwWHzHqkImDcCWtFGNuiuoJYYBC1wUUr8D2TodCc=; h=Date:In-Reply-To:References:From:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NXibA2USnH8T0jbQnqdde1RCdz4jWcpcVS7ODejIITKe5FIBe6xs84AaF0E3a+w/b lOOPyO6xzhPR9D71jQzoC0nfGe4PJHfeF0aby1E+UH2BrCDJOmCrRIPUds8sRoWn5F VYfPc5E6Jf3XGASqxcYqFIGT2eZWdqOxlU5ksILE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 76138F8060D; Tue, 22 Oct 2019 13:47:09 +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 CC6ECF8060D; Tue, 22 Oct 2019 13:47:04 +0200 (CEST) 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-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) (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 68008F805FF for ; Tue, 22 Oct 2019 13:47:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 68008F805FF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rWB904Gc" Received: by mail-qk1-x749.google.com with SMTP id s3so16398069qkd.6 for ; Tue, 22 Oct 2019 04:47:01 -0700 (PDT) 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=ZsrVaR6vc/qnzUA4wVz/77TV1vtgZkJHUiseGtW32fE=; b=rWB904Gcs2qVJZUdeAyoeepfzKedgnQjJZ4jfO3wA6WjqYb2giKU5Pzx6ySfLtL2A0 C6G6kK2HU9Bq/aW8NNHtf4gVgn+a7FpdApE4JmhpKiKxDBdyJd5ELjOwCOUHnqAEC6ju p9UzXTH32R+O8Ob6C2dZTmDtGa3SCOUtc35f7m5G7APRhN3dqXcFTbK7RaQizelauCeW iMcqQAFx9SxO10nufCXxuspyLOK8zXPgo1FF7o2TKgZuNIcuq0cEjSqoZFlV/sw3o0ES qitFE0wo1hMeoSthzVhddP3lGNji2i8tKc+iG/apvGVcxGXfpqXwlRRIQTE4qIxwHAd6 DFEQ== 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=ZsrVaR6vc/qnzUA4wVz/77TV1vtgZkJHUiseGtW32fE=; b=gv8KXtom40KDqbZ6q/JdX5irPYpbHp45Ogc19NUVVBsG6IxwTLSRpiXxVphHqxKIzJ 1IUsZ8/GTLZGPaDEUFbnT8PBWbrxCzIkUB10LX4Njng8Bofu8SqtMos7yHJJ3uA8TX19 jZ8Ya7TfWyHslW4F2LJEYJVjXglCjrfEJzQ9baSrHUjrJeNa33gVgMWDHppG4qn0GCY7 CPGayHqNgYxIXIIplnvl/bUdsvhXp7qRVE5Gdt+pRcwnKNwCTHK+QG/1OuMnyoexfnpm i+sK+gn+MgUiNDsiIy2tbi3JWLNA4VrxcLkaYOH62/pZVIRxcFRjb4vpSreA7P5YILJl nfcg== X-Gm-Message-State: APjAAAXy3dpuruqxwTvC6CeXsMD3cUPpytnwMddQBaaQC5FbCA22mLvj BIX0mI2oXgk+ef8mECA0AvcgaVhL6sJ7 X-Google-Smtp-Source: APXvYqwP2XO0+wPKaNKqstjcgNhdUynq5gHMc5aDViFMW7a988Y2xcf+1D8ZFjFrBT2cjoj1ZcA528RiWWjN X-Received: by 2002:a37:8dc6:: with SMTP id p189mr2474821qkd.132.1571744819983; Tue, 22 Oct 2019 04:46:59 -0700 (PDT) Date: Tue, 22 Oct 2019 19:45:02 +0800 In-Reply-To: <20191022114505.196852-1-tzungbi@google.com> Message-Id: <20191022193301.3.I37696eb1321a21846f9e5a9eb14dfac7dbe10663@changeid> Mime-Version: 1.0 References: <20191022114505.196852-1-tzungbi@google.com> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog From: Tzung-Bi Shih To: broonie@kernel.org, robh+dt@kernel.org, narmstrong@baylibre.com Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, cychiang@google.com, jonas@kwiboo.se, allen.chen@ite.com.tw, jernej.skrabec@siol.net, dri-devel@lists.freedesktop.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, tzungbi@google.com, dgreid@google.com Subject: [alsa-devel] [PATCH 3/6] ASoC: dt-bindings: mt8183: add a property "mediatek, hdmi-codec" 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" Add an optional property "mediatek,hdmi-codec". Signed-off-by: Tzung-Bi Shih Acked-by: Rob Herring --- .../bindings/sound/mt8183-mt6358-ts3a227-max98357.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt b/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt index decaa013a07e..cc2845287e61 100644 --- a/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +++ b/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt @@ -8,6 +8,7 @@ Optional properties: - mediatek,headset-codec: the phandles of ts3a227 codecs - mediatek,ec-codec: the phandle of EC codecs. See google,cros-ec-codec.txt for more details. +- mediatek,hdmi-codec: the phandles of HDMI codec Example: @@ -15,6 +16,7 @@ Example: compatible = "mediatek,mt8183_mt6358_ts3a227_max98357"; mediatek,headset-codec = <&ts3a227>; mediatek,ec-codec = <&ec_codec>; + mediatek,hdmi-codec = <&it6505dptx>; mediatek,platform = <&afe>; }; From patchwork Tue Oct 22 11:45:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11204323 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 4192E14E5 for ; Tue, 22 Oct 2019 11:50:40 +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 C765821906 for ; Tue, 22 Oct 2019 11:50:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="DQnRiMAE"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="SIBiN9mi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C765821906 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 EAD0C1674; Tue, 22 Oct 2019 13:49:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EAD0C1674 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1571745038; bh=dvRh5ZBY30PfUQEDKRsCjsaZiH6XL90uOPZmH4n5OfU=; h=Date:In-Reply-To:References:From:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DQnRiMAE/4XccvdHX44i8ZzKZWfFPkjqmv/GUZQAtOlQSjrw0A76qQUME4jPg+G+Z LRNdkx90CtBOuzYvwsY8EZvyfS0K4M59KI4eiYfcq+WLTkaiuP87n3mApraNZX29n/ oEiq9kcoBQJi6zyOxf6b6S5Hx/kOk++DcrdcOISY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1F451F80612; Tue, 22 Oct 2019 13:47:11 +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 42CC1F80612; Tue, 22 Oct 2019 13:47:10 +0200 (CEST) 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-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) (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 424C3F805FD for ; Tue, 22 Oct 2019 13:47:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 424C3F805FD Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="SIBiN9mi" Received: by mail-pf1-x44a.google.com with SMTP id 22so13182590pfx.8 for ; Tue, 22 Oct 2019 04:47:06 -0700 (PDT) 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=bhx4XpOMOAvSvKbY+GNWUpjZmdRh9xAzVtH8yGRzOsQ=; b=SIBiN9miBukP2vHVz9yb1Z7FzYKWBp7bstUfIx/l48YcGQot4ut6+8V5YUJL6c1Vqp 0A/NHXnagesp/88Em+/Q++21OMqJgdwe9fSH0k6LaOG4jpyJyc5tDwISjoBwE6mLxDSa 5veKygBQcZRHA4AZSjrCwhGgXe5MlbkeCUSywhc1nboAqBjXAADehO5RiEnoH+Ya/rkn 8ncAtmX9QmchPk8cZwR0wLlGED4guLq/cpUFd7MfjP5n9FZtZt9lRPqBFKOrIKm+5r9x hpFDohJpJTr9QNLCYOEN8Ii6mALgfaNKpGwWnkxxYn5ezvpwhygwN7nAytfE7CPmcqJN cXOw== 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=bhx4XpOMOAvSvKbY+GNWUpjZmdRh9xAzVtH8yGRzOsQ=; b=NkMXAGJDgStjNfQ/Ysgr08s7zZLUqpfNAP+UJdyPwuTWW+W+6HXk8JXA1zAg68bx7N 80PW13qu581uVinEYXDW+Rwwi3TwZlOVM6eWnD8u/lI1d7EtZ6luy0JS3rl3DqdD8T/J +hXV9HfM/IpNGx0sHDVoGa+yR7JiYCq720/E/ke47Y+bBAOeSKlzM1yvkH6uXT+lazA7 vH32TqH4cSvWB2wwjNXI9W3M/qZyfrFdbTDoquWYxPDLKdX8yLMNverlDjUkR4pvkKC4 n5rzNd3KYzo5EO5gpoSQAGwyXsuA1Dh4CDjHmTZjwPuOcgWjtWUEKXRuloGb0QDKLpNn 5yDQ== X-Gm-Message-State: APjAAAWEaCNU4v0yy/2EfMasI4M1+aglqKaM9XHDn4kcidCtnqpPatLa sRP/87h/cAPu5f3kCbsq6RzTtWIX8tzI X-Google-Smtp-Source: APXvYqxav0HrOfMpw4960RSWWzv7KqgN4pnD2wXbdoyd8cYu/tGEv/ffv9S5k7+O4gnGu3yAJgDijmZjv4MQ X-Received: by 2002:a63:6116:: with SMTP id v22mr3089716pgb.95.1571744825052; Tue, 22 Oct 2019 04:47:05 -0700 (PDT) Date: Tue, 22 Oct 2019 19:45:03 +0800 In-Reply-To: <20191022114505.196852-1-tzungbi@google.com> Message-Id: <20191022193301.4.I659b5e6b25155890b85eb1c361e60f92d2500b7e@changeid> Mime-Version: 1.0 References: <20191022114505.196852-1-tzungbi@google.com> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog From: Tzung-Bi Shih To: broonie@kernel.org, robh+dt@kernel.org, narmstrong@baylibre.com Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, cychiang@google.com, jonas@kwiboo.se, allen.chen@ite.com.tw, jernej.skrabec@siol.net, dri-devel@lists.freedesktop.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, tzungbi@google.com, dgreid@google.com Subject: [alsa-devel] [PATCH 4/6] ASoC: mediatek: mt8183: use hdmi-codec 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" Add DAI link to use hdmi-codec. Signed-off-by: Tzung-Bi Shih --- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c index 0555f7d73d05..258f1416fae1 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -191,7 +191,7 @@ SND_SOC_DAILINK_DEFS(i2s5, SND_SOC_DAILINK_DEFS(tdm, DAILINK_COMP_ARRAY(COMP_CPU("TDM")), - DAILINK_COMP_ARRAY(COMP_DUMMY()), + DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "i2s-hifi")), DAILINK_COMP_ARRAY(COMP_EMPTY())); static int mt8183_mt6358_tdm_startup(struct snd_pcm_substream *substream) @@ -479,7 +479,7 @@ static int mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) { struct snd_soc_card *card = &mt8183_mt6358_ts3a227_max98357_card; - struct device_node *platform_node, *ec_codec; + struct device_node *platform_node, *ec_codec, *hdmi_codec; struct snd_soc_dai_link *dai_link; struct mt8183_mt6358_ts3a227_max98357_priv *priv; int ret; @@ -496,9 +496,12 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) ec_codec = of_parse_phandle(pdev->dev.of_node, "mediatek,ec-codec", 0); + hdmi_codec = of_parse_phandle(pdev->dev.of_node, + "mediatek,hdmi-codec", 0); + for_each_card_prelinks(card, i, dai_link) { - if (dai_link->platforms->name) - continue; + if (!dai_link->platforms->name) + dai_link->platforms->of_node = platform_node; if (ec_codec && strcmp(dai_link->name, "Wake on Voice") == 0) { dai_link->cpus[0].name = NULL; @@ -509,9 +512,10 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) dai_link->codecs[0].dai_name = "Wake on Voice"; dai_link->platforms[0].of_node = ec_codec; dai_link->ignore = 0; - } else { - dai_link->platforms->of_node = platform_node; } + + if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) + dai_link->codecs->of_node = hdmi_codec; } mt8183_mt6358_ts3a227_max98357_headset_dev.dlc.of_node = From patchwork Tue Oct 22 11:45:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11204325 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 D739D14E5 for ; Tue, 22 Oct 2019 11:51: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 6752621872 for ; Tue, 22 Oct 2019 11:51: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="PP0LP+t7"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="I0acZyZn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6752621872 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 A87731655; Tue, 22 Oct 2019 13:50:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A87731655 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1571745089; bh=Q8RVOsqENkdWVN0W988Nlfevf9nxJoT9QwJK2CqF1zk=; h=Date:In-Reply-To:References:From:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=PP0LP+t7jjbGyttPOiQuV49CSgC5eO/bNvq9B/Ftyh5xyRdLoevFwsQlM3dsMWifk SiXICKPvdfeYlvJQI4dY5g/B5wIisTYpAI0HlT/AQmlxF7ZZGC7Uf12Ubaje73C5Ji ei4SNG/0gwRcifVNky8w4j1CmKe0z54l+xZnH1FQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 058EDF80637; Tue, 22 Oct 2019 13:47:17 +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 219FBF8063E; Tue, 22 Oct 2019 13:47:15 +0200 (CEST) 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-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) (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 53F75F80637 for ; Tue, 22 Oct 2019 13:47:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 53F75F80637 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="I0acZyZn" Received: by mail-pl1-x64a.google.com with SMTP id 70so10323935ple.1 for ; Tue, 22 Oct 2019 04:47:11 -0700 (PDT) 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=s0s8xkCRDoETkGIRm0ElT2FwVj33VJZ3cTstMqIB3IM=; b=I0acZyZn7Xa5n4obt1qg6joAIwyf9eiBWk/mW3Nlwg9fcmVvcxkuhvFIyFjP6M92dr QdJzMn7/AX2f9zcQntoB5Zkse6Pu+SHBIjb00x3UrLLdWyJg6s2YtB6Fu8qunSioqb/2 Gycr9cOufMmEc1mn0DSCnsqeWMDvVDc+hZAs/QE9Hp5twycxtJjudehRrb6hEYsFYlXK b6yZtGFAEbG3wzWfdNZ4BbfoJEL6PWqgncjY6r2NSDEh+PAPI6wEZdcKJV8BsAcfVWWV Bup7DNuh9H23t+2obXziuAUtbntup0JtzB239+cUjg0vNJvV5MsMM7DfaO8j6ficqge6 lF7A== 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=s0s8xkCRDoETkGIRm0ElT2FwVj33VJZ3cTstMqIB3IM=; b=DGQIcMLgmp2d9U034GZBBD8/ak+dMcmdi1M6W066JlcryZTGSAg5wNlQKZhQdSdT/f jejgADFpZbkJTNYrWWmwG5cJ3grHRB87VMExfFCjoqle+SVA1xVFKOdL/C0D0VQNZ/yg sRqvifApl2lfY8VT9FkYcWxn3QqlMBGNtICUB2qY3IgZ06avnBD9YX9FE2QIKSr4jKwz p+iQT+553JFUjXa057o32NniTZHS/FW7Y+HFwskK65thvAPwuTOqJpu52OGtJuoVZ9o9 +BVrBn9mnFTWLOZNpxYo5XZJKm/Ey+GRKCnVkxbuG8R/ppDI0TlaL9zFMMzRcN7k3vPA H0GA== X-Gm-Message-State: APjAAAXeNsrdhyFnBwOKrqSVxiENPwsyyqrUgTQdDBgb1zV40DgZ4eFX zOlumOhQTmbCwYa9rn9qCgjUQOtgxfkj X-Google-Smtp-Source: APXvYqy9VizXIvEY2o6/3SHowrevaAyupW9XltTdBSGcXmWEmoUxzrtIaUakSyVtkK+jhJd4Wuu1Vf6Qx09o X-Received: by 2002:a63:8f41:: with SMTP id r1mr3124518pgn.83.1571744829991; Tue, 22 Oct 2019 04:47:09 -0700 (PDT) Date: Tue, 22 Oct 2019 19:45:04 +0800 In-Reply-To: <20191022114505.196852-1-tzungbi@google.com> Message-Id: <20191022193301.5.I8247fd099947a7a67ac86479b9972ea98272f547@changeid> Mime-Version: 1.0 References: <20191022114505.196852-1-tzungbi@google.com> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog From: Tzung-Bi Shih To: broonie@kernel.org, robh+dt@kernel.org, narmstrong@baylibre.com Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, cychiang@google.com, jonas@kwiboo.se, allen.chen@ite.com.tw, jernej.skrabec@siol.net, dri-devel@lists.freedesktop.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, tzungbi@google.com, dgreid@google.com Subject: [alsa-devel] [PATCH 5/6] drm: bridge: it6505: report connector status 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" When a connector connected or disconnected, report the jack status. Signed-off-by: Tzung-Bi Shih --- drivers/gpu/drm/bridge/ite-it6505.c | 39 +++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c index 1d19184d2056..645d7947acc2 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -180,6 +180,10 @@ struct it6505 { bool powered; /* it6505 driver hold option */ unsigned int drv_hold; + + hdmi_codec_plugged_cb plugged_cb; + struct device *codec_dev; + enum drm_connector_status last_connector_status; }; static const struct regmap_range it6505_bridge_volatile_ranges[] = { @@ -882,15 +886,31 @@ static const struct drm_connector_helper_funcs it6505_connector_helper_funcs = { .get_modes = it6505_get_modes, }; +static void it6505_update_plugged_status(struct it6505 *it6505, + enum drm_connector_status status) +{ + if (it6505->plugged_cb && it6505->codec_dev) + it6505->plugged_cb(it6505->codec_dev, + status == connector_status_connected); +} + static enum drm_connector_status it6505_detect(struct drm_connector *connector, bool force) { struct it6505 *it6505 = connector_to_it6505(connector); + enum drm_connector_status status; if (gpiod_get_value(it6505->pdata.gpiod_hpd)) - return connector_status_disconnected; + status = connector_status_disconnected; + else + status = connector_status_connected; + + if (status != it6505->last_connector_status) { + it6505->last_connector_status = status; + it6505_update_plugged_status(it6505, status); + } - return connector_status_connected; + return status; } static const struct drm_connector_funcs it6505_connector_funcs = { @@ -1341,10 +1361,23 @@ static void it6505_audio_shutdown(struct device *dev, void *data) it6505->en_audio = 0; } +static int it6505_audio_hook_plugged_cb(struct device *dev, void *data, + hdmi_codec_plugged_cb fn, + struct device *codec_dev) +{ + struct it6505 *it6505 = data; + + it6505->plugged_cb = fn; + it6505->codec_dev = codec_dev; + it6505_update_plugged_status(it6505, it6505->last_connector_status); + return 0; +} + static const struct hdmi_codec_ops it6505_audio_codec_ops = { .hw_params = it6505_audio_hw_params, .trigger = it6505_audio_trigger, .audio_shutdown = it6505_audio_shutdown, + .hook_plugged_cb = it6505_audio_hook_plugged_cb, }; static int it6505_register_audio_driver(struct device *dev) @@ -1354,6 +1387,7 @@ static int it6505_register_audio_driver(struct device *dev) .ops = &it6505_audio_codec_ops, .max_i2s_channels = 8, .i2s = 1, + .data = it6505, }; struct platform_device *pdev; @@ -1364,6 +1398,7 @@ static int it6505_register_audio_driver(struct device *dev) return PTR_ERR(pdev); INIT_DELAYED_WORK(&it6505->delayed_audio, it6505_delayed_audio); + it6505->last_connector_status = connector_status_disconnected; DRM_DEV_DEBUG_DRIVER(dev, "bound to %s", HDMI_CODEC_DRV_NAME); return 0; From patchwork Tue Oct 22 11:45:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11204335 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 BB98214ED for ; Tue, 22 Oct 2019 11:52:06 +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 4E28C21872 for ; Tue, 22 Oct 2019 11:52:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="fGcGpkEb"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="DIDqCZeA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E28C21872 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 9B1C61681; Tue, 22 Oct 2019 13:51:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9B1C61681 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1571745124; bh=msQutKE0gaRKz5XyWtPqV0LkfAk0knzx1DPpoyZfNAc=; h=Date:In-Reply-To:References:From:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=fGcGpkEbv0UPRIO358Y8JskW2B4C+QIdVl2NqJ14LGE8y2RNex7r66o45AMjyyFIL q8ZQ4hG6eP3A6fbrGSXxU3KLfKF3vdzetckZDoN33s0hmcXEbGV6l0816GT/LR/e3d AoN/DxrDb7mI7gEb7HKJVGLUM6GQiLF85izeKu4U= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F230CF8064C; Tue, 22 Oct 2019 13:47:21 +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 69509F8065A; Tue, 22 Oct 2019 13:47:20 +0200 (CEST) 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 D768BF8064C for ; Tue, 22 Oct 2019 13:47:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D768BF8064C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="DIDqCZeA" Received: by mail-qt1-x84a.google.com with SMTP id u23so13725918qtb.22 for ; Tue, 22 Oct 2019 04:47:17 -0700 (PDT) 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=T48tWlGrH2z44TnaLtsbXFIJ8HnlGaqO67n3JM09Qog=; b=DIDqCZeA05PLNKgdNR65FcBeK7ZuNM7RI1WYpop1VdWJpSktWHN7BLQmxoJ95oSoOj ocZM3wTXiXYuUAVS3FEX93PO9ufyw6CP5i+YYDPIty/fxPlMSKCcXkNPvmNBh84O7ji3 RblCbKUAZNaBzTtr/pR/axxmyCdv692dB/bTcDeCPKl3MVNMNqRZbJ6Z/adaA3BTYQrS w5zSQ7dCbF1AqeSzyQTOSzMWPMjCvxo9vc1bzvGXkIvJQhoNDrBnxJUZLg5JCENpRl9s Zpbj++fZL3ZTMl0SHwrvyNXSlunWa1bW5Nlgh/uS0SUoUVN8gBsUbUseQXGQ57MR3Sxq 8QlA== 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=T48tWlGrH2z44TnaLtsbXFIJ8HnlGaqO67n3JM09Qog=; b=mKETzZXy7HDpZ9YCQtf0kWdS5FDRpcDJyY89m5WdX/hfvMCDoGsh2W1Kj5mdpvwMh/ vYWe/C2EEMv/q2plYCMA/wfaxJCa1quzrTmgdwgLG1bKrbbvmHEcZNe5v9zcbrz3IWx9 b1l/CnyIJKrjxmUd5grALtg/mr9VzItxzgjTjP05rS5+JXSlYRy8cdhK8w7/jizqhw3J 87dZNpxK7a8P0fWeaPksckX4NoYj62zLQMJiMxCAfP7ZFOtzyQq7Vd4PZVXGvHTVNIfN 3JQ9PZSfaKzCOloJCCf2+yzADdvbQt9t5i0NR9N21bq6bZeYpFE5uS6d1V6ztD8ffMXA wHBw== X-Gm-Message-State: APjAAAU1W0G+Oup0Zx+jnafuZZlBUQwYin87+Qz0EHuA6/1ZP86IxNPx zKYUvWcavPNYfai2EgcCB8xmc1QacaqS X-Google-Smtp-Source: APXvYqzLdQNX1Nkvs2wlFXNLo0RhFNgzd7th7BWIbuHvGPweK4oFS5GnrmsAHjH7EiF1oJZrrO6Xb3PQN00l X-Received: by 2002:a0c:b59b:: with SMTP id g27mr2657124qve.184.1571744835079; Tue, 22 Oct 2019 04:47:15 -0700 (PDT) Date: Tue, 22 Oct 2019 19:45:05 +0800 In-Reply-To: <20191022114505.196852-1-tzungbi@google.com> Message-Id: <20191022193301.6.I2e59e084bcd3aa34a651a7279bc63400e818cf0f@changeid> Mime-Version: 1.0 References: <20191022114505.196852-1-tzungbi@google.com> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog From: Tzung-Bi Shih To: broonie@kernel.org, robh+dt@kernel.org, narmstrong@baylibre.com Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, cychiang@google.com, jonas@kwiboo.se, allen.chen@ite.com.tw, jernej.skrabec@siol.net, dri-devel@lists.freedesktop.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, tzungbi@google.com, dgreid@google.com Subject: [alsa-devel] [PATCH 6/6] ASoC: mediatek: mt8183: 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" Support HDMI jack reporting. Signed-off-by: Tzung-Bi Shih --- sound/soc/mediatek/Kconfig | 3 ++- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 20 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig index 8b29f3979899..0d8d75c5f984 100644 --- a/sound/soc/mediatek/Kconfig +++ b/sound/soc/mediatek/Kconfig @@ -126,9 +126,10 @@ config SND_SOC_MT8183_MT6358_TS3A227E_MAX98357A select SND_SOC_BT_SCO select SND_SOC_TS3A227E select SND_SOC_CROS_EC_CODEC + select SND_SOC_HDMI_CODEC help This adds ASoC driver for Mediatek MT8183 boards - with the MT6358 TS3A227E MAX98357A audio codec. + with the MT6358 TS3A227E MAX98357A audio codec and HDMI codec. Select Y if you have such device. If unsure select "N". diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c index 258f1416fae1..23305dd2f958 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "mt8183-afe-common.h" #include "../../codecs/ts3a227e.h" @@ -30,7 +31,7 @@ static const char * const mt8183_pin_str[PIN_STATE_MAX] = { struct mt8183_mt6358_ts3a227_max98357_priv { struct pinctrl *pinctrl; struct pinctrl_state *pin_states[PIN_STATE_MAX]; - struct snd_soc_jack headset_jack; + struct snd_soc_jack headset_jack, hdmi_jack; }; static int mt8183_mt6358_i2s_hw_params(struct snd_pcm_substream *substream, @@ -270,6 +271,22 @@ static const struct snd_soc_ops mt8183_mt6358_ts3a227_max98357_wov_ops = { .shutdown = mt8183_mt6358_ts3a227_max98357_wov_shutdown, }; +static int +mt8183_mt6358_ts3a227_max98357_hdmi_init(struct snd_soc_pcm_runtime *rtd) +{ + struct mt8183_mt6358_ts3a227_max98357_priv *priv = + snd_soc_card_get_drvdata(rtd->card); + int ret; + + ret = snd_soc_card_jack_new(rtd->card, "HDMI Jack", SND_JACK_LINEOUT, + &priv->hdmi_jack, NULL, 0); + if (ret) + return ret; + + return hdmi_codec_set_jack_detect(rtd->codec_dai->component, + &priv->hdmi_jack); +} + static struct snd_soc_dai_link mt8183_mt6358_ts3a227_max98357_dai_links[] = { /* FE */ @@ -436,6 +453,7 @@ mt8183_mt6358_ts3a227_max98357_dai_links[] = { .ignore_suspend = 1, .be_hw_params_fixup = mt8183_i2s_hw_params_fixup, .ops = &mt8183_mt6358_tdm_ops, + .init = mt8183_mt6358_ts3a227_max98357_hdmi_init, SND_SOC_DAILINK_REG(tdm), }, };