From patchwork Mon Aug 12 12:50:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 171072 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2793209ily; Mon, 12 Aug 2019 05:50:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+WpaatRvwdUWdzm4TKYuxqdeHC1IxizxZHj65XyGpRVVDqb+HaWjMGfZtpnoxmnrf1nyv X-Received: by 2002:a17:90a:fd93:: with SMTP id cx19mr5841720pjb.102.1565614236760; Mon, 12 Aug 2019 05:50:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565614236; cv=none; d=google.com; s=arc-20160816; b=APTSfYEBQlwAEPBG2uxtwtmqhlUEtRgyJ8KxIqmypajJ8sCJCFdtGTRFD5qDkOLy+u z8rFKEZOBqRaMtjk4bVkx1G79+ziyDVCCF0zcPBGgSq3JTyu04sgsijp10+r8d3ki2FW jh2ZvI5Et0IKfnFQeBU6tn75cpYsBIE4jRWa7RgCjWW+9iqbetcpAkg4kc8xnPlFpKpH v3g++oROocLh2SiaQjO1rJ6DcZ/Jfi0frXEONpuotHtoS+pq/CQACBh2UwNktY+d92r3 R8zGmYB/Ui/9/lJY72Lpeh5YqrlU4GY8txL1oNdeotrVH8CeEhZc3b1HdXKtlFPIVDVk Kdpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nuL4TLbuiajteIBUcLht3A9vUK/cqgNo9Cf0dYF6/nc=; b=lL1LjXLIN2/wuFmrFVMFT8aeqtrHBWjvhji/WGitICGyxeUHrTMBtnXAgiohYi13y4 UBylv+hWZc/7K4EgR4noJ4z/QtNO/P8m5nMZ/x1l4gayOSYB3Tm9xd/YtncRKF38t3+b jfgeRbYhBg8llJziUBiEVuXgSFyK8ahRzPiu7hMGwSepkYlsjJJkN+/mqEUrIV0N1ES7 9+eyXkqw8sRizuRw8Ds3uyX9DRxrMRBTGIMHcCzKn0E9QBPRkqtoiBmj+JH9dYV4ikoV KreVKK5Al+W0jI4JCTiTAjmpulhJOTrpmwe4NVhKsEHBk/QzOMPh0zL1/kTAGac8Zp9n sPog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=hS7Kx+wO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y65si60212579pgd.487.2019.08.12.05.50.36; Mon, 12 Aug 2019 05:50:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=hS7Kx+wO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726991AbfHLMue (ORCPT + 28 others); Mon, 12 Aug 2019 08:50:34 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54771 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726219AbfHLMue (ORCPT ); Mon, 12 Aug 2019 08:50:34 -0400 Received: by mail-wm1-f67.google.com with SMTP id p74so12053576wme.4 for ; Mon, 12 Aug 2019 05:50:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nuL4TLbuiajteIBUcLht3A9vUK/cqgNo9Cf0dYF6/nc=; b=hS7Kx+wOvRPyPbK4skt43H1PfDxHj/p/cn434dg/BQt9yVt/ySb9q4VxmXqpbcQvqR GavtSTsLNe7rVhEjG9UPXpd0Q7ymkWVCgxHP386VObqiwHXgMFGPBTQr5lKcLnI5D10z IqGc1dLK1K9isXdUt/aZcrMcFzgt2z3Bru0+ZqQX6A6fzH3MhBHTaq05EXAHg9DhamBm eIjC+dOqRKSvw5FRqmqCJgzh3bZNJe4gc/YH9Gi0jmgpJouQ1nSXlc/7LBH/9FvJWrg1 ckSYGMBCIFESxN1VyIveMVps/K52K7gnD9oUz2/vJfT3BzZmGTNHlrJZTauoo4NF+A0i Kuig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nuL4TLbuiajteIBUcLht3A9vUK/cqgNo9Cf0dYF6/nc=; b=rvM/yx0dHhM//PLYWu4R9xOOW77NfeNIeONCnz5zvl1lSpsQ5yy0OuaEbz7RBk1LWI QN5iRfN3DoVqN+1UxGx9kICEO+Ew8HUYywT3KR0Z9eklIslZIO7JQY0bPm5roTBZRoYw b3W6MKRN3RDx+pHYgi+noQIV8peHT70HNIW3dlek+bkWfW1N9aYU25Lk8jVn6R/oBKpQ yyxXI3pEI29+Pu5dpRw8dTi5l7ubqO7XjovpnVCIfjXodrha8F81KA7lyqNFCGfbgFsY FY1C7q0lcTcRY2WLHe92PMB/Gp50dRzwLJ/AH25vMtyOFtnZTxiNfp4BsHyujeyAtGGD VzWQ== X-Gm-Message-State: APjAAAW2bvA2sP7RP4TEmPKl6MkfjfZtsC+7OXYrj4C5hQ9DASXAzcXB YxqzGfnPssuwQ5gMzY5gTseBfw== X-Received: by 2002:a1c:7a02:: with SMTP id v2mr27485520wmc.159.1565614231714; Mon, 12 Aug 2019 05:50:31 -0700 (PDT) Received: from starbuck.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id e11sm13740504wrc.4.2019.08.12.05.50.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 12 Aug 2019 05:50:31 -0700 (PDT) From: Jerome Brunet To: Andrzej Hajda , Neil Armstrong Cc: Jerome Brunet , Kevin Hilman , Jonas Karlman , linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [RESEND PATCH v2 8/8] drm/bridge: dw-hdmi-i2s: add .get_eld support Date: Mon, 12 Aug 2019 14:50:16 +0200 Message-Id: <20190812125016.20169-1-jbrunet@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190812120726.1528-9-jbrunet@baylibre.com> References: <20190812120726.1528-9-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Provide the eld to the generic hdmi-codec driver. This will let the driver enforce the maximum channel number and set the channel allocation depending on the hdmi sink. Cc: Jonas Karlman Signed-off-by: Jerome Brunet --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h | 1 + drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 11 +++++++++++ drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 1 + 3 files changed, 13 insertions(+) -- 2.21.0 diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h index 63b5756f463b..cb07dc0da5a7 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h @@ -14,6 +14,7 @@ struct dw_hdmi_audio_data { struct dw_hdmi_i2s_audio_data { struct dw_hdmi *hdmi; + u8 *eld; void (*write)(struct dw_hdmi *hdmi, u8 val, int offset); u8 (*read)(struct dw_hdmi *hdmi, int offset); diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c index b8ece9c1ba2c..1d15cf9b6821 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c @@ -10,6 +10,7 @@ #include #include +#include #include @@ -121,6 +122,15 @@ static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data) dw_hdmi_audio_disable(hdmi); } +static int dw_hdmi_i2s_get_eld(struct device *dev, void *data, uint8_t *buf, + size_t len) +{ + struct dw_hdmi_i2s_audio_data *audio = data; + + memcpy(buf, audio->eld, min_t(size_t, MAX_ELD_BYTES, len)); + return 0; +} + static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component, struct device_node *endpoint) { @@ -144,6 +154,7 @@ static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component, static struct hdmi_codec_ops dw_hdmi_i2s_ops = { .hw_params = dw_hdmi_i2s_hw_params, .audio_shutdown = dw_hdmi_i2s_audio_shutdown, + .get_eld = dw_hdmi_i2s_get_eld, .get_dai_id = dw_hdmi_i2s_get_dai_id, }; diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index bed4bb017afd..8df69c9dbfad 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2797,6 +2797,7 @@ __dw_hdmi_probe(struct platform_device *pdev, struct dw_hdmi_i2s_audio_data audio; audio.hdmi = hdmi; + audio.eld = hdmi->connector.eld; audio.write = hdmi_writeb; audio.read = hdmi_readb; hdmi->enable_audio = dw_hdmi_i2s_audio_enable;