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: 11205905 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 D4C48112B for ; Wed, 23 Oct 2019 08:11:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 BC1182173B for ; Wed, 23 Oct 2019 08:11:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC1182173B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7969A6E9B8; Wed, 23 Oct 2019 08:11:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vk1-xa4a.google.com (mail-vk1-xa4a.google.com [IPv6:2607:f8b0:4864:20::a4a]) by gabe.freedesktop.org (Postfix) with ESMTPS id F2F596E5F0 for ; Tue, 22 Oct 2019 11:46:50 +0000 (UTC) Received: by mail-vk1-xa4a.google.com with SMTP id a7so7489332vkg.2 for ; Tue, 22 Oct 2019 04:46:50 -0700 (PDT) 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=B6pHRixskO/t/2Mt2ftsMSCIV1Zz1yNMEmnK7aKwETwCKddQP9M0OVA5fq/PqCEfxo RiTf6BWf8c6ytxcQNsphO2lQ+BflH/BfA/pMvne5nq4F00jMh7oDV2LYdEXATfR4q/Yn Sse0zwIXGIbjCrpJMHQETo838euqYuRF/EEq100fTzCvO8VYuUiIOC5Akh+L5wRyPDa0 KYch2qbsEoLsijU+/sr2DLOWYUqcfnY3DWTTcYJ2buyyyxZorDyMIH39Nzub0u9eVeC1 8veg0w9YdG7XT7Y6HKAIq+1JM3c0RICb610LzaYlvZKJT2htJgzcGI+vsETtMOKX78fr WlzA== X-Gm-Message-State: APjAAAUFkWJjg40KNF58b0eTKhOtHjgG5HEVBhRHt4qKAOi5s43G9LsY IlVl+oRZCy/VJcb67THNM/3rkGxsuSnU 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 Subject: [PATCH 1/6] ASoC: hdmi-codec: add PCM trigger operator From: Tzung-Bi Shih To: broonie@kernel.org, robh+dt@kernel.org, narmstrong@baylibre.com X-Mailman-Approved-At: Wed, 23 Oct 2019 08:09:38 +0000 X-Mailman-Original-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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, Laurent.pinchart@ideasonboard.com, tzungbi@google.com, dgreid@google.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-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: 11205899 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 1DCEC112C for ; Wed, 23 Oct 2019 08:11:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 060842173B for ; Wed, 23 Oct 2019 08:11:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 060842173B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 779666E9AD; Wed, 23 Oct 2019 08:11:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vk1-xa4a.google.com (mail-vk1-xa4a.google.com [IPv6:2607:f8b0:4864:20::a4a]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC1C789260 for ; Tue, 22 Oct 2019 11:46:55 +0000 (UTC) Received: by mail-vk1-xa4a.google.com with SMTP id o66so7472009vka.19 for ; Tue, 22 Oct 2019 04:46:55 -0700 (PDT) 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=OShTUsCiPtBFeuG5aqdlnyoFzVIbzGqa/inucGaKuG06BpjrXHcEFlKyUy06pw4XCj Z0GpzmHO2yKrbsuFvkkm+0GEJDFn0Zu5us6y6BNX483pbq23h4HccVa1Mnl4Z7IXfzUO K72f/sGfxxMNnWaUTggPRJ18/fSSLoorJiij+kYlS4Y+G9EkpdLil/wW5gIn2cftMwxZ YeCZ4oSBDi4D2NkOO7SmZJz0CZ23hCClnVlgelgODSrSiFGT64FMtzvKtwubSU2cx7WD kNxfkBoQeZb9+NoT9FfhO9tTDg6D8q7jxhTamhg9fD2nCNjx7iFmKsAZe8gHpubYK2Q/ hBsg== X-Gm-Message-State: APjAAAUObgwT8EYMWWNiN16QoAAyrfNqNq0Qt3FZGCPidKiLNQBqRsA/ J1FrFDiKSGSmJosYyMU8POr1ok/Ja/YD 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 Subject: [PATCH 2/6] drm: bridge: it6505: bridge to hdmi-codec From: Tzung-Bi Shih To: broonie@kernel.org, robh+dt@kernel.org, narmstrong@baylibre.com X-Mailman-Approved-At: Wed, 23 Oct 2019 08:09:38 +0000 X-Mailman-Original-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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, Laurent.pinchart@ideasonboard.com, tzungbi@google.com, dgreid@google.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-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: 11205863 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 93108112C for ; Wed, 23 Oct 2019 08:09:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 7B9D221906 for ; Wed, 23 Oct 2019 08:09:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B9D221906 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F3046E991; Wed, 23 Oct 2019 08:09:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D54C6E5EF for ; Tue, 22 Oct 2019 11:47:01 +0000 (UTC) Received: by mail-qk1-x749.google.com with SMTP id w67so8570710qkb.4 for ; Tue, 22 Oct 2019 04:47:01 -0700 (PDT) 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=ihxDgUlTg9pWSchU2Ihh91vjK+QcaVybFeDQCB69/VuRf1j8j6IsBFkGDYNy/qdeuS F5F/n2DsVMKuHn/9mALo+k9d/Lr9nwYWyJj0UQMmsQjU4k/DRXrnLg7WfehEHMZ8hxfk 4wMyFPEzvQ3ra0KL5VoZ+BN5WJhi3qysH4k2T+cuLVoicaRufXdxdfmRzkx7DWBOdevm vGIUjZmiv6+ySPeS6tQ1PArE07iExMPtCApopPo07Za6QwFAgy426Bj/CqH2xB1973/d OlNKr8ZMAAwQqQ/DpgqJmvgDMrSrJXY9oJAUS14Bdvq5kX+u0lbhwk9Ye2f8VekWs5Kl n3eA== X-Gm-Message-State: APjAAAXie7ZlQsiLqMMthF3Epk/5GIVurau2nUYdDFwM9Kl3/xhkhwvf zsG4OqY2zBXxQmiOIutzqyIp6kcewNTN 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 Subject: [PATCH 3/6] ASoC: dt-bindings: mt8183: add a property "mediatek, hdmi-codec" From: Tzung-Bi Shih To: broonie@kernel.org, robh+dt@kernel.org, narmstrong@baylibre.com X-Mailman-Approved-At: Wed, 23 Oct 2019 08:09:38 +0000 X-Mailman-Original-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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, Laurent.pinchart@ideasonboard.com, tzungbi@google.com, dgreid@google.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-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: 11205891 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 8802A112C for ; Wed, 23 Oct 2019 08:10:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 7079221906 for ; Wed, 23 Oct 2019 08:10:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7079221906 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B06436E9A3; Wed, 23 Oct 2019 08:10:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by gabe.freedesktop.org (Postfix) with ESMTPS id B54EC6E5F0 for ; Tue, 22 Oct 2019 11:47:05 +0000 (UTC) Received: by mail-pl1-x64a.google.com with SMTP id r13so2011987pls.4 for ; Tue, 22 Oct 2019 04:47:05 -0700 (PDT) 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=tWXrNucZ78UOeJ/6rT4+Vm/EIQUS8cWTbFEoFHR5l7CwE8hNCx1G8yeje4Rjrr4/JK QHJKtcn0H6kGOJxBKNTT6B3z1iTqoE9OpqXpBjnsswIfQEG+3noNupwj59ec282Q8qqF 9jV4v0msrEZpMrVBpjR1oV3XJPwPbn3n+LN87gSU+CgiHE9jP6DGNLLliADJF+DvX1ap Zu6rvJR+OVkXDAdqY1o7JZQHo0MiaWuhMIcgi2SuMGFnYf2h+yoeB84ikK4f/zPVI/LN BN+a89wVl7+2Gk+KYR/iGK9xILJCeKXHNt6ZxbisI7IE/hFNnyliiIoXAIZVq83UgZQI dqtg== X-Gm-Message-State: APjAAAUPOGB28h3Aa7VxptD4Z5Syf5W/MbvxzEKRx3mZIZw8qdkvmIgN 9LCWKzWCiRs7fDyDTvi2dYMLKMSMR5Ae 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 Subject: [PATCH 4/6] ASoC: mediatek: mt8183: use hdmi-codec From: Tzung-Bi Shih To: broonie@kernel.org, robh+dt@kernel.org, narmstrong@baylibre.com X-Mailman-Approved-At: Wed, 23 Oct 2019 08:09:38 +0000 X-Mailman-Original-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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, Laurent.pinchart@ideasonboard.com, tzungbi@google.com, dgreid@google.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-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: 11205867 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 50ED6112C for ; Wed, 23 Oct 2019 08:09:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 3975821906 for ; Wed, 23 Oct 2019 08:09:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3975821906 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D434D6E993; Wed, 23 Oct 2019 08:09:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by gabe.freedesktop.org (Postfix) with ESMTPS id AB5156E5EF for ; Tue, 22 Oct 2019 11:47:10 +0000 (UTC) Received: by mail-pf1-x44a.google.com with SMTP id s137so13149109pfs.18 for ; Tue, 22 Oct 2019 04:47:10 -0700 (PDT) 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=PctaBWaKknA+KETFy66WHEyi89kwSrN5M2hnsldAFC62+H19wMHBFzyR+8ppwaH7RL L+ljySJZq77V3pQl3EiPHRgP25Ct4pGLlTGUNkDC5yF8YD1zH4R54+SElFhg2BG7hzsG JsdYxEZDQ6IPPKtCf5jO2TnxS1oYFtb9HrChO6qOUn4HlTOUfxaOlAvaiottI+LrUXCv lltGcsBJyGEmTGW5IA5znCSA8ps75nmzgZDQVuxkNEOcGpLzVEMgfqO+AjDGYLUkp+2D QJLhZWP4T2zmau6Qo8z2fhcvK6XKDbOEyfBqQ5ENqilU4pzttKK31DRJw+JugvU3cDtX u8rw== X-Gm-Message-State: APjAAAXEZWqs2zv5Xr9HlmytQvrJoFHKxgzTAogrU232loRUQnYyBCBw niLMVKVOIcXHnv+yQtVaQFklAZcug4Zk 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 Subject: [PATCH 5/6] drm: bridge: it6505: report connector status From: Tzung-Bi Shih To: broonie@kernel.org, robh+dt@kernel.org, narmstrong@baylibre.com X-Mailman-Approved-At: Wed, 23 Oct 2019 08:09:38 +0000 X-Mailman-Original-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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, Laurent.pinchart@ideasonboard.com, tzungbi@google.com, dgreid@google.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-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: 11205903 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 4B441112C for ; Wed, 23 Oct 2019 08:11:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 32C4C21872 for ; Wed, 23 Oct 2019 08:11:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32C4C21872 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4521A6E9B6; Wed, 23 Oct 2019 08:11:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3368A6E5F2 for ; Tue, 22 Oct 2019 11:47:16 +0000 (UTC) Received: by mail-qk1-x749.google.com with SMTP id j10so8590812qka.10 for ; Tue, 22 Oct 2019 04:47:16 -0700 (PDT) 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=I9FHC9PcC2yMf5uzMEQainSX/CRFoKr3NydyKl4ZcFL1dlzWJAa5OOt/z/oBccwX7v +n2B0hJzY9dzi00kEYHmQYlJfsCANQf5fuoE4qUQr41l7JPt6fjgCWaAsFs2CFN7I26c osntcPJ11xo/Y6ropP6FBSLM1lp6WDgSQR1kuJRPzfMV8Q4OCTdLxeeJqFu/u547zlgU OE1PGlNnPcnUkD1AA0p1O/DsFUbpjnn8LwPMYCq3TokW9rjYfHMXm6gH5cUN5bL78yl7 F6VM0io2VuzjXHunuATcWuSS+LE5iQkNlKR41pTrcf0Qd7OLSA/KLBtcCL63k8kRUzVg n7Lw== X-Gm-Message-State: APjAAAXD+yybfrZlYh3GrEElm3i7OXDOuY3TJUehffxWIfeDVTf1+cmF A4HCTDtwy+gdBdjg2PF7qulwZjO0lKtv 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 Subject: [PATCH 6/6] ASoC: mediatek: mt8183: support HDMI jack reporting From: Tzung-Bi Shih To: broonie@kernel.org, robh+dt@kernel.org, narmstrong@baylibre.com X-Mailman-Approved-At: Wed, 23 Oct 2019 08:09:38 +0000 X-Mailman-Original-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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, Laurent.pinchart@ideasonboard.com, tzungbi@google.com, dgreid@google.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-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), }, };