From patchwork Mon Aug 12 12:07:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 171066 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2747387ily; Mon, 12 Aug 2019 05:07:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpaqU5dPytHF01SjJ3uWLsGFvpYpmQFNvgDRZosfsd0dGCePOizO0qQ5vayHF6MSAhtGG3 X-Received: by 2002:a17:902:f216:: with SMTP id gn22mr31784846plb.118.1565611675747; Mon, 12 Aug 2019 05:07:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565611675; cv=none; d=google.com; s=arc-20160816; b=GRDGbo4LCGsQeJvI+xxWcVWJ45+N1hgb09ZOvd5GK3SYtQIqkW3IDLBiG5LjiH/p7c WSqrK6xwETS+DLEog0hZFwOu+PCFR2E98ywwanjzqs8s8g0JLiAgv4Ouj+lJJ4woeFan w+5ZquGDxtKor8MbS5dhUxqnWJPrgEuJ4BSQYDkIXjk/6c5bSelJQnPChW7ErFSTYrqT gCVmy4U4tOCJEBgb5YDTZ/QMUAtJkhfxK7FakKkIhsOsI6mxoj7DtLPYBi9TALqho3H1 WgW8qyhhiqWUkdxE84cZ++0W/HMEqwYoHbsrre2Fm3wvbQh4RtTiPs9v7x+u/HHLeV2m z3+Q== 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=jc9/cSBhIwTuXPvQDL6txYFXAJblot8ynaeVI0KB+kI=; b=ydAJ6BLmAfxt7swfP4FLSIu9wM3pDmgy0Y0eRr+gR4mdW6RzLe8Cvbmd3XW3wnAdPV f7jgIs9/Vo2bPAdHdX4C0V3wNucqEpSzh+OStfdQ+HW+e48ZKYddaYsXUyoI/0SjTdYF 50extlZ/E0FxXxA3OKVY7hyLZ/rwdR5tVcon1QaGVSrdD8vBqAegkGl7UkgT6M9kNdad zxeCw0NjDt3fAhBD2WZ+BpOF2yO3n6Ml8wCYNVHhGClK5Hr2Rm/7rQxmPbwuHFZ2leke HbJiuSxLpGvKUDy88xUz+UuF5wChmOMcXKwH8dwKZHDCsb0YVDCzYRcDy9M6WbeRlZUg 8MWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=JCgKaHji; 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 x8si9799540pfj.264.2019.08.12.05.07.55; Mon, 12 Aug 2019 05:07:55 -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=JCgKaHji; 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 S1728570AbfHLMHy (ORCPT + 28 others); Mon, 12 Aug 2019 08:07:54 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:52120 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728471AbfHLMHi (ORCPT ); Mon, 12 Aug 2019 08:07:38 -0400 Received: by mail-wm1-f66.google.com with SMTP id 207so11932629wma.1 for ; Mon, 12 Aug 2019 05:07:37 -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=jc9/cSBhIwTuXPvQDL6txYFXAJblot8ynaeVI0KB+kI=; b=JCgKaHjiK9nXytoYeRJc1oNQnDr/iTA4L8Cs/nMSQTvwrHCjI8V6q/fMKElW1iq4kH QVfNygjYCJLIR2X+73dkH1YWR5jd4IZKoHby+j8qpmF4XhZajY4Kjk0JETHWN8nefT3I BfO806OgbneAJNQFFiN1knQc1xLRpBUENeHPFywv44hICM1gob6lINnEr6lMqhzVnZI0 45ko6hz6x7sRZ4R5nYlMEf5MlYQPrQ0o3lAqjqwFZ8KdHKkua1sCJd0NOmLrjZP+qAlF e2qBWgoDEBeqiW5bZLuERfieGV41O7+oENtJiTUejXx6Sj1XEVjw8F1jz4H8xldgpDiF UFHg== 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=jc9/cSBhIwTuXPvQDL6txYFXAJblot8ynaeVI0KB+kI=; b=AZOnZejPrJ7yvj5lPUuX2Xz+Xa/uKqZKACxShTfmiULZu4tktHDDiAI0COb1fDVzug Jz6eQ4FSSE0tXTWpaM6kLGddB3iIt5kmV/myJSXwwK63s7SxJ4wOfaicESBJUqdPXzYc 8sDY8Rd95LAYrdWWfnMDweBuYzleOdRzZZXB6C7q608PlG0gW5HfOjxFzQ51ZpfJJezp zeEqwkNC1/jTZc40q+OYR9HShr33PjmCopO4DBWyzsiXZW7Qrs6k/vNbNTEE42S6GD8V j8eEQBalTS+laOlgmbvhEqaPVVZpUJd0pkEx91n7nfSu6C85DsH5y4zXZMCXfBbBDfji hSsQ== X-Gm-Message-State: APjAAAV/9oYqzwbdE+W01EIW7IzvRSUkoNhN8hu+UDDEohQ+3RdCZRq0 ysVNp0wABbW8tXmEA2BRirAoNw== X-Received: by 2002:a7b:cf3a:: with SMTP id m26mr28033074wmg.111.1565611657147; Mon, 12 Aug 2019 05:07:37 -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 j9sm1883415wrx.66.2019.08.12.05.07.36 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 12 Aug 2019 05:07:36 -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: [PATCH v2 8/8] drm/bridge: dw-hdmi-i2s: add .get_eld support Date: Mon, 12 Aug 2019 14:07:26 +0200 Message-Id: <20190812120726.1528-9-jbrunet@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190812120726.1528-1-jbrunet@baylibre.com> References: <20190812120726.1528-1-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..62e737b81462 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(sizeof(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;