|
@@ -4159,43 +4159,47 @@ static void stac92xx_power_down(struct hda_codec *codec)
|
|
|
static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
|
|
|
int enable);
|
|
|
|
|
|
+static inline int get_int_hint(struct hda_codec *codec, const char *key,
|
|
|
+ int *valp)
|
|
|
+{
|
|
|
+ const char *p;
|
|
|
+ p = snd_hda_get_hint(codec, key);
|
|
|
+ if (p) {
|
|
|
+ unsigned long val;
|
|
|
+ if (!strict_strtoul(p, 0, &val)) {
|
|
|
+ *valp = val;
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
/* override some hints from the hwdep entry */
|
|
|
static void stac_store_hints(struct hda_codec *codec)
|
|
|
{
|
|
|
struct sigmatel_spec *spec = codec->spec;
|
|
|
- const char *p;
|
|
|
int val;
|
|
|
|
|
|
val = snd_hda_get_bool_hint(codec, "hp_detect");
|
|
|
if (val >= 0)
|
|
|
spec->hp_detect = val;
|
|
|
- p = snd_hda_get_hint(codec, "gpio_mask");
|
|
|
- if (p) {
|
|
|
- spec->gpio_mask = simple_strtoul(p, NULL, 0);
|
|
|
+ if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) {
|
|
|
spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
|
|
|
spec->gpio_mask;
|
|
|
}
|
|
|
- p = snd_hda_get_hint(codec, "gpio_dir");
|
|
|
- if (p)
|
|
|
- spec->gpio_dir = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
|
|
|
- p = snd_hda_get_hint(codec, "gpio_data");
|
|
|
- if (p)
|
|
|
- spec->gpio_data = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
|
|
|
- p = snd_hda_get_hint(codec, "eapd_mask");
|
|
|
- if (p)
|
|
|
- spec->eapd_mask = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
|
|
|
- p = snd_hda_get_hint(codec, "gpio_mute");
|
|
|
- if (p)
|
|
|
- spec->gpio_mute = simple_strtoul(p, NULL, 0) & spec->gpio_mask;
|
|
|
+ if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir))
|
|
|
+ spec->gpio_mask &= spec->gpio_mask;
|
|
|
+ if (get_int_hint(codec, "gpio_data", &spec->gpio_data))
|
|
|
+ spec->gpio_dir &= spec->gpio_mask;
|
|
|
+ if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask))
|
|
|
+ spec->eapd_mask &= spec->gpio_mask;
|
|
|
+ if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute))
|
|
|
+ spec->gpio_mute &= spec->gpio_mask;
|
|
|
val = snd_hda_get_bool_hint(codec, "eapd_switch");
|
|
|
if (val >= 0)
|
|
|
spec->eapd_switch = val;
|
|
|
- p = snd_hda_get_hint(codec, "gpio_led_polarity");
|
|
|
- if (p)
|
|
|
- spec->gpio_led_polarity = simple_strtoul(p, NULL, 0);
|
|
|
- p = snd_hda_get_hint(codec, "gpio_led");
|
|
|
- if (p) {
|
|
|
- spec->gpio_led = simple_strtoul(p, NULL, 0);
|
|
|
+ get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity);
|
|
|
+ if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) {
|
|
|
spec->gpio_mask |= spec->gpio_led;
|
|
|
spec->gpio_dir |= spec->gpio_led;
|
|
|
if (spec->gpio_led_polarity)
|