From: Maxime Ripard <maxime@cerno.tech>
To: Jaroslav Kysela <perex@perex.cz>, Mark Brown <broonie@kernel.org>,
dri-devel@lists.freedesktop.org,
Daniel Vetter <daniel.vetter@intel.com>,
David Airlie <airlied@linux.ie>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
Maxime Ripard <maxime@cerno.tech>,
Liam Girdwood <lgirdwood@gmail.com>,
Takashi Iwai <tiwai@suse.com>
Cc: devicetree@vger.kernel.org,
Dave Stevenson <dave.stevenson@raspberrypi.com>,
Phil Elwell <phil@raspberrypi.com>,
Tim Gover <tim.gover@raspberrypi.com>,
Dom Cobley <dom@raspberrypi.com>,
linux-doc@vger.kernel.org, Eric Anholt <eric@anholt.net>,
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
Maxime Ripard <mripard@kernel.org>,
Nicolas Saenz Julienne <nsaenz@kernel.org>,
bcm-kernel-feedback-list@broadcom.com,
linux-arm-kernel@lists.infradead.org,
Daniel Vetter <daniel@ffwll.ch>,
linux-rpi-kernel@lists.infradead.org,
Jonathan Corbet <corbet@lwn.net>,
Rob Herring <robh+dt@kernel.org>
Subject: [PATCH v2 11/12] drm/vc4: hdmi: Remove redundant variables
Date: Tue, 25 May 2021 15:23:53 +0200 [thread overview]
Message-ID: <20210525132354.297468-12-maxime@cerno.tech> (raw)
In-Reply-To: <20210525132354.297468-1-maxime@cerno.tech>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 26 ++++++++++++--------------
drivers/gpu/drm/vc4/vc4_hdmi.h | 2 --
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 0ecfcf54b70a..c6dafeab4378 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1064,12 +1064,13 @@ static u32 vc5_hdmi_channel_map(struct vc4_hdmi *vc4_hdmi, u32 channel_mask)
}
/* 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 >>
@@ -1081,12 +1082,11 @@ static void vc4_hdmi_audio_set_mai_clock(struct vc4_hdmi *vc4_hdmi)
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;
@@ -1220,27 +1220,25 @@ static int vc4_hdmi_audio_prepare(struct device *dev, void *data,
{
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;
@@ -1258,7 +1256,7 @@ static int vc4_hdmi_audio_prepare(struct device *dev, void *data,
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);
@@ -1277,7 +1275,7 @@ static int vc4_hdmi_audio_prepare(struct device *dev, void *data,
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);
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h
index 055aa64a47a2..511673cda341 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
@@ -111,8 +111,6 @@ 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;
--
2.31.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-05-25 13:33 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-25 13:23 [PATCH v2 00/12] drm/vc4: hdmi: Enable Channel Mapping, IEC958, HBR Passthrough using hdmi-codec Maxime Ripard
2021-05-25 13:23 ` [PATCH v2 01/12] ALSA: doc: Clarify IEC958 controls iface Maxime Ripard
2021-05-25 15:58 ` Takashi Iwai
2021-05-25 13:23 ` [PATCH v2 02/12] ALSA: iec958: Split status creation and fill Maxime Ripard
2021-05-25 16:01 ` Takashi Iwai
2021-05-25 13:23 ` [PATCH v2 03/12] ASoC: hdmi-codec: Rework to support more controls Maxime Ripard
2021-05-26 10:38 ` Mark Brown
2021-05-25 13:23 ` [PATCH v2 04/12] ASoC: hdmi-codec: Add iec958 controls Maxime Ripard
2021-05-26 10:38 ` Mark Brown
2021-06-09 12:43 ` Mark Brown
2021-06-10 12:26 ` Maxime Ripard
2021-05-25 13:23 ` [PATCH v2 05/12] ASoC: hdmi-codec: Add a prepare hook Maxime Ripard
2021-05-26 10:39 ` Mark Brown
2021-05-31 9:42 ` Maxime Ripard
2021-05-31 11:12 ` Takashi Iwai
2021-06-01 12:36 ` Mark Brown
2021-06-03 8:18 ` Maxime Ripard
2021-05-25 13:23 ` [PATCH v2 06/12] drm/vc4: hdmi: Set HD_CTL_WHOLSMP and HD_CTL_CHALIGN_SET Maxime Ripard
2021-06-01 8:45 ` nicolas saenz julienne
2021-05-25 13:23 ` [PATCH v2 07/12] drm/vc4: hdmi: Set HDMI_MAI_FMT Maxime Ripard
2021-06-01 8:47 ` nicolas saenz julienne
2021-05-25 13:23 ` [PATCH v2 08/12] drm/vc4: hdmi: Set VC4_HDMI_MAI_CONFIG_FORMAT_REVERSE Maxime Ripard
2021-06-01 8:49 ` nicolas saenz julienne
2021-05-25 13:23 ` [PATCH v2 09/12] drm/vc4: hdmi: Remove firmware logic for MAI threshold setting Maxime Ripard
2021-06-01 8:52 ` nicolas saenz julienne
2021-05-25 13:23 ` [PATCH v2 10/12] drm/vc4: hdmi: Register HDMI codec Maxime Ripard
2021-06-01 9:26 ` nicolas saenz julienne
2021-06-23 12:29 ` Maxime Ripard
2021-05-25 13:23 ` Maxime Ripard [this message]
2021-06-01 9:30 ` [PATCH v2 11/12] drm/vc4: hdmi: Remove redundant variables nicolas saenz julienne
2021-05-25 13:23 ` [PATCH v2 12/12] ARM: dts: bcm2711: Tune DMA parameters for HDMI audio Maxime Ripard
2021-05-25 15:25 ` Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210525132354.297468-12-maxime@cerno.tech \
--to=maxime@cerno.tech \
--cc=airlied@linux.ie \
--cc=alsa-devel@alsa-project.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=broonie@kernel.org \
--cc=corbet@lwn.net \
--cc=daniel.vetter@intel.com \
--cc=daniel@ffwll.ch \
--cc=dave.stevenson@raspberrypi.com \
--cc=devicetree@vger.kernel.org \
--cc=dom@raspberrypi.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=eric@anholt.net \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=nsaenz@kernel.org \
--cc=nsaenzjulienne@suse.de \
--cc=perex@perex.cz \
--cc=phil@raspberrypi.com \
--cc=robh+dt@kernel.org \
--cc=tim.gover@raspberrypi.com \
--cc=tiwai@suse.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).