提交 4999b021 编写于 作者: T Takashi Iwai 提交者: Mark Brown

ASoC: rt5645: Add quirk override by module option

For making the development easier, add quirk module option to override
the platform data setup.  For example, a platform with inverted jack
detection with jd_mode=2, pass the value 0x21 (0x1 = inv_jd1_1, 0x20 =
jd_mode=2).  It overrides the whole pdata fields, so pass it
carefully.
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
Tested-by: NJames Cameron <quozl@laptop.org>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 105e56f1
...@@ -34,6 +34,17 @@ ...@@ -34,6 +34,17 @@
#include "rl6231.h" #include "rl6231.h"
#include "rt5645.h" #include "rt5645.h"
#define QUIRK_INV_JD1_1(q) ((q) & 1)
#define QUIRK_LEVEL_IRQ(q) (((q) >> 1) & 1)
#define QUIRK_IN2_DIFF(q) (((q) >> 2) & 1)
#define QUIRK_JD_MODE(q) (((q) >> 4) & 7)
#define QUIRK_DMIC1_DATA_PIN(q) (((q) >> 8) & 3)
#define QUIRK_DMIC2_DATA_PIN(q) (((q) >> 12) & 3)
static unsigned int quirk = -1;
module_param(quirk, uint, 0444);
MODULE_PARM_DESC(quirk, "RT5645 pdata quirk override");
#define RT5645_DEVICE_ID 0x6308 #define RT5645_DEVICE_ID 0x6308
#define RT5650_DEVICE_ID 0x6419 #define RT5650_DEVICE_ID 0x6419
...@@ -3679,6 +3690,15 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, ...@@ -3679,6 +3690,15 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
else if (dmi_check_system(dmi_platform_gpd_win)) else if (dmi_check_system(dmi_platform_gpd_win))
rt5645->pdata = gpd_win_platform_data; rt5645->pdata = gpd_win_platform_data;
if (quirk != -1) {
rt5645->pdata.in2_diff = QUIRK_IN2_DIFF(quirk);
rt5645->pdata.level_trigger_irq = QUIRK_LEVEL_IRQ(quirk);
rt5645->pdata.inv_jd1_1 = QUIRK_INV_JD1_1(quirk);
rt5645->pdata.jd_mode = QUIRK_JD_MODE(quirk);
rt5645->pdata.dmic1_data_pin = QUIRK_DMIC1_DATA_PIN(quirk);
rt5645->pdata.dmic2_data_pin = QUIRK_DMIC2_DATA_PIN(quirk);
}
rt5645->gpiod_hp_det = devm_gpiod_get_optional(&i2c->dev, "hp-detect", rt5645->gpiod_hp_det = devm_gpiod_get_optional(&i2c->dev, "hp-detect",
GPIOD_IN); GPIOD_IN);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册