UPSTREAM: ASoC: rt5645: Add the HWEQ for the speaker output

The patch adds the HWEQ function for the speaker output. User can set the
HWEQ parameters using the ALSA binary control byte-by-byte. We use the
following struct array to store the HWEQ parameters for implementing as
simple as possible.
struct rt5645_eq_param_s {
	unsigned short reg;
	unsigned short val;
};
It supports the variant length of the HWEQ parameters that are required.
We add the validating function in the function "rt5645_hweq_put" of the
ALSA binary control to avoid the user that puts the invalid parameters.
In the HWEQ enable function of speaker event, we also add the validating
function to prevent that the invalid parameters are applied to codec.
The HWEQ parameters should be controlled by DAPM for a specific sequence,
so the parameters will be applied to the codec in the speaker power up
event of DAPM, and will be disabled in the speaker power down event of
DAPM.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit be77b38a3668306bdc0b0c8dff4660c2a8b38d8e)

BUG=chrome-os-partner:44835
TEST=With subsequent CL, Measure speaker power.
     Verify power is under its limit.

Change-Id: I93db0b5d8f118bbd096d6592bed864b9c2215af1
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/308589
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
(cherry picked from commit d922d1912fd8f41015178fbdb15acbbd4998be1f)
Reviewed-on: https://chromium-review.googlesource.com/310217
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
1 file changed