mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 07:22:33 +00:00
1343acc8cd
Deleted (upstreamed): bcm27xx/patches-5.10/950-0669-drm-vc4-hdmi-Make-sure-the-device-is-powered-with-CE.patch [1] bcm27xx/patches-5.10/950-0672-drm-vc4-hdmi-Move-initial-register-read-after-pm_run.patch [1] gemini/patches-5.10/0003-ARM-dts-gemini-NAS4220-B-fis-index-block-with-128-Ki.patch [2] Manually rebased: bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch Manually reverted: generic/pending-5.10/860-Revert-ASoC-mediatek-Check-for-error-clk-pointer.patch [3] [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.94&id=55b10b88ac8654fc2f31518aa349a2e643b37f18 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.94&id=958a8819d41420d7a74ed922a09cacc0ba3a4218 [3] https://lore.kernel.org/all/trinity-2a727d96-0335-4d03-8f30-e22a0e10112d-1643363480085@3c-app-gmx-bap33/ Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
112 lines
4.0 KiB
Diff
112 lines
4.0 KiB
Diff
From 644a25e926abb918dfff7b3122896848ca35d2a1 Mon Sep 17 00:00:00 2001
|
|
From: Maxime Ripard <maxime@cerno.tech>
|
|
Date: Tue, 27 Apr 2021 16:26:39 +0200
|
|
Subject: [PATCH] drm/vc4: hdmi: Remove redundant variables
|
|
|
|
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
|
---
|
|
drivers/gpu/drm/vc4/vc4_hdmi.c | 26 ++++++++++++--------------
|
|
drivers/gpu/drm/vc4/vc4_hdmi.h | 4 ----
|
|
2 files changed, 12 insertions(+), 18 deletions(-)
|
|
|
|
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
|
|
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
|
|
@@ -1165,12 +1165,13 @@ static u32 vc5_hdmi_channel_map(struct v
|
|
}
|
|
|
|
/* HDMI audio codec callbacks */
|
|
-static void vc4_hdmi_audio_set_mai_clock(struct vc4_hdmi *vc4_hdmi)
|
|
+static void vc4_hdmi_audio_set_mai_clock(struct vc4_hdmi *vc4_hdmi,
|
|
+ unsigned int samplerate)
|
|
{
|
|
u32 hsm_clock = clk_get_rate(vc4_hdmi->audio_clock);
|
|
unsigned long n, m;
|
|
|
|
- rational_best_approximation(hsm_clock, vc4_hdmi->audio.samplerate,
|
|
+ rational_best_approximation(hsm_clock, samplerate,
|
|
VC4_HD_MAI_SMP_N_MASK >>
|
|
VC4_HD_MAI_SMP_N_SHIFT,
|
|
(VC4_HD_MAI_SMP_M_MASK >>
|
|
@@ -1182,12 +1183,11 @@ static void vc4_hdmi_audio_set_mai_clock
|
|
VC4_SET_FIELD(m - 1, VC4_HD_MAI_SMP_M));
|
|
}
|
|
|
|
-static void vc4_hdmi_set_n_cts(struct vc4_hdmi *vc4_hdmi)
|
|
+static void vc4_hdmi_set_n_cts(struct vc4_hdmi *vc4_hdmi, unsigned int samplerate)
|
|
{
|
|
struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
|
|
struct drm_crtc *crtc = encoder->crtc;
|
|
const struct drm_display_mode *mode = &crtc->state->adjusted_mode;
|
|
- u32 samplerate = vc4_hdmi->audio.samplerate;
|
|
u32 n, cts;
|
|
u64 tmp;
|
|
|
|
@@ -1321,27 +1321,25 @@ static int vc4_hdmi_audio_prepare(struct
|
|
{
|
|
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
|
|
struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
|
|
+ unsigned int sample_rate = params->sample_rate;
|
|
+ unsigned int channels = params->channels;
|
|
u32 audio_packet_config, channel_mask;
|
|
u32 channel_map;
|
|
u32 mai_audio_format;
|
|
u32 mai_sample_rate;
|
|
|
|
dev_dbg(dev, "%s: %u Hz, %d bit, %d channels\n", __func__,
|
|
- params->sample_rate, params->sample_width,
|
|
- params->channels);
|
|
-
|
|
- vc4_hdmi->audio.channels = params->channels;
|
|
- vc4_hdmi->audio.samplerate = params->sample_rate;
|
|
+ sample_rate, params->sample_width, channels);
|
|
|
|
HDMI_WRITE(HDMI_MAI_CTL,
|
|
- VC4_SET_FIELD(params->channels, VC4_HD_MAI_CTL_CHNUM) |
|
|
+ VC4_SET_FIELD(channels, VC4_HD_MAI_CTL_CHNUM) |
|
|
VC4_HD_MAI_CTL_WHOLSMP |
|
|
VC4_HD_MAI_CTL_CHALIGN |
|
|
VC4_HD_MAI_CTL_ENABLE);
|
|
|
|
- vc4_hdmi_audio_set_mai_clock(vc4_hdmi);
|
|
+ vc4_hdmi_audio_set_mai_clock(vc4_hdmi, sample_rate);
|
|
|
|
- mai_sample_rate = sample_rate_to_mai_fmt(vc4_hdmi->audio.samplerate);
|
|
+ mai_sample_rate = sample_rate_to_mai_fmt(sample_rate);
|
|
if (params->iec.status[0] & IEC958_AES0_NONAUDIO &&
|
|
params->channels == 8)
|
|
mai_audio_format = VC4_HDMI_MAI_FORMAT_HBR;
|
|
@@ -1359,7 +1357,7 @@ static int vc4_hdmi_audio_prepare(struct
|
|
VC4_HDMI_AUDIO_PACKET_ZERO_DATA_ON_INACTIVE_CHANNELS |
|
|
VC4_SET_FIELD(0x8, VC4_HDMI_AUDIO_PACKET_B_FRAME_IDENTIFIER);
|
|
|
|
- channel_mask = GENMASK(vc4_hdmi->audio.channels - 1, 0);
|
|
+ channel_mask = GENMASK(channels - 1, 0);
|
|
audio_packet_config |= VC4_SET_FIELD(channel_mask,
|
|
VC4_HDMI_AUDIO_PACKET_CEA_MASK);
|
|
|
|
@@ -1378,7 +1376,7 @@ static int vc4_hdmi_audio_prepare(struct
|
|
channel_map = vc4_hdmi->variant->channel_map(vc4_hdmi, channel_mask);
|
|
HDMI_WRITE(HDMI_MAI_CHANNEL_MAP, channel_map);
|
|
HDMI_WRITE(HDMI_AUDIO_PACKET_CONFIG, audio_packet_config);
|
|
- vc4_hdmi_set_n_cts(vc4_hdmi);
|
|
+ vc4_hdmi_set_n_cts(vc4_hdmi, sample_rate);
|
|
|
|
memcpy(&vc4_hdmi->audio.infoframe, ¶ms->cea, sizeof(params->cea));
|
|
vc4_hdmi_set_audio_infoframe(encoder);
|
|
--- a/drivers/gpu/drm/vc4/vc4_hdmi.h
|
|
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
|
|
@@ -111,13 +111,9 @@ struct vc4_hdmi_audio {
|
|
struct snd_soc_dai_link_component cpu;
|
|
struct snd_soc_dai_link_component codec;
|
|
struct snd_soc_dai_link_component platform;
|
|
- int samplerate;
|
|
- int channels;
|
|
struct snd_dmaengine_dai_dma_data dma_data;
|
|
struct hdmi_audio_infoframe infoframe;
|
|
bool streaming;
|
|
-
|
|
- unsigned char iec_status[4];
|
|
};
|
|
|
|
/* General HDMI hardware state. */
|