Loading include/sound/hdaudio.h +4 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ struct hdac_device { /* misc flags */ atomic_t in_pm; /* suspend/resume being performed */ bool link_power_control:1; /* sysfs */ struct hdac_widget_tree *widgets; Loading Loading @@ -184,6 +185,8 @@ struct hdac_bus_ops { /* get a response from the last command */ int (*get_response)(struct hdac_bus *bus, unsigned int addr, unsigned int *res); /* control the link power */ int (*link_power)(struct hdac_bus *bus, bool enable); }; /* Loading Loading @@ -311,6 +314,7 @@ static inline void snd_hdac_codec_link_down(struct hdac_device *codec) int snd_hdac_bus_send_cmd(struct hdac_bus *bus, unsigned int val); int snd_hdac_bus_get_response(struct hdac_bus *bus, unsigned int addr, unsigned int *res); int snd_hdac_link_power(struct hdac_device *codec, bool enable); bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset); void snd_hdac_bus_stop_chip(struct hdac_bus *bus); Loading sound/hda/hdac_device.c +15 −0 Original line number Diff line number Diff line Loading @@ -552,6 +552,21 @@ void snd_hdac_power_down_pm(struct hdac_device *codec) EXPORT_SYMBOL_GPL(snd_hdac_power_down_pm); #endif /* * Enable/disable the link power for a codec. */ int snd_hdac_link_power(struct hdac_device *codec, bool enable) { if (!codec->link_power_control) return 0; if (codec->bus->ops->link_power) return codec->bus->ops->link_power(codec->bus, enable); else return -EINVAL; } EXPORT_SYMBOL_GPL(snd_hdac_link_power); /* codec vendor labels */ struct hda_vendor_id { unsigned int id; Loading sound/pci/hda/hda_codec.c +4 −0 Original line number Diff line number Diff line Loading @@ -858,6 +858,7 @@ void snd_hda_codec_register(struct hda_codec *codec) return; if (device_is_registered(hda_codec_dev(codec))) { snd_hda_register_beep_device(codec); snd_hdac_link_power(&codec->core, true); pm_runtime_enable(hda_codec_dev(codec)); /* it was powered up in snd_hda_codec_new(), now all done */ snd_hda_power_down(codec); Loading @@ -884,6 +885,7 @@ static int snd_hda_codec_dev_free(struct snd_device *device) struct hda_codec *codec = device->device_data; codec->in_freeing = 1; snd_hdac_link_power(&codec->core, false); snd_hdac_device_unregister(&codec->core); put_device(hda_codec_dev(codec)); return 0; Loading Loading @@ -3106,6 +3108,7 @@ static int hda_codec_runtime_suspend(struct device *dev) if (codec_has_clkstop(codec) && codec_has_epss(codec) && (state & AC_PWRST_CLK_STOP_OK)) snd_hdac_codec_link_down(&codec->core); snd_hdac_link_power(&codec->core, false); return 0; } Loading @@ -3113,6 +3116,7 @@ static int hda_codec_runtime_resume(struct device *dev) { struct hda_codec *codec = dev_to_hda_codec(dev); snd_hdac_link_power(&codec->core, true); snd_hdac_codec_link_up(&codec->core); hda_call_codec_resume(codec); pm_runtime_mark_last_busy(dev); Loading sound/pci/hda/hda_controller.c +11 −0 Original line number Diff line number Diff line Loading @@ -775,9 +775,20 @@ static int azx_get_response(struct hdac_bus *bus, unsigned int addr, return azx_rirb_get_response(bus, addr, res); } static int azx_link_power(struct hdac_bus *bus, bool enable) { struct azx *chip = bus_to_azx(bus); if (chip->ops->link_power) return chip->ops->link_power(chip, enable); else return -EINVAL; } static const struct hdac_bus_ops bus_core_ops = { .command = azx_send_cmd, .get_response = azx_get_response, .link_power = azx_link_power, }; #ifdef CONFIG_SND_HDA_DSP_LOADER Loading sound/pci/hda/hda_controller.h +2 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,8 @@ struct hda_controller_ops { struct vm_area_struct *area); /* Check if current position is acceptable */ int (*position_check)(struct azx *chip, struct azx_dev *azx_dev); /* enable/disable the link power */ int (*link_power)(struct azx *chip, bool enable); }; struct azx_pcm { Loading Loading
include/sound/hdaudio.h +4 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ struct hdac_device { /* misc flags */ atomic_t in_pm; /* suspend/resume being performed */ bool link_power_control:1; /* sysfs */ struct hdac_widget_tree *widgets; Loading Loading @@ -184,6 +185,8 @@ struct hdac_bus_ops { /* get a response from the last command */ int (*get_response)(struct hdac_bus *bus, unsigned int addr, unsigned int *res); /* control the link power */ int (*link_power)(struct hdac_bus *bus, bool enable); }; /* Loading Loading @@ -311,6 +314,7 @@ static inline void snd_hdac_codec_link_down(struct hdac_device *codec) int snd_hdac_bus_send_cmd(struct hdac_bus *bus, unsigned int val); int snd_hdac_bus_get_response(struct hdac_bus *bus, unsigned int addr, unsigned int *res); int snd_hdac_link_power(struct hdac_device *codec, bool enable); bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset); void snd_hdac_bus_stop_chip(struct hdac_bus *bus); Loading
sound/hda/hdac_device.c +15 −0 Original line number Diff line number Diff line Loading @@ -552,6 +552,21 @@ void snd_hdac_power_down_pm(struct hdac_device *codec) EXPORT_SYMBOL_GPL(snd_hdac_power_down_pm); #endif /* * Enable/disable the link power for a codec. */ int snd_hdac_link_power(struct hdac_device *codec, bool enable) { if (!codec->link_power_control) return 0; if (codec->bus->ops->link_power) return codec->bus->ops->link_power(codec->bus, enable); else return -EINVAL; } EXPORT_SYMBOL_GPL(snd_hdac_link_power); /* codec vendor labels */ struct hda_vendor_id { unsigned int id; Loading
sound/pci/hda/hda_codec.c +4 −0 Original line number Diff line number Diff line Loading @@ -858,6 +858,7 @@ void snd_hda_codec_register(struct hda_codec *codec) return; if (device_is_registered(hda_codec_dev(codec))) { snd_hda_register_beep_device(codec); snd_hdac_link_power(&codec->core, true); pm_runtime_enable(hda_codec_dev(codec)); /* it was powered up in snd_hda_codec_new(), now all done */ snd_hda_power_down(codec); Loading @@ -884,6 +885,7 @@ static int snd_hda_codec_dev_free(struct snd_device *device) struct hda_codec *codec = device->device_data; codec->in_freeing = 1; snd_hdac_link_power(&codec->core, false); snd_hdac_device_unregister(&codec->core); put_device(hda_codec_dev(codec)); return 0; Loading Loading @@ -3106,6 +3108,7 @@ static int hda_codec_runtime_suspend(struct device *dev) if (codec_has_clkstop(codec) && codec_has_epss(codec) && (state & AC_PWRST_CLK_STOP_OK)) snd_hdac_codec_link_down(&codec->core); snd_hdac_link_power(&codec->core, false); return 0; } Loading @@ -3113,6 +3116,7 @@ static int hda_codec_runtime_resume(struct device *dev) { struct hda_codec *codec = dev_to_hda_codec(dev); snd_hdac_link_power(&codec->core, true); snd_hdac_codec_link_up(&codec->core); hda_call_codec_resume(codec); pm_runtime_mark_last_busy(dev); Loading
sound/pci/hda/hda_controller.c +11 −0 Original line number Diff line number Diff line Loading @@ -775,9 +775,20 @@ static int azx_get_response(struct hdac_bus *bus, unsigned int addr, return azx_rirb_get_response(bus, addr, res); } static int azx_link_power(struct hdac_bus *bus, bool enable) { struct azx *chip = bus_to_azx(bus); if (chip->ops->link_power) return chip->ops->link_power(chip, enable); else return -EINVAL; } static const struct hdac_bus_ops bus_core_ops = { .command = azx_send_cmd, .get_response = azx_get_response, .link_power = azx_link_power, }; #ifdef CONFIG_SND_HDA_DSP_LOADER Loading
sound/pci/hda/hda_controller.h +2 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,8 @@ struct hda_controller_ops { struct vm_area_struct *area); /* Check if current position is acceptable */ int (*position_check)(struct azx *chip, struct azx_dev *azx_dev); /* enable/disable the link power */ int (*link_power)(struct azx *chip, bool enable); }; struct azx_pcm { Loading