From patchwork Sun Dec 6 13:33:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Jonker X-Patchwork-Id: 11954121 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99028C433FE for ; Sun, 6 Dec 2020 13:36:14 +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 4A67D23121 for ; Sun, 6 Dec 2020 13:36:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A67D23121 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 98DF01789; Sun, 6 Dec 2020 14:35:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 98DF01789 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1607261771; bh=K30UlZzgxGw8jvfkQIxdM5HKtJCDAANhehaB3fKBWMc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SXxvB3n1yRtlX7rpwu++nt+H5BuZRzWqIY1wSD7CkNcQsJNylfLK24/ac1CGCv8xc 2RPEzLIP3LFgYX7NSnwmY1TCdUx38pbo7im34mDuxCh6CYZAwZRnQFueEHby4jb7cC DuzlxqGGvPtFLSdDCFnounvo80pW/jZ4+6YFWxYQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6EE07F804CB; Sun, 6 Dec 2020 14:34:21 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AEF9EF80264; Sun, 6 Dec 2020 14:34:18 +0100 (CET) Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) (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 F1782F800E1 for ; Sun, 6 Dec 2020 14:34:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F1782F800E1 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rTYlIsnB" Received: by mail-ed1-x543.google.com with SMTP id d18so10792924edt.7 for ; Sun, 06 Dec 2020 05:34:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cfXI1Q85bb28+McjuHeu3xbkODr0lp86DQ42QSmzooY=; b=rTYlIsnBZhZ1gkeFipGqwBYR2ZwA9h+V8hdArOoD/aqyF5pkPdp8UG2LN6I69z6Z8o v/qbG4Tg4fZZwxqHLkJYXWphkFevKqRhcDiftdm7cW4FMW5B019iie6IKUAuqmmYoUAC 0iceP/n6IV1kELlWzcM85oQXUlG0r5De0IpNKYpyCZHCEDp/DLhjlp1GZVhocDQQDnMl u2Oz4gy+73Xl0m0TmM47nRaMMFdcR46by+7wcEOQ/GWQwlNrIEZiODOYsEyHFCbh4lB6 5SQr9x1xqbwElGItP8zmvF7oCyhW0zak8lRn7Iwsp+b+GoTEOWX/A2ymxinWVs5hZywF rk0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cfXI1Q85bb28+McjuHeu3xbkODr0lp86DQ42QSmzooY=; b=S9t+TScMVbtl8C/sMy/bftrf2WEp10/vxDhd3qXZYDG/chdg/7oLHX8ZN1zV1NEXtQ DxPUCyyu3qGBsssmbPmyfM1GttPEGyHEdHLkkvhWnMtONxBNl8kHZpNPfAjCULkcTOJH LKSfZckRNahF0EEzBjjTrAU/H+kQmSzrmDmmSVlab3WueBQ7hzoJfNUagG/rYN/PpnMD RPxTymKhGbpWKEs563mli0UJTCWdrJeTgOb/qDZeexCfr4d3lfDXu9Xnrx7+fhE+AHKb Cqi4MuN8oJX6UaeoNAGLjGqcZP65L2Mynq2+RlOtcEPdtNqtoteVSW+nM23wi9yO0hBv 8GUA== X-Gm-Message-State: AOAM531JGUBLbQzcH0F/UyujY2nBUb5JeytAEkQ6Hi2MXhMgmZahwL2p 0hywHMNfpmcGGuTlG+tgxqs= X-Google-Smtp-Source: ABdhPJz+2tgBllNF3mr0DriE1oUWiJyqUX1uRzwk3HN0LdYKtYRiu18qL/KrCGFwmIWGbACXPv7meQ== X-Received: by 2002:aa7:d99a:: with SMTP id u26mr16355837eds.32.1607261646808; Sun, 06 Dec 2020 05:34:06 -0800 (PST) Received: from debian.home (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id qh23sm7770129ejb.71.2020.12.06.05.34.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Dec 2020 05:34:06 -0800 (PST) From: Johan Jonker To: heiko@sntech.de Subject: [PATCH v6 1/5] dt-bindings: display: add #sound-dai-cells property to rockchip rk3066 hdmi Date: Sun, 6 Dec 2020 14:33:51 +0100 Message-Id: <20201206133355.16007-2-jbx6244@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20201206133355.16007-1-jbx6244@gmail.com> References: <20201206133355.16007-1-jbx6244@gmail.com> Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, airlied@linux.ie, linux-kernel@vger.kernel.org, broonie@kernel.org, hjc@rock-chips.com, dri-devel@lists.freedesktop.org, lgirdwood@gmail.com, linux-rockchip@lists.infradead.org, robh+dt@kernel.org, daniel@ffwll.ch, linux-arm-kernel@lists.infradead.org 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" '#sound-dai-cells' is required to properly interpret the list of DAI specified in the 'sound-dai' property. Add it to rockchip,rk3066-hdmi.yaml to document that the rk3066 HDMI TX also can be used to transmit some audio. Signed-off-by: Johan Jonker Reviewed-by: Rob Herring --- .../devicetree/bindings/display/rockchip/rockchip,rk3066-hdmi.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip,rk3066-hdmi.yaml b/Documentation/devicetree/bindings/display/rockchip/rockchip,rk3066-hdmi.yaml index 4110d003c..585a8d3b9 100644 --- a/Documentation/devicetree/bindings/display/rockchip/rockchip,rk3066-hdmi.yaml +++ b/Documentation/devicetree/bindings/display/rockchip/rockchip,rk3066-hdmi.yaml @@ -42,6 +42,9 @@ properties: description: This soc uses GRF regs to switch the HDMI TX input between vop0 and vop1. + "#sound-dai-cells": + const: 0 + ports: type: object @@ -101,6 +104,7 @@ examples: pinctrl-names = "default"; power-domains = <&power RK3066_PD_VIO>; rockchip,grf = <&grf>; + #sound-dai-cells = <0>; ports { #address-cells = <1>; From patchwork Sun Dec 6 13:33:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Jonker X-Patchwork-Id: 11954119 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31A9BC4361B for ; Sun, 6 Dec 2020 13:36:01 +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 97E7C2310E for ; Sun, 6 Dec 2020 13:36:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97E7C2310E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 BA0D71776; Sun, 6 Dec 2020 14:35:08 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BA0D71776 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1607261758; bh=FTzKSzFY3GAw+qjrzuzaomI+pK3OK2i6SSNpUAdY1mI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=TmoO82Wi7W1Lnn+GcUFBPwWA733UHWa1fhW00u7WR2IHICZ1oZxWuUugW7CIS9Y1e 86Dnab95LttV2uzQlp+F72Ge9hAW6jTxtdQcV57S2uOeD0Gdv2n7rXzj5bdNY/fYy3 rjUC/jVJDktkpWhc6lrngMPmJFo1fQB1yncwM4tA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1E3E6F8025A; Sun, 6 Dec 2020 14:34:19 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 217F0F800B4; Sun, 6 Dec 2020 14:34:16 +0100 (CET) Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) (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 DB324F800B4 for ; Sun, 6 Dec 2020 14:34:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DB324F800B4 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="s+jTPgBD" Received: by mail-ej1-x642.google.com with SMTP id bo9so15508948ejb.13 for ; Sun, 06 Dec 2020 05:34:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gJsomlA81T7ZIxyQtsi8fKmmVs9O51cgmIpZkpUdTZI=; b=s+jTPgBDXlMkW6wg6WBNC4whpxsc9Jp7CyZ5/58m6bsldJ2HOPrBnJN1ohLStjfuKL 4GqX7vhCXB8BzTyNity2auUlgwEtB/rHvubh35H+2NslUi+asmO7LV0Wb9FhDZm3lTFH MpEek4nOSjg/Je+IiZc/kKs+EUjIR/c3vTRbRPhC09/cwORcYY9ySRUjvx98zEZ5yEGs mdosuJcVOL+tqGcA1+NYLRwbmFBX0Az0/gYsAkiEDTJIVdD7Ils/rZQUIU/bgXgK7o4k mfgfvAHcZyXQ6kkQVdlVqKh5abMb1JDU5K/Rol9uhEMRomEToPB+1p/Lr+QlRV88vdiG 7Vhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gJsomlA81T7ZIxyQtsi8fKmmVs9O51cgmIpZkpUdTZI=; b=gxQaOgup8ybLfwReRrniv84Te5YOR3NnrWsEhwGlQWtrpM5C6iF1lX3m0QN1YCdhHh Ow2ojzhO2Owuss5D0TsaARQyj1maSVFf88K5C5HXpnAef8FzIIqszIe9n7IgjqYc8xkk 4BGWJ1yP79so/YZ9MyM33yEqYL/wXhZgh/4JhDBYWjy9mcqtM58pH+y2AXSSxsvlqKnR wBuKWJLLx3luNztHxsYlVaO/J0ti5eduBh58j/5NcT4lb343iM6TaNS8Q845DNvFTRfw IDkPmprgwgyBKTddFtJStRIUEYiIcm74lc/OGEg4uHJnpfNk8kbrl5jj7Xo7iH7igJJH NGKw== X-Gm-Message-State: AOAM533aG63e/tAkM7NjL6yU921+CcHtD5k591aDsIc9uLyUUrpFaqDn l6z6yk5pzC96x45jlwqwj9A= X-Google-Smtp-Source: ABdhPJy8x7t9eGGwyEcv0v0GfH4CDQbNLqVgeX9A3WQyw83lA+f/1dGSGig9BjwDXi+lrTpQoKohkw== X-Received: by 2002:a17:906:5fc9:: with SMTP id k9mr4913565ejv.70.1607261648090; Sun, 06 Dec 2020 05:34:08 -0800 (PST) Received: from debian.home (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id qh23sm7770129ejb.71.2020.12.06.05.34.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Dec 2020 05:34:07 -0800 (PST) From: Johan Jonker To: heiko@sntech.de Subject: [PATCH v6 2/5] drm: rockchip: add sound support to rk3066 hdmi driver Date: Sun, 6 Dec 2020 14:33:52 +0100 Message-Id: <20201206133355.16007-3-jbx6244@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20201206133355.16007-1-jbx6244@gmail.com> References: <20201206133355.16007-1-jbx6244@gmail.com> Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, airlied@linux.ie, linux-kernel@vger.kernel.org, broonie@kernel.org, hjc@rock-chips.com, dri-devel@lists.freedesktop.org, lgirdwood@gmail.com, linux-rockchip@lists.infradead.org, robh+dt@kernel.org, daniel@ffwll.ch, linux-arm-kernel@lists.infradead.org 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: Zheng Yang Add sound support to the rk3066 HDMI driver. The I2S input of the HDMI TX allows transmission of DVD-Audio and decoded Dolby Digital to A/V Receivers and high-end displays. The interface supports 2 to 8 channels audio up to 192 kHz. The HDMI TX supports variable word length of 16bits to 32bits for I2S audio inputs.(This driver 24bit max) There are three I2S input modes supported.(This driver HDMI_I2S only) On RK3066/PX2 the HDMI TX audio source is connected to I2S_8CH. Signed-off-by: Zheng Yang Signed-off-by: Johan Jonker --- drivers/gpu/drm/rockchip/Kconfig | 2 + drivers/gpu/drm/rockchip/rk3066_hdmi.c | 277 ++++++++++++++++++++++++++++++++- 2 files changed, 278 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig index 310aa1546..4c20445dc 100644 --- a/drivers/gpu/drm/rockchip/Kconfig +++ b/drivers/gpu/drm/rockchip/Kconfig @@ -11,6 +11,8 @@ config DRM_ROCKCHIP select DRM_DW_MIPI_DSI if ROCKCHIP_DW_MIPI_DSI select DRM_RGB if ROCKCHIP_RGB select SND_SOC_HDMI_CODEC if ROCKCHIP_CDN_DP && SND_SOC + select SND_SOC_HDMI_CODEC if ROCKCHIP_RK3066_HDMI && SND_SOC + select SND_SOC_ROCKCHIP_I2S if ROCKCHIP_RK3066_HDMI && SND_SOC help Choose this option if you have a Rockchip soc chipset. This driver provides kernel mode setting and buffer diff --git a/drivers/gpu/drm/rockchip/rk3066_hdmi.c b/drivers/gpu/drm/rockchip/rk3066_hdmi.c index 1c546c3a8..2f8654023 100644 --- a/drivers/gpu/drm/rockchip/rk3066_hdmi.c +++ b/drivers/gpu/drm/rockchip/rk3066_hdmi.c @@ -13,6 +13,8 @@ #include #include +#include + #include "rk3066_hdmi.h" #include "rockchip_drm_drv.h" @@ -20,9 +22,16 @@ #define DEFAULT_PLLA_RATE 30000000 +struct audio_info { + int channels; + int sample_rate; + int sample_width; +}; + struct hdmi_data_info { int vic; /* The CEA Video ID (VIC) of the current drm display mode. */ bool sink_is_hdmi; + bool sink_has_audio; unsigned int enc_out_format; unsigned int colorimetry; }; @@ -54,12 +63,19 @@ struct rk3066_hdmi { unsigned int tmdsclk; + struct platform_device *audio_pdev; + struct audio_info audio; + bool audio_enable; + struct hdmi_data_info hdmi_data; struct drm_display_mode previous_mode; }; #define to_rk3066_hdmi(x) container_of(x, struct rk3066_hdmi, x) +static int +rk3066_hdmi_config_audio(struct rk3066_hdmi *hdmi, struct audio_info *audio); + static inline u8 hdmi_readb(struct rk3066_hdmi *hdmi, u16 offset) { return readl_relaxed(hdmi->regs + offset); @@ -205,6 +221,23 @@ static int rk3066_hdmi_config_avi(struct rk3066_hdmi *hdmi, HDMI_INFOFRAME_AVI, 0, 0, 0); } +static int rk3066_hdmi_config_aai(struct rk3066_hdmi *hdmi, + struct audio_info *audio) +{ + union hdmi_infoframe frame; + int rc; + + rc = hdmi_audio_infoframe_init(&frame.audio); + + frame.audio.coding_type = HDMI_AUDIO_CODING_TYPE_STREAM; + frame.audio.sample_frequency = HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM; + frame.audio.sample_size = HDMI_AUDIO_SAMPLE_SIZE_STREAM; + frame.audio.channels = hdmi->audio.channels; + + return rk3066_hdmi_upload_frame(hdmi, rc, &frame, + HDMI_INFOFRAME_AAI, 0, 0, 0); +} + static int rk3066_hdmi_config_video_timing(struct rk3066_hdmi *hdmi, struct drm_display_mode *mode) { @@ -353,6 +386,7 @@ static int rk3066_hdmi_setup(struct rk3066_hdmi *hdmi, hdmi_modb(hdmi, HDMI_HDCP_CTRL, HDMI_VIDEO_MODE_MASK, HDMI_VIDEO_MODE_HDMI); rk3066_hdmi_config_avi(hdmi, mode); + rk3066_hdmi_config_audio(hdmi, &hdmi->audio); } else { hdmi_modb(hdmi, HDMI_HDCP_CTRL, HDMI_VIDEO_MODE_MASK, 0); } @@ -369,9 +403,20 @@ static int rk3066_hdmi_setup(struct rk3066_hdmi *hdmi, */ rk3066_hdmi_i2c_init(hdmi); - /* Unmute video output. */ + /* Unmute video and audio output. */ hdmi_modb(hdmi, HDMI_VIDEO_CTRL2, HDMI_VIDEO_AUDIO_DISABLE_MASK, HDMI_AUDIO_DISABLE); + if (hdmi->audio_enable) { + hdmi_modb(hdmi, HDMI_VIDEO_CTRL2, HDMI_AUDIO_DISABLE, 0); + /* Reset audio capture logic. */ + hdmi_modb(hdmi, HDMI_VIDEO_CTRL2, + HDMI_AUDIO_CP_LOGIC_RESET_MASK, + HDMI_AUDIO_CP_LOGIC_RESET); + usleep_range(900, 1000); + hdmi_modb(hdmi, HDMI_VIDEO_CTRL2, + HDMI_AUDIO_CP_LOGIC_RESET_MASK, 0); + } + return 0; } @@ -473,9 +518,13 @@ static int rk3066_hdmi_connector_get_modes(struct drm_connector *connector) edid = drm_get_edid(connector, hdmi->ddc); if (edid) { hdmi->hdmi_data.sink_is_hdmi = drm_detect_hdmi_monitor(edid); + hdmi->hdmi_data.sink_has_audio = drm_detect_monitor_audio(edid); drm_connector_update_edid_property(connector, edid); ret = drm_add_edid_modes(connector, edid); kfree(edid); + } else { + hdmi->hdmi_data.sink_is_hdmi = true; + hdmi->hdmi_data.sink_has_audio = true; } return ret; @@ -536,6 +585,228 @@ struct drm_connector_helper_funcs rk3066_hdmi_connector_helper_funcs = { }; static int +rk3066_hdmi_config_audio(struct rk3066_hdmi *hdmi, struct audio_info *audio) +{ + u32 rate, channel, word_length, N, CTS; + u64 tmp; + + if (audio->channels < 3) + channel = HDMI_AUDIO_I2S_CHANNEL_1_2; + else if (audio->channels < 5) + channel = HDMI_AUDIO_I2S_CHANNEL_3_4; + else if (audio->channels < 7) + channel = HDMI_AUDIO_I2S_CHANNEL_5_6; + else + channel = HDMI_AUDIO_I2S_CHANNEL_7_8; + + switch (audio->sample_rate) { + case 32000: + rate = HDMI_AUDIO_SAMPLE_FRE_32000; + N = N_32K; + break; + case 44100: + rate = HDMI_AUDIO_SAMPLE_FRE_44100; + N = N_441K; + break; + case 48000: + rate = HDMI_AUDIO_SAMPLE_FRE_48000; + N = N_48K; + break; + case 88200: + rate = HDMI_AUDIO_SAMPLE_FRE_88200; + N = N_882K; + break; + case 96000: + rate = HDMI_AUDIO_SAMPLE_FRE_96000; + N = N_96K; + break; + case 176400: + rate = HDMI_AUDIO_SAMPLE_FRE_176400; + N = N_1764K; + break; + case 192000: + rate = HDMI_AUDIO_SAMPLE_FRE_192000; + N = N_192K; + break; + default: + DRM_DEV_ERROR(hdmi->dev, "no support for sample rate %d\n", + audio->sample_rate); + return -ENOENT; + } + + switch (audio->sample_width) { + case 16: + word_length = 0x02; + break; + case 20: + word_length = 0x0a; + break; + case 24: + word_length = 0x0b; + break; + default: + DRM_DEV_ERROR(hdmi->dev, "no support for word length %d\n", + audio->sample_width); + return -ENOENT; + } + + tmp = (u64)hdmi->tmdsclk * N; + do_div(tmp, 128 * audio->sample_rate); + CTS = tmp; + + /* Set_audio source I2S. */ + hdmi_writeb(hdmi, HDMI_AUDIO_CTRL1, 0x00); + hdmi_writeb(hdmi, HDMI_AUDIO_CTRL2, 0x40); + hdmi_writeb(hdmi, HDMI_I2S_AUDIO_CTRL, + HDMI_AUDIO_I2S_FORMAT_STANDARD | channel); + hdmi_writeb(hdmi, HDMI_I2S_SWAP, 0x00); + hdmi_modb(hdmi, HDMI_AV_CTRL1, HDMI_AUDIO_SAMPLE_FRE_MASK, rate); + hdmi_writeb(hdmi, HDMI_AUDIO_SRC_NUM_AND_LENGTH, word_length); + + /* Set N value. */ + hdmi_modb(hdmi, HDMI_LR_SWAP_N3, + HDMI_AUDIO_N_19_16_MASK, (N >> 16) & 0x0F); + hdmi_writeb(hdmi, HDMI_N2, (N >> 8) & 0xFF); + hdmi_writeb(hdmi, HDMI_N1, N & 0xFF); + + /* Set CTS value. */ + hdmi_writeb(hdmi, HDMI_CTS_EXT1, CTS & 0xff); + hdmi_writeb(hdmi, HDMI_CTS_EXT2, (CTS >> 8) & 0xff); + hdmi_writeb(hdmi, HDMI_CTS_EXT3, (CTS >> 16) & 0xff); + + if (audio->channels > 2) + hdmi_modb(hdmi, HDMI_LR_SWAP_N3, + HDMI_AUDIO_LR_SWAP_MASK, + HDMI_AUDIO_LR_SWAP_SUBPACKET1); + rate = (~(rate >> 4)) & 0x0f; + hdmi_writeb(hdmi, HDMI_AUDIO_STA_BIT_CTRL1, rate); + hdmi_writeb(hdmi, HDMI_AUDIO_STA_BIT_CTRL2, 0); + + return rk3066_hdmi_config_aai(hdmi, audio); +} + +static int rk3066_hdmi_audio_hw_params(struct device *dev, void *d, + struct hdmi_codec_daifmt *daifmt, + struct hdmi_codec_params *params) +{ + struct rk3066_hdmi *hdmi = dev_get_drvdata(dev); + + if (!hdmi->hdmi_data.sink_has_audio) { + DRM_DEV_ERROR(hdmi->dev, "no audio support\n"); + return -ENODEV; + } + + if (!hdmi->encoder.crtc) + return -ENODEV; + + switch (daifmt->fmt) { + case HDMI_I2S: + break; + default: + DRM_DEV_ERROR(dev, "invalid format %d\n", daifmt->fmt); + return -EINVAL; + } + + hdmi->audio.channels = params->channels; + hdmi->audio.sample_rate = params->sample_rate; + hdmi->audio.sample_width = params->sample_width; + + return rk3066_hdmi_config_audio(hdmi, &hdmi->audio); +} + +static void rk3066_hdmi_audio_shutdown(struct device *dev, void *d) +{ + /* do nothing */ +} + +static int +rk3066_hdmi_audio_mute_stream(struct device *dev, void *d, + bool mute, int direction) +{ + struct rk3066_hdmi *hdmi = dev_get_drvdata(dev); + + if (!hdmi->hdmi_data.sink_has_audio) { + DRM_DEV_ERROR(hdmi->dev, "no audio support\n"); + return -ENODEV; + } + + hdmi->audio_enable = !mute; + + if (mute) + hdmi_modb(hdmi, HDMI_VIDEO_CTRL2, + HDMI_AUDIO_DISABLE, HDMI_AUDIO_DISABLE); + else + hdmi_modb(hdmi, HDMI_VIDEO_CTRL2, HDMI_AUDIO_DISABLE, 0); + + /* + * Under power mode E we need to reset the audio capture logic to + * make the audio setting update. + */ + if (rk3066_hdmi_get_power_mode(hdmi) == HDMI_SYS_POWER_MODE_E) { + hdmi_modb(hdmi, HDMI_VIDEO_CTRL2, + HDMI_AUDIO_CP_LOGIC_RESET_MASK, + HDMI_AUDIO_CP_LOGIC_RESET); + usleep_range(900, 1000); + hdmi_modb(hdmi, HDMI_VIDEO_CTRL2, + HDMI_AUDIO_CP_LOGIC_RESET_MASK, 0); + } + + return 0; +} + +static int rk3066_hdmi_audio_get_eld(struct device *dev, void *d, + u8 *buf, size_t len) +{ + struct rk3066_hdmi *hdmi = dev_get_drvdata(dev); + struct drm_mode_config *config = &hdmi->encoder.dev->mode_config; + struct drm_connector *connector; + int ret = -ENODEV; + + mutex_lock(&config->mutex); + list_for_each_entry(connector, &config->connector_list, head) { + if (&hdmi->encoder == connector->encoder) { + memcpy(buf, connector->eld, + min(sizeof(connector->eld), len)); + ret = 0; + } + } + mutex_unlock(&config->mutex); + + return ret; +} + +static const struct hdmi_codec_ops audio_codec_ops = { + .hw_params = rk3066_hdmi_audio_hw_params, + .audio_shutdown = rk3066_hdmi_audio_shutdown, + .mute_stream = rk3066_hdmi_audio_mute_stream, + .get_eld = rk3066_hdmi_audio_get_eld, + .no_capture_mute = 1, +}; + +static int rk3066_hdmi_audio_codec_init(struct rk3066_hdmi *hdmi, + struct device *dev) +{ + struct hdmi_codec_pdata codec_data = { + .i2s = 1, + .ops = &audio_codec_ops, + .max_i2s_channels = 8, + }; + + hdmi->audio.channels = 2; + hdmi->audio.sample_rate = 48000; + hdmi->audio.sample_width = 16; + hdmi->audio_enable = false; + hdmi->audio_pdev = + platform_device_register_data(dev, + HDMI_CODEC_DRV_NAME, + PLATFORM_DEVID_NONE, + &codec_data, + sizeof(codec_data)); + + return PTR_ERR_OR_ZERO(hdmi->audio_pdev); +} + +static int rk3066_hdmi_register(struct drm_device *drm, struct rk3066_hdmi *hdmi) { struct drm_encoder *encoder = &hdmi->encoder; @@ -567,6 +838,8 @@ rk3066_hdmi_register(struct drm_device *drm, struct rk3066_hdmi *hdmi) drm_connector_attach_encoder(&hdmi->connector, encoder); + rk3066_hdmi_audio_codec_init(hdmi, dev); + return 0; } @@ -815,6 +1088,7 @@ static int rk3066_hdmi_bind(struct device *dev, struct device *master, return 0; err_cleanup_hdmi: + platform_device_unregister(hdmi->audio_pdev); hdmi->connector.funcs->destroy(&hdmi->connector); hdmi->encoder.funcs->destroy(&hdmi->encoder); err_disable_i2c: @@ -830,6 +1104,7 @@ static void rk3066_hdmi_unbind(struct device *dev, struct device *master, { struct rk3066_hdmi *hdmi = dev_get_drvdata(dev); + platform_device_unregister(hdmi->audio_pdev); hdmi->connector.funcs->destroy(&hdmi->connector); hdmi->encoder.funcs->destroy(&hdmi->encoder); From patchwork Sun Dec 6 13:33:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Jonker X-Patchwork-Id: 11954125 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5773BC433FE for ; Sun, 6 Dec 2020 13:36:58 +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 A9AC92312B for ; Sun, 6 Dec 2020 13:36:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9AC92312B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 3737717A8; Sun, 6 Dec 2020 14:36:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3737717A8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1607261816; bh=s8FuYgKJ78wSn3OGugmA8kez5JuseWvs+rnANyhbNJo=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YJny/gbigYrIukp/q90o76/S6EbL/eP3PrvPE9E26PyOwDXi4+sNXKzXLnrhQi8Rh W1xw0KxrAD/5G+NhYO2kLlxOR+bc3NcRYpC9pB3/XnUge1PvNmxEzqwdp1GfUcgrR4 vdla2gEwdn+fb+EXTGXZpQmuaRzVWvAZq9x7cB0A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E192FF804E2; Sun, 6 Dec 2020 14:34:22 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 07C52F804C3; Sun, 6 Dec 2020 14:34:20 +0100 (CET) Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 18A90F80218 for ; Sun, 6 Dec 2020 14:34:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 18A90F80218 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YdnQLiCB" Received: by mail-ed1-x542.google.com with SMTP id cm17so10832603edb.4 for ; Sun, 06 Dec 2020 05:34:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XzfD+8x/gl2vij+zxF0vgPJlMvOnmt8qPR/mutEO1AU=; b=YdnQLiCBK/wBANdCyVFkDIuYa/Owf4imk6/kuZS+qLWOfNAnswRN6psvtJ+xR0sEmt ATVRfxNf+UUyiETI3QWMjzXJpGSoB5x0PF4tOzzbpLjuBtI3pBsExo8hF/wendpfC1Ls G50g+Gh6D1SAaAgkjYElwb5rF7b5wvXUkO9vFy/fzd/XkZgd+Zc/HqnAoH6PVb8m6saR QbtwHR4HI471Ws4jqKUEBawrQDuKmQrjASR3CWaScxinx7qj7hwrObD//yqNrmxiawgC rPBMHlrH8dTfgBoq1q84zAdYk8H9J0yq8MjmlJaPa/TvqPsIoqgkycNFhCNKwFNL/oGN 4PxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XzfD+8x/gl2vij+zxF0vgPJlMvOnmt8qPR/mutEO1AU=; b=hOrc526Vuri5zex24KChi32QHjhoRRklhsHEAuSJmTR785Txf2xglEsBZ3pl2CigIh QSDsVL4qiHBo1gsDHxSzgh5nCvgUiqztIcjRyW0J0wPRckyQmtawaXHm71xRYhcLMKjy 7+eGa/Ov2dC4bGJPdrGTF+4IYfw8MZheydCTyFO16xNnLIimiHlSn5jSGRBfbVzmeuQ2 z6iat4oRbd40NuyV+NAfyxJ9HwK1+67gEgjbjznvCSnrUBzQ/sa2PdBZCY9ZF0JOUrEu PwnkMjl8rmOOYsPr+IdqDT89qFfSwbJUjcGzosmwIB/wUnIJAOKzXS00S2vqW9skfCwt l7Lw== X-Gm-Message-State: AOAM532LUo8890PSi+W8TmMR24I8zmqN/EdyB/uQF5IPgROltFnFiibh TbsBYtZVQn5Y9JERDzQlxK8= X-Google-Smtp-Source: ABdhPJyTcga5ryTaOcjxeErZN0uSNiSlX+EAdf/VgZlWQgBUllwgGITJy/IVUbE7EtRHuBbkau4EpQ== X-Received: by 2002:aa7:d784:: with SMTP id s4mr15760934edq.215.1607261649141; Sun, 06 Dec 2020 05:34:09 -0800 (PST) Received: from debian.home (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id qh23sm7770129ejb.71.2020.12.06.05.34.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Dec 2020 05:34:08 -0800 (PST) From: Johan Jonker To: heiko@sntech.de Subject: [PATCH v6 3/5] ARM: dts: rockchip: rk3066a: add #sound-dai-cells to hdmi node Date: Sun, 6 Dec 2020 14:33:53 +0100 Message-Id: <20201206133355.16007-4-jbx6244@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20201206133355.16007-1-jbx6244@gmail.com> References: <20201206133355.16007-1-jbx6244@gmail.com> Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, airlied@linux.ie, linux-kernel@vger.kernel.org, broonie@kernel.org, hjc@rock-chips.com, dri-devel@lists.freedesktop.org, lgirdwood@gmail.com, linux-rockchip@lists.infradead.org, robh+dt@kernel.org, daniel@ffwll.ch, linux-arm-kernel@lists.infradead.org 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" '#sound-dai-cells' is required to properly interpret the list of DAI specified in the 'sound-dai' property, so add them to the 'hdmi' node for 'rk3066a.dtsi'. Signed-off-by: Johan Jonker --- arch/arm/boot/dts/rk3066a.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/rk3066a.dtsi b/arch/arm/boot/dts/rk3066a.dtsi index 252750c97..67fcb0dc9 100644 --- a/arch/arm/boot/dts/rk3066a.dtsi +++ b/arch/arm/boot/dts/rk3066a.dtsi @@ -124,6 +124,7 @@ pinctrl-0 = <&hdmii2c_xfer>, <&hdmi_hpd>; power-domains = <&power RK3066_PD_VIO>; rockchip,grf = <&grf>; + #sound-dai-cells = <0>; status = "disabled"; ports { From patchwork Sun Dec 6 13:33:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Jonker X-Patchwork-Id: 11954123 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2BA1C4361B for ; Sun, 6 Dec 2020 13:36:51 +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 AF36322D08 for ; Sun, 6 Dec 2020 13:36:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF36322D08 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 3109B179B; Sun, 6 Dec 2020 14:35:59 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3109B179B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1607261809; bh=e1CdGycGD6LX6+DJfyJDdmzXiXHPLIi8pyzGeSRKKJ4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=pJ7bmUXOeoj3mFi9HdKjwxUCCaY/NRkRb4s+BGMpnwMLiu93BDjMAHxjpfToiPKZq Zx7fXLJXutVNMsNEW6VXvghEF4jUVlxNt1XgZT4NL9F3tf1bLqgxRpLIRxW0G2iCx3 Fa7TY0SkOtd6FXS84UPctYzh59lyADsNuG7nrPi4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1689BF804D8; Sun, 6 Dec 2020 14:34:22 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CFA58F80260; Sun, 6 Dec 2020 14:34:18 +0100 (CET) Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (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 07B50F80253 for ; Sun, 6 Dec 2020 14:34:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 07B50F80253 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VyMr2Z2Y" Received: by mail-ed1-x536.google.com with SMTP id u19so10821212edx.2 for ; Sun, 06 Dec 2020 05:34:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/M45YtMWBHvWX7HJgiaCX3duzycDxACgeh25TxK15Eg=; b=VyMr2Z2Y2FxVMjApnc35MnfMrKlfVe62MA73cWFUYFKdSao13p18AZKDCQ+AunENQJ 0smVDtZJueGCSqpz90+Q0ghFZy0UViSu31AEWd+pH6kF9OrNDBnodljF3Qy1MOMO58D5 xKBgYx6mK431AusxL2+qYZ3hU0+QZf7tmbPdtREX/jsFaUVKjlzkkEd6nokY+CZEoK8e DJzHQ0qWdcPIdsqqNdLd1pFK4HJ5+t24UPV5b7Hfp0V19a8gLDU/jd8jwIpAgEvA/4WM cyxB2IpQUGhhs4YMLz/fi/zrcf59//JIl7DLjaXmj72PowGdVJkZfVYHw7ifH/kjhoDG 45Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/M45YtMWBHvWX7HJgiaCX3duzycDxACgeh25TxK15Eg=; b=YKlVA32WS2riMc/RGgrFDr9n2IN2oXIJBKWUj6YMWGooaOScrWgwqByTy1lmWNBorb JJgjjSTrVsRDIiCLgt7YL/1q602gpOiq74lJEFV1CQkYkgUymQGWhTgtcVFB+ht6Bbbf 6EnS99Ov5wh0jlCmkqvS6K8X2HeAtVp0RB2VLXrzFR9F4tgoDxiFebE2XaIRuQwm52+e TiKPkuB+qsU77a8sPDs23E7hpmlsywjlQFyGeCeubKquL/BZ3guVkiFaEg1xEY+nLaqj 5x9HfKuM7MHTFlj1/ByQAN1dqWPZ7iWOm6O9s6HPB3A4L7ltYzAti5wDsiKcHXARbQq+ bA4g== X-Gm-Message-State: AOAM531r669AJOGWsjbHTfL4wrO4g98ADN8Pc5s9i3MEzsIjlwJirEl+ yPK+Ed988H93qhhJla0WegE= X-Google-Smtp-Source: ABdhPJw1Wm1W5qPXXa98kmLBiwpshvAAU1dUvFzjqg3/KeUGfBrmVqaOo4gngpFc6QMwaVBCy31C+w== X-Received: by 2002:a50:dac7:: with SMTP id s7mr15721439edj.106.1607261650199; Sun, 06 Dec 2020 05:34:10 -0800 (PST) Received: from debian.home (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id qh23sm7770129ejb.71.2020.12.06.05.34.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Dec 2020 05:34:09 -0800 (PST) From: Johan Jonker To: heiko@sntech.de Subject: [PATCH v6 4/5] ARM: dts: rockchip: add hdmi-sound node to rk3066a.dtsi Date: Sun, 6 Dec 2020 14:33:54 +0100 Message-Id: <20201206133355.16007-5-jbx6244@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20201206133355.16007-1-jbx6244@gmail.com> References: <20201206133355.16007-1-jbx6244@gmail.com> Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, airlied@linux.ie, linux-kernel@vger.kernel.org, broonie@kernel.org, hjc@rock-chips.com, dri-devel@lists.freedesktop.org, lgirdwood@gmail.com, linux-rockchip@lists.infradead.org, robh+dt@kernel.org, daniel@ffwll.ch, linux-arm-kernel@lists.infradead.org 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 hdmi-sound node to rk3066a.dtsi, so that it can be reused by boards with HDMI support. Signed-off-by: Johan Jonker --- arch/arm/boot/dts/rk3066a.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm/boot/dts/rk3066a.dtsi b/arch/arm/boot/dts/rk3066a.dtsi index 67fcb0dc9..f91ce3054 100644 --- a/arch/arm/boot/dts/rk3066a.dtsi +++ b/arch/arm/boot/dts/rk3066a.dtsi @@ -49,6 +49,22 @@ ports = <&vop0_out>, <&vop1_out>; }; + hdmi_sound: hdmi-sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "HDMI"; + simple-audio-card,format = "i2s"; + simple-audio-card,mclk-fs = <256>; + status = "disabled"; + + simple-audio-card,codec { + sound-dai = <&hdmi>; + }; + + simple-audio-card,cpu { + sound-dai = <&i2s0>; + }; + }; + sram: sram@10080000 { compatible = "mmio-sram"; reg = <0x10080000 0x10000>; From patchwork Sun Dec 6 13:33:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Jonker X-Patchwork-Id: 11954127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A84AC4361B for ; Sun, 6 Dec 2020 13:37:37 +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 9CA4823121 for ; Sun, 6 Dec 2020 13:37:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9CA4823121 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 0AA0C176A; Sun, 6 Dec 2020 14:36:45 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0AA0C176A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1607261855; bh=cdCnhWNwtTkMNU7okWv2gCB2pWFhZYO+A3MGfiypVqQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Kn4n9haKSkUgvMeVQk3aOm36aoKuhpkwaAkQ3I7zx/WGIn45JgeJ2yZEI5Bup/AHw ejCpzlesMH8t/ca/3AH8xA//Kl87iCxmM+zVLpB6qx/5hUIPETK1qoUhmmdoYbo0Vw eRliOEv6iA4Pr2Qie6Gg6RkAalESCjkL+YDGKpZY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8C5B9F804E6; Sun, 6 Dec 2020 14:34:23 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 85094F804D6; Sun, 6 Dec 2020 14:34:21 +0100 (CET) Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) (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 6EF9FF804CA for ; Sun, 6 Dec 2020 14:34:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6EF9FF804CA Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JOVXuy3e" Received: by mail-ej1-x643.google.com with SMTP id b9so5250150ejy.0 for ; Sun, 06 Dec 2020 05:34:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MNzWsDtU39BR4iFEfSJQ9mnoYu92ToJLMEGgLWUUrPw=; b=JOVXuy3e6JymxKOPEoHBdkzfQUhgnoR1msgkoaiMxH70fRYib/t+qYr+VQpo7JKMln F91whwe0wS6E4TTblt2ayRevdquO+k5v8NBiIGfJfJ6kCo75D+I0zR/Vp3M9iOTClr+y RCD4WdS3002o8Co4VHrBS/SLNuFuYVhfulYpaFxC/YwFdKNT4An0K8Wd/1+AdipNSVDq DmHl6hIzKsAopuPY3pE8J0vQW+3Q5+kXiYphccbg7W1ZVI6bX+A6IWPSUqr82lBEhjME zxPxH0zFGmboVpKVBFPb3LvGF83sSP9eqfPZsKkrNaa7ufXKT5erD+NMFSrNFe0jGx/r fRdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MNzWsDtU39BR4iFEfSJQ9mnoYu92ToJLMEGgLWUUrPw=; b=HRAlazEVw6g5bdLDKaBDGTjhUzQ2fMWiEf8ZzgUPWNaFhJD7yvBYtm0deJWrqvJ/Lb Ns3lHO/D3VYBMcqYyE97kTqCU/WcM8V9aY4nXzh9htt2fXJwi7/MoqaClhBw1lYm9ajK Gsy172UCmI+2/WYK3Gf7UG1DSgI5cz/2NqCxAesbJYmM1J9Xak7uKViDvF4fEG4zPjGq SRUyzyZuU87QE9nDqYCrlY26nBNarPv7d2Xa5DAtHh3EdNJqzdf2803zgP8orn9b1GlK f+cbMrA5kpdsNEMVCs58+cPESGjcXE0tJoUPISf8rEkx4sfBbz6hpqCtKKp7JwETs8jF /ebw== X-Gm-Message-State: AOAM533HKUYtv1z6OGjwkRPx68qbJRdDl3QOoR4AoHYy9dWkxu9070jm /k7BXiAziSQfQpVYhiPVw6k= X-Google-Smtp-Source: ABdhPJztME1AEa+6AzKHTpyb9Y+omIXYUc5Z2Uz2KCJGA5tPM3cmuLgOt76RoEEmj6mHLL05lTnjBQ== X-Received: by 2002:a17:906:f05:: with SMTP id z5mr15442015eji.8.1607261651143; Sun, 06 Dec 2020 05:34:11 -0800 (PST) Received: from debian.home (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id qh23sm7770129ejb.71.2020.12.06.05.34.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Dec 2020 05:34:10 -0800 (PST) From: Johan Jonker To: heiko@sntech.de Subject: [PATCH v6 5/5] ARM: dts: rockchip: enable hdmi_sound and i2s0 for rk3066a-mk808 Date: Sun, 6 Dec 2020 14:33:55 +0100 Message-Id: <20201206133355.16007-6-jbx6244@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20201206133355.16007-1-jbx6244@gmail.com> References: <20201206133355.16007-1-jbx6244@gmail.com> Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, airlied@linux.ie, linux-kernel@vger.kernel.org, broonie@kernel.org, hjc@rock-chips.com, dri-devel@lists.freedesktop.org, lgirdwood@gmail.com, linux-rockchip@lists.infradead.org, robh+dt@kernel.org, daniel@ffwll.ch, linux-arm-kernel@lists.infradead.org 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" Make some noise with mk808. Enable the hdmi_sound node and add i2s0 as sound source for hdmi. Signed-off-by: Johan Jonker --- arch/arm/boot/dts/rk3066a-mk808.dts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/rk3066a-mk808.dts b/arch/arm/boot/dts/rk3066a-mk808.dts index eed9e60cf..5fe74c097 100644 --- a/arch/arm/boot/dts/rk3066a-mk808.dts +++ b/arch/arm/boot/dts/rk3066a-mk808.dts @@ -116,6 +116,14 @@ }; }; +&hdmi_sound { + status = "okay"; +}; + +&i2s0 { + status = "okay"; +}; + &mmc0 { bus-width = <4>; cap-mmc-highspeed;