From: Jani Nikula <jani.nikula@linux.intel.com>
To: Jerome Anand <jerome.anand@intel.com>,
intel-gfx@lists.freedesktop.org, alsa-devel@alsa-project.org
Cc: tiwai@suse.de, broonie@kernel.org, rakesh.a.ughreja@intel.com
Subject: Re: [PATCH v4 1/5] drm/i915: setup bridge for HDMI LPE audio driver
Date: Mon, 23 Jan 2017 12:54:16 +0200 [thread overview]
Message-ID: <874m0q82sn.fsf@intel.com> (raw)
In-Reply-To: <20170120222232.27791-2-jerome.anand@intel.com>
On Sat, 21 Jan 2017, Jerome Anand <jerome.anand@intel.com> wrote:
> Enable support for HDMI LPE audio mode on Baytrail and
> Cherrytrail when HDaudio controller is not detected
>
> Setup minimum required resources during i915_driver_load:
> 1. Create a platform device to share MMIO/IRQ resources
> 2. Make the platform device child of i915 device for runtime PM.
> 3. Create IRQ chip to forward HDMI LPE audio irqs.
>
> HDMI LPE audio driver (a standalone sound driver) probes the
> LPE audio device and creates a new sound card.
>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Signed-off-by: Jerome Anand <jerome.anand@intel.com>
Some comments inline. This is not a detailed technical review, more a
high level glance at interfacing with the rest of i915.
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 4d22b4b..70d728b 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1131,7 +1131,8 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
> if (IS_GEN5(dev_priv))
> intel_gpu_ips_init(dev_priv);
>
> - i915_audio_component_init(dev_priv);
> + if (intel_lpe_audio_init(dev_priv) < 0)
> + i915_audio_component_init(dev_priv);
I'd like this abstracted behind a single intel_audio_init() in
intel_audio.c, which would do the right thing.
>
> /*
> * Some ports require correctly set-up hpd registers for detection to
> @@ -1149,7 +1150,10 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
> */
> static void i915_driver_unregister(struct drm_i915_private *dev_priv)
> {
> - i915_audio_component_cleanup(dev_priv);
> + if (HAS_LPE_AUDIO(dev_priv))
> + intel_lpe_audio_teardown(dev_priv);
> + else
> + i915_audio_component_cleanup(dev_priv);
Same here for cleanup.
>
> intel_gpu_ips_teardown();
> acpi_video_unregister();
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index f66eeede..cc7033a 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2449,6 +2449,12 @@ struct drm_i915_private {
> /* Used to save the pipe-to-encoder mapping for audio */
> struct intel_encoder *av_enc_map[I915_MAX_PIPES];
>
> + /* necessary resource sharing with HDMI LPE audio driver. */
> + struct {
> + struct platform_device *platdev;
> + int irq;
> + } lpe_audio;
> +
I think the av_enc_map array is misplaced within dev_priv, and these
should really be closer to the audio_component etc. members. But could
be cleaned up later too.
> /*
> * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
> * will be rejected. Instead look for a better place.
> @@ -2848,6 +2854,8 @@ intel_info(const struct drm_i915_private *dev_priv)
>
> #define HAS_POOLED_EU(dev_priv) ((dev_priv)->info.has_pooled_eu)
>
> +#define HAS_LPE_AUDIO(dev_priv) ((dev_priv)->lpe_audio.platdev != NULL)
Please note that *all* of our HAS_ macros check for static features of
the hardware, not dynamic state of the driver. Let's keep it that way.
If you abstract the init/cleanup in intel_audio.c like I suggested, I
think you can just check for dev_priv->lpe_audio.platdev directly, and
get rid of HAS_LPE_AUDIO() altogether. Then it'll all be within
intel_audio.c or intel_lpe_audio.c, and it's pretty obvious what it
means.
> +/**
> + * intel_lpe_audio_detect() - check & setup lpe audio if present
> + * @dev_priv: the i915 drm device private data
> + *
> + * Detect if lpe audio is present
> + *
> + * Return: true if lpe audio present else Return = false
> + */
> +bool intel_lpe_audio_detect(struct drm_i915_private *dev_priv)
Could this not be static?
> +/**
> + * intel_lpe_audio_setup() - setup the bridge between HDMI LPE Audio
> + * driver and i915
> + * @dev_priv: the i915 drm device private data
> + *
> + * set up the minimum required resources for the bridge: irq chip,
> + * platform resource and platform device. i915 device is set as parent
> + * of the new platform device.
> + *
> + * Return: 0 if successful. non-zero if allocation/initialization fails
> + */
> +int intel_lpe_audio_setup(struct drm_i915_private *dev_priv)
Could this not be static?
BR,
Jani.
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-01-23 10:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-20 22:22 [PATCH v4 0/5] Add support for Legacy HDMI audio drivers Jerome Anand
2017-01-20 11:54 ` ✗ Fi.CI.BAT: failure for Add support for Legacy HDMI audio drivers (rev5) Patchwork
2017-01-20 22:22 ` [PATCH v4 1/5] drm/i915: setup bridge for HDMI LPE audio driver Jerome Anand
2017-01-23 10:54 ` Jani Nikula [this message]
2017-01-24 8:21 ` Anand, Jerome
2017-01-20 22:22 ` [PATCH v4 2/5] drm/i915: Add support for audio driver notifications Jerome Anand
2017-01-23 10:57 ` Jani Nikula
2017-01-23 16:32 ` Pierre-Louis Bossart
2017-01-24 7:00 ` Jani Nikula
2017-01-24 8:42 ` Anand, Jerome
2017-01-20 22:22 ` [PATCH v4 3/5] ALSA: add Intel HDMI LPE audio driver for BYT/CHT-T Jerome Anand
2017-01-20 22:22 ` [PATCH v4 4/5] ALSA: x86: hdmi: Add audio support for BYT and CHT Jerome Anand
2017-01-20 11:15 ` Takashi Iwai
2017-01-20 16:45 ` [alsa-devel] " Pierre-Louis Bossart
2017-01-20 19:09 ` Takashi Iwai
2017-01-20 22:22 ` [PATCH v4 5/5] ALSA: x86: hdmi: continue playback even when display resolution changes Jerome Anand
2017-01-23 10:18 ` [PATCH v4 0/5] Add support for Legacy HDMI audio drivers Takashi Iwai
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=874m0q82sn.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jerome.anand@intel.com \
--cc=rakesh.a.ughreja@intel.com \
--cc=tiwai@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