if (beep->enabled)
generate_tone(beep, beep->tone);
}
/* (non-standard) Linear beep tone calculation for IDT/STAC codecs * * The tone frequency of beep generator on IDT/STAC codecs is * defined from the 8bit tone parameter, in Hz, * freq = 48000 * (257 - tone) / 1024 * that is from 12kHz to 93.75Hz in steps of 46.875 Hz
*/ staticint beep_linear_tone(struct hda_beep *beep, int hz)
{ if (hz <= 0) return 0;
hz *= 1000; /* fixed point */
hz = hz - DIGBEEP_HZ_MIN
+ DIGBEEP_HZ_STEP / 2; /* round to nearest step */ if (hz < 0)
hz = 0; /* turn off PC beep*/ elseif (hz >= (DIGBEEP_HZ_MAX - DIGBEEP_HZ_MIN))
hz = 1; /* max frequency */ else {
hz /= DIGBEEP_HZ_STEP;
hz = 255 - hz;
} return hz;
}
/* HD-audio standard beep tone parameter calculation * * The tone frequency in Hz is calculated as * freq = 48000 / (tone * 4) * from 47Hz to 12kHz
*/ staticint beep_standard_tone(struct hda_beep *beep, int hz)
{ if (hz <= 0) return 0; /* disabled */
hz = 12000 / hz; if (hz > 0xff) return 0xff; if (hz <= 0) return 1; return hz;
}
/** * snd_hda_attach_beep_device - Attach a beep input device * @codec: the HDA codec * @nid: beep NID * * Attach a beep object to the given widget. If beep hint is turned off * explicitly or beep_mode of the codec is turned off, this doesn't nothing. * * Currently, only one beep device is allowed to each codec.
*/ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
{ staticconststruct snd_device_ops ops = {
.dev_register = beep_dev_register,
.dev_disconnect = beep_dev_disconnect,
.dev_free = beep_dev_free,
}; struct input_dev *input_dev; struct hda_beep *beep; int err;
if (!codec->beep_just_power_on) { if (!snd_hda_get_bool_hint(codec, "beep")) return 0; /* disabled explicitly by hints */ if (codec->beep_mode == HDA_BEEP_MODE_OFF) return 0; /* disabled by module option */
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.