aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2013-02-19 10:11:26 -0500
committerTakashi Iwai <tiwai@suse.de>2013-02-19 12:28:38 -0500
commit92c69e796b83f922c81a5cf7968cb114a7fa14c6 (patch)
tree1a6612d2e6e27d5e588b67dfbc70d76446dd2e4c /sound
parent4bd038f9d80216a6e95c5c36fae5054a83ea75d7 (diff)
ALSA: hda - hdmi: Notify userspace when ELD control changes
ELD validity can change during the lifetime of a presence detect, so we need to be able to listen for changes on the ELD control. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_hdmi.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index e77735d804a3..21425fb51fe0 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -75,6 +75,7 @@ struct hdmi_spec_per_pin {
75 struct hda_codec *codec; 75 struct hda_codec *codec;
76 struct hdmi_eld sink_eld; 76 struct hdmi_eld sink_eld;
77 struct delayed_work work; 77 struct delayed_work work;
78 struct snd_kcontrol *eld_ctl;
78 int repoll_count; 79 int repoll_count;
79 bool non_pcm; 80 bool non_pcm;
80 bool chmap_set; /* channel-map override by ALSA API? */ 81 bool chmap_set; /* channel-map override by ALSA API? */
@@ -413,6 +414,7 @@ static int hdmi_create_eld_ctl(struct hda_codec *codec, int pin_idx,
413 if (err < 0) 414 if (err < 0)
414 return err; 415 return err;
415 416
417 spec->pins[pin_idx].eld_ctl = kctl;
416 return 0; 418 return 0;
417} 419}
418 420
@@ -1220,11 +1222,14 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
1220 } 1222 }
1221 1223
1222 mutex_lock(&pin_eld->lock); 1224 mutex_lock(&pin_eld->lock);
1223 if (pin_eld->eld_valid && !eld->eld_valid) 1225 if (pin_eld->eld_valid && !eld->eld_valid) {
1224 update_eld = true; 1226 update_eld = true;
1227 eld_changed = true;
1228 }
1225 if (update_eld) { 1229 if (update_eld) {
1226 pin_eld->eld_valid = eld->eld_valid; 1230 pin_eld->eld_valid = eld->eld_valid;
1227 eld_changed = memcmp(pin_eld->eld_buffer, eld->eld_buffer, 1231 eld_changed = pin_eld->eld_size != eld->eld_size ||
1232 memcmp(pin_eld->eld_buffer, eld->eld_buffer,
1228 eld->eld_size) != 0; 1233 eld->eld_size) != 0;
1229 if (eld_changed) 1234 if (eld_changed)
1230 memcpy(pin_eld->eld_buffer, eld->eld_buffer, 1235 memcpy(pin_eld->eld_buffer, eld->eld_buffer,
@@ -1233,6 +1238,11 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
1233 pin_eld->info = eld->info; 1238 pin_eld->info = eld->info;
1234 } 1239 }
1235 mutex_unlock(&pin_eld->lock); 1240 mutex_unlock(&pin_eld->lock);
1241
1242 if (eld_changed)
1243 snd_ctl_notify(codec->bus->card,
1244 SNDRV_CTL_EVENT_MASK_VALUE | SNDRV_CTL_EVENT_MASK_INFO,
1245 &per_pin->eld_ctl->id);
1236} 1246}
1237 1247
1238static void hdmi_repoll_eld(struct work_struct *work) 1248static void hdmi_repoll_eld(struct work_struct *work)