Loading Documentation/devicetree/bindings/sound/rt5651.txt +17 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,23 @@ Optional properties: - realtek,dmic-en Boolean. true if dmic is used. - realtek,jack-detect-source u32. Valid values: 1: Use JD1_1 pin for jack-dectect 2: Use JD1_2 pin for jack-dectect 3: Use JD2 pin for jack-dectect - realtek,over-current-threshold-microamp u32, micbias over-current detection threshold in µA, valid values are 600, 1500 and 2000µA. - realtek,over-current-scale-factor u32, micbias over-current detection scale-factor, valid values are: 0: Scale current by 0.5 1: Scale current by 0.75 2: Scale current by 1.0 3: Scale current by 1.5 Pins on the device (for linking into audio routes) for RT5651: * DMIC L1 Loading arch/x86/include/asm/platform_sst_audio.h +1 −0 Original line number Diff line number Diff line Loading @@ -135,6 +135,7 @@ struct sst_platform_info { const struct sst_res_info *res_info; const struct sst_lib_dnld_info *lib_info; const char *platform; bool streams_lost_on_suspend; }; int add_sst_platform_device(void); #endif Loading include/sound/hdaudio.h +2 −0 Original line number Diff line number Diff line Loading @@ -146,6 +146,8 @@ int snd_hdac_codec_write(struct hdac_device *hdac, hda_nid_t nid, int flags, unsigned int verb, unsigned int parm); bool snd_hdac_check_power_state(struct hdac_device *hdac, hda_nid_t nid, unsigned int target_state); unsigned int snd_hdac_sync_power_state(struct hdac_device *hdac, hda_nid_t nid, unsigned int target_state); /** * snd_hdac_read_parm - read a codec parameter * @codec: the codec object Loading include/sound/rt5651.h +13 −6 Original line number Diff line number Diff line Loading @@ -11,6 +11,10 @@ #ifndef __LINUX_SND_RT5651_H #define __LINUX_SND_RT5651_H /* * Note these MUST match the values from the DT binding: * Documentation/devicetree/bindings/sound/rt5651.txt */ enum rt5651_jd_src { RT5651_JD_NULL, RT5651_JD1_1, Loading @@ -18,12 +22,15 @@ enum rt5651_jd_src { RT5651_JD2, }; struct rt5651_platform_data { /* IN2 can optionally be differential */ bool in2_diff; bool dmic_en; enum rt5651_jd_src jd_src; /* * Note these MUST match the values from the DT binding: * Documentation/devicetree/bindings/sound/rt5651.txt */ enum rt5651_ovcd_sf { RT5651_OVCD_SF_0P5, RT5651_OVCD_SF_0P75, RT5651_OVCD_SF_1P0, RT5651_OVCD_SF_1P5, }; #endif sound/hda/hdac_device.c +35 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ */ #include <linux/init.h> #include <linux/delay.h> #include <linux/device.h> #include <linux/slab.h> #include <linux/module.h> Loading Loading @@ -1064,3 +1065,37 @@ bool snd_hdac_check_power_state(struct hdac_device *hdac, return (state == target_state); } EXPORT_SYMBOL_GPL(snd_hdac_check_power_state); /** * snd_hdac_sync_power_state - wait until actual power state matches * with the target state * * @hdac: the HDAC device * @nid: NID to send the command * @target_state: target state to check for * * Return power state or PS_ERROR if codec rejects GET verb. */ unsigned int snd_hdac_sync_power_state(struct hdac_device *codec, hda_nid_t nid, unsigned int power_state) { unsigned long end_time = jiffies + msecs_to_jiffies(500); unsigned int state, actual_state, count; for (count = 0; count < 500; count++) { state = snd_hdac_codec_read(codec, nid, 0, AC_VERB_GET_POWER_STATE, 0); if (state & AC_PWRST_ERROR) { msleep(20); break; } actual_state = (state >> 4) & 0x0f; if (actual_state == power_state) break; if (time_after_eq(jiffies, end_time)) break; /* wait until the codec reachs to the target state */ msleep(1); } return state; } EXPORT_SYMBOL_GPL(snd_hdac_sync_power_state); Loading
Documentation/devicetree/bindings/sound/rt5651.txt +17 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,23 @@ Optional properties: - realtek,dmic-en Boolean. true if dmic is used. - realtek,jack-detect-source u32. Valid values: 1: Use JD1_1 pin for jack-dectect 2: Use JD1_2 pin for jack-dectect 3: Use JD2 pin for jack-dectect - realtek,over-current-threshold-microamp u32, micbias over-current detection threshold in µA, valid values are 600, 1500 and 2000µA. - realtek,over-current-scale-factor u32, micbias over-current detection scale-factor, valid values are: 0: Scale current by 0.5 1: Scale current by 0.75 2: Scale current by 1.0 3: Scale current by 1.5 Pins on the device (for linking into audio routes) for RT5651: * DMIC L1 Loading
arch/x86/include/asm/platform_sst_audio.h +1 −0 Original line number Diff line number Diff line Loading @@ -135,6 +135,7 @@ struct sst_platform_info { const struct sst_res_info *res_info; const struct sst_lib_dnld_info *lib_info; const char *platform; bool streams_lost_on_suspend; }; int add_sst_platform_device(void); #endif Loading
include/sound/hdaudio.h +2 −0 Original line number Diff line number Diff line Loading @@ -146,6 +146,8 @@ int snd_hdac_codec_write(struct hdac_device *hdac, hda_nid_t nid, int flags, unsigned int verb, unsigned int parm); bool snd_hdac_check_power_state(struct hdac_device *hdac, hda_nid_t nid, unsigned int target_state); unsigned int snd_hdac_sync_power_state(struct hdac_device *hdac, hda_nid_t nid, unsigned int target_state); /** * snd_hdac_read_parm - read a codec parameter * @codec: the codec object Loading
include/sound/rt5651.h +13 −6 Original line number Diff line number Diff line Loading @@ -11,6 +11,10 @@ #ifndef __LINUX_SND_RT5651_H #define __LINUX_SND_RT5651_H /* * Note these MUST match the values from the DT binding: * Documentation/devicetree/bindings/sound/rt5651.txt */ enum rt5651_jd_src { RT5651_JD_NULL, RT5651_JD1_1, Loading @@ -18,12 +22,15 @@ enum rt5651_jd_src { RT5651_JD2, }; struct rt5651_platform_data { /* IN2 can optionally be differential */ bool in2_diff; bool dmic_en; enum rt5651_jd_src jd_src; /* * Note these MUST match the values from the DT binding: * Documentation/devicetree/bindings/sound/rt5651.txt */ enum rt5651_ovcd_sf { RT5651_OVCD_SF_0P5, RT5651_OVCD_SF_0P75, RT5651_OVCD_SF_1P0, RT5651_OVCD_SF_1P5, }; #endif
sound/hda/hdac_device.c +35 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ */ #include <linux/init.h> #include <linux/delay.h> #include <linux/device.h> #include <linux/slab.h> #include <linux/module.h> Loading Loading @@ -1064,3 +1065,37 @@ bool snd_hdac_check_power_state(struct hdac_device *hdac, return (state == target_state); } EXPORT_SYMBOL_GPL(snd_hdac_check_power_state); /** * snd_hdac_sync_power_state - wait until actual power state matches * with the target state * * @hdac: the HDAC device * @nid: NID to send the command * @target_state: target state to check for * * Return power state or PS_ERROR if codec rejects GET verb. */ unsigned int snd_hdac_sync_power_state(struct hdac_device *codec, hda_nid_t nid, unsigned int power_state) { unsigned long end_time = jiffies + msecs_to_jiffies(500); unsigned int state, actual_state, count; for (count = 0; count < 500; count++) { state = snd_hdac_codec_read(codec, nid, 0, AC_VERB_GET_POWER_STATE, 0); if (state & AC_PWRST_ERROR) { msleep(20); break; } actual_state = (state >> 4) & 0x0f; if (actual_state == power_state) break; if (time_after_eq(jiffies, end_time)) break; /* wait until the codec reachs to the target state */ msleep(1); } return state; } EXPORT_SYMBOL_GPL(snd_hdac_sync_power_state);