summaryrefslogtreecommitdiff
path: root/sound/hda
diff options
context:
space:
mode:
Diffstat (limited to 'sound/hda')
-rw-r--r--sound/hda/hdac_device.c23
-rw-r--r--sound/hda/hdac_regmap.c8
2 files changed, 31 insertions, 0 deletions
diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index 0dac746df7da..72c584eb011b 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -273,6 +273,29 @@ int snd_hdac_read_parm_uncached(struct hdac_device *codec, hda_nid_t nid,
EXPORT_SYMBOL_GPL(snd_hdac_read_parm_uncached);
/**
+ * snd_hdac_override_parm - override read-only parameters
+ * @codec: the codec object
+ * @nid: NID for the parameter
+ * @parm: the parameter to change
+ * @val: the parameter value to overwrite
+ */
+int snd_hdac_override_parm(struct hdac_device *codec, hda_nid_t nid,
+ unsigned int parm, unsigned int val)
+{
+ unsigned int verb = (AC_VERB_PARAMETERS << 8) | (nid << 20) | parm;
+ int err;
+
+ if (!codec->regmap)
+ return -EINVAL;
+
+ codec->caps_overwriting = true;
+ err = snd_hdac_regmap_write_raw(codec, verb, val);
+ codec->caps_overwriting = false;
+ return err;
+}
+EXPORT_SYMBOL_GPL(snd_hdac_override_parm);
+
+/**
* snd_hdac_get_sub_nodes - get start NID and number of subtree nodes
* @codec: the codec object
* @nid: NID to inspect
diff --git a/sound/hda/hdac_regmap.c b/sound/hda/hdac_regmap.c
index db03d60d9c99..933907b16457 100644
--- a/sound/hda/hdac_regmap.c
+++ b/sound/hda/hdac_regmap.c
@@ -58,8 +58,12 @@ static bool hda_volatile_reg(struct device *dev, unsigned int reg)
static bool hda_writeable_reg(struct device *dev, unsigned int reg)
{
+ struct hdac_device *codec = dev_to_hdac_dev(dev);
unsigned int verb = get_verb(reg);
+ if (codec->caps_overwriting)
+ return true;
+
switch (verb & 0xf00) {
case AC_VERB_GET_STREAM_FORMAT:
case AC_VERB_GET_AMP_GAIN_MUTE:
@@ -97,8 +101,12 @@ static bool hda_writeable_reg(struct device *dev, unsigned int reg)
static bool hda_readable_reg(struct device *dev, unsigned int reg)
{
+ struct hdac_device *codec = dev_to_hdac_dev(dev);
unsigned int verb = get_verb(reg);
+ if (codec->caps_overwriting)
+ return true;
+
switch (verb) {
case AC_VERB_PARAMETERS:
case AC_VERB_GET_CONNECT_LIST: