Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' into for-next

Signed-off-by: Takashi Iwai <tiwai@suse.de>

+87 -30
+3
sound/hda/codecs/realtek/alc269.c
··· 3190 3190 }; 3191 3191 struct alc_spec *spec = codec->spec; 3192 3192 3193 + /* Support Audio mute LED and Mic mute LED on keyboard */ 3194 + hda_fixup_ideapad_acpi(codec, fix, action); 3195 + 3193 3196 switch (action) { 3194 3197 case HDA_FIXUP_ACT_PRE_PROBE: 3195 3198 snd_hda_apply_pincfgs(codec, pincfgs);
+84 -30
sound/hda/codecs/side-codecs/cs35l56_hda.c
··· 872 872 return 0; 873 873 } 874 874 875 + static int cs35l56_hda_fixup_yoga9(struct cs35l56_hda *cs35l56, int *bus_addr) 876 + { 877 + /* The cirrus,dev-index property has the wrong values */ 878 + switch (*bus_addr) { 879 + case 0x30: 880 + cs35l56->index = 1; 881 + return 0; 882 + case 0x31: 883 + cs35l56->index = 0; 884 + return 0; 885 + default: 886 + /* There is a pseudo-address for broadcast to both amps - ignore it */ 887 + dev_dbg(cs35l56->base.dev, "Ignoring I2C address %#x\n", *bus_addr); 888 + return 0; 889 + } 890 + } 891 + 892 + static const struct { 893 + const char *sub; 894 + int (*fixup_fn)(struct cs35l56_hda *cs35l56, int *bus_addr); 895 + } cs35l56_hda_fixups[] = { 896 + { 897 + .sub = "17AA390B", /* Lenovo Yoga Book 9i GenX */ 898 + .fixup_fn = cs35l56_hda_fixup_yoga9, 899 + }, 900 + }; 901 + 902 + static int cs35l56_hda_apply_platform_fixups(struct cs35l56_hda *cs35l56, const char *sub, 903 + int *bus_addr) 904 + { 905 + int i; 906 + 907 + if (IS_ERR(sub)) 908 + return 0; 909 + 910 + for (i = 0; i < ARRAY_SIZE(cs35l56_hda_fixups); i++) { 911 + if (strcasecmp(cs35l56_hda_fixups[i].sub, sub) == 0) { 912 + dev_dbg(cs35l56->base.dev, "Applying fixup for %s\n", 913 + cs35l56_hda_fixups[i].sub); 914 + return (cs35l56_hda_fixups[i].fixup_fn)(cs35l56, bus_addr); 915 + } 916 + } 917 + 918 + return 0; 919 + } 920 + 875 921 static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int hid, int id) 876 922 { 877 923 u32 values[HDA_MAX_COMPONENTS]; ··· 942 896 ACPI_COMPANION_SET(cs35l56->base.dev, adev); 943 897 } 944 898 945 - property = "cirrus,dev-index"; 946 - ret = device_property_count_u32(cs35l56->base.dev, property); 947 - if (ret <= 0) 948 - goto err; 949 - 950 - if (ret > ARRAY_SIZE(values)) { 951 - ret = -EINVAL; 952 - goto err; 953 - } 954 - nval = ret; 955 - 956 - ret = device_property_read_u32_array(cs35l56->base.dev, property, values, nval); 957 - if (ret) 958 - goto err; 959 - 899 + /* Initialize things that could be overwritten by a fixup */ 960 900 cs35l56->index = -1; 961 - for (i = 0; i < nval; i++) { 962 - if (values[i] == id) { 963 - cs35l56->index = i; 964 - break; 965 - } 966 - } 967 - /* 968 - * It's not an error for the ID to be missing: for I2C there can be 969 - * an alias address that is not a real device. So reject silently. 970 - */ 971 - if (cs35l56->index == -1) { 972 - dev_dbg(cs35l56->base.dev, "No index found in %s\n", property); 973 - ret = -ENODEV; 974 - goto err; 975 - } 976 901 977 902 sub = acpi_get_subsystem_id(ACPI_HANDLE(cs35l56->base.dev)); 903 + ret = cs35l56_hda_apply_platform_fixups(cs35l56, sub, &id); 904 + if (ret) 905 + return ret; 906 + 907 + if (cs35l56->index == -1) { 908 + property = "cirrus,dev-index"; 909 + ret = device_property_count_u32(cs35l56->base.dev, property); 910 + if (ret <= 0) 911 + goto err; 912 + 913 + if (ret > ARRAY_SIZE(values)) { 914 + ret = -EINVAL; 915 + goto err; 916 + } 917 + nval = ret; 918 + 919 + ret = device_property_read_u32_array(cs35l56->base.dev, property, values, nval); 920 + if (ret) 921 + goto err; 922 + 923 + for (i = 0; i < nval; i++) { 924 + if (values[i] == id) { 925 + cs35l56->index = i; 926 + break; 927 + } 928 + } 929 + 930 + /* 931 + * It's not an error for the ID to be missing: for I2C there can be 932 + * an alias address that is not a real device. So reject silently. 933 + */ 934 + if (cs35l56->index == -1) { 935 + dev_dbg(cs35l56->base.dev, "No index found in %s\n", property); 936 + ret = -ENODEV; 937 + goto err; 938 + } 939 + } 978 940 979 941 if (IS_ERR(sub)) { 980 942 dev_info(cs35l56->base.dev,