[PATCH] drm/tegra: sor: Support for audio over HDMI

Thierry Reding thierry.reding at gmail.com
Tue Dec 4 08:42:40 UTC 2018


On Mon, Dec 03, 2018 at 06:05:07PM +0200, Jani Nikula wrote:
> On Mon, 03 Dec 2018, Thierry Reding <thierry.reding at gmail.com> wrote:
> > From: Thierry Reding <treding at nvidia.com>
> >
> > This code is very similar to the audio over HDMI support on older chips.
> > Interoperation with the audio codec is done via a pair of codec scratch
> > registers and an interrupt that is raised at the SOR when the codec has
> > written those registers.
> >
> > Signed-off-by: Thierry Reding <treding at nvidia.com>
> > ---
> >  drivers/gpu/drm/tegra/sor.c | 229 ++++++++++++++++++++++++++++++++++++
> >  drivers/gpu/drm/tegra/sor.h |  68 +++++++++++
> >  2 files changed, 297 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
> > index b129da2e5afd..22a54434a757 100644
> > --- a/drivers/gpu/drm/tegra/sor.c
> > +++ b/drivers/gpu/drm/tegra/sor.c
> > @@ -19,6 +19,8 @@
> >  
> >  #include <soc/tegra/pmc.h>
> >  
> > +#include <sound/hda_verbs.h>
> > +
> >  #include <drm/drm_atomic_helper.h>
> >  #include <drm/drm_dp_helper.h>
> >  #include <drm/drm_panel.h>
> > @@ -407,6 +409,7 @@ struct tegra_sor {
> >  	const struct tegra_sor_soc *soc;
> >  	void __iomem *regs;
> >  	unsigned int index;
> > +	unsigned int irq;
> >  
> >  	struct reset_control *rst;
> >  	struct clk *clk_parent;
> > @@ -433,6 +436,11 @@ struct tegra_sor {
> >  
> >  	struct delayed_work scdc;
> >  	bool scdc_enabled;
> > +
> > +	struct {
> > +		unsigned int sample_rate;
> > +		unsigned int channels;
> > +	} audio;
> >  };
> >  
> >  struct tegra_sor_state {
> > @@ -2139,6 +2147,144 @@ tegra_sor_hdmi_setup_avi_infoframe(struct tegra_sor *sor,
> >  	return 0;
> >  }
> >  
> > +static void tegra_sor_write_eld(struct tegra_sor *sor)
> > +{
> > +	size_t length = drm_eld_size(sor->output.connector.eld), i;
> 
> This caught my eye, can't be right?

Why do you think it's wrong? The length is the number of bytes that are
to be written to the HDA ELD buffer. This is pretty much the same across
all drivers that support HDMI audio (i915 and nouveau).

Also, audio is definitely working with this patch, and the HDMI codecs
are showing the correct information in procfs.

Can you elaborate?

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20181204/d8cb8e80/attachment.sig>


More information about the dri-devel mailing list