答复: [PATCH 3/4] drm/radeon: Add audio component support
diff mbox series

Message ID DM3PR12MB0873B23B1B964A05FD647AF599540@DM3PR12MB0873.namprd12.prod.outlook.com
State New
Headers show
Series
  • 答复: [PATCH 3/4] drm/radeon: Add audio component support
Related show

Commit Message

Qu, Jim July 25, 2018, 3:32 a.m. UTC
Hi Takashi lwai,

Sorry, I have to use outlook again, since my mail client had some problems that did not receive these series patches.

See the commands in line.

Thanks
JimQu

Comments

Takashi Iwai July 25, 2018, 5:28 a.m. UTC | #1
On Wed, 25 Jul 2018 05:32:52 +0200,
Qu, Jim wrote:
> @@ -269,6 +271,10 @@ static void radeon_audio_enable(struct radeon_device *rdev,
> 
>         if (rdev->audio.funcs->enable)
>                 rdev->audio.funcs->enable(rdev, pin, enable_mask);
> +
> +       if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
> +               acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
> +                                                pin->id, -1);
> 
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> Jim: radeon_audio_enable() can enable audios and also disable them, so eld noitfy callback should be called when enable_mask is true.

It's intentional.  The notifier needs to be called at disablement
time, too.  The audio driver has to follow the HDMI audio disablement,
and notifier receives both on and off case.

The actual state is inquired via get_eld call by HD-audio followed
after the notification.


thanks,

Takashi
jimqu July 25, 2018, 5:40 a.m. UTC | #2
On 2018年07月25日 13:28, Takashi Iwai wrote:
> On Wed, 25 Jul 2018 05:32:52 +0200,
> Qu, Jim wrote:
>> @@ -269,6 +271,10 @@ static void radeon_audio_enable(struct radeon_device *rdev,
>>
>>          if (rdev->audio.funcs->enable)
>>                  rdev->audio.funcs->enable(rdev, pin, enable_mask);
>> +
>> +       if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
>> +               acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
>> +                                                pin->id, -1);
>>
>> Jim: radeon_audio_enable() can enable audios and also disable them, so eld noitfy callback should be called when enable_mask is true.
> It's intentional.  The notifier needs to be called at disablement
> time, too.  The audio driver has to follow the HDMI audio disablement,
> and notifier receives both on and off case.
>
> The actual state is inquired via get_eld call by HD-audio followed
> after the notification.
>
>
> thanks,
>
> Takashi

OK, I got your point.

Thanks
JimQu

Patch
diff mbox series

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 2a72d2feb76d..2c7112ddfed4 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -170,6 +170,7 @@  config DRM_RADEON
        select BACKLIGHT_CLASS_DEVICE
        select BACKLIGHT_LCD_SUPPORT
        select INTERVAL_TREE
+       select SND_HDA_COMPONENT if SND_HDA_CORE
        help
          Choose this option if you have an ATI Radeon graphics card.  There
          are both PCI and AGP versions.  You don't need to choose this to
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 4a2eb409aacc..fad58df0bf19 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -75,6 +75,7 @@ 
 #include <drm/ttm/ttm_execbuf_util.h>

 #include <drm/drm_gem.h>
+#include <drm/drm_audio_component.h>

 #include "radeon_family.h"
 #include "radeon_mode.h"
@@ -1760,6 +1761,8 @@  struct r600_audio {
        struct radeon_audio_funcs *hdmi_funcs;
        struct radeon_audio_funcs *dp_funcs;
        struct radeon_audio_basic_funcs *funcs;
+       struct drm_audio_component *component;
+       bool component_registered;
 };

 /*
diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c
index 770e31f5fd1b..58e149b7a7a4 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.c
+++ b/drivers/gpu/drm/radeon/radeon_audio.c
@@ -23,6 +23,7 @@ 
  */

 #include <linux/gcd.h>
+#include <linux/component.h>
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 #include "radeon.h"
@@ -248,6 +249,7 @@  static void radeon_audio_enable(struct radeon_device *rdev,
        struct drm_encoder *encoder;
        struct radeon_encoder *radeon_encoder;
        struct radeon_encoder_atom_dig *dig;
+       struct drm_audio_component *acomp = rdev->audio.component;
        int pin_count = 0;

        if (!pin)
@@ -269,6 +271,10 @@  static void radeon_audio_enable(struct radeon_device *rdev,

        if (rdev->audio.funcs->enable)
                rdev->audio.funcs->enable(rdev, pin, enable_mask);
+
+       if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
+               acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
+                                                pin->id, -1);

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Jim: radeon_audio_enable() can enable audios and also disable them, so eld noitfy callback should be called when enable_mask is true.