ASoC: rt721-sdca: Adjust blindwrite flow to fix type detection issue
Subsystems (3)
PATCH v2 1/1 ASoC: rt721-sdca: Adjust blindwrite flow to fix type detection issue
From: Jack Yu <[email protected]>
Original blindwrite flow fail to support nokia type detection, but it's works normally in iphone type detection.
We adjust the register settings to support both type detection.
--- sound/soc/codecs/rt721-sdca-sdw.c | 40 +++- sound/soc/codecs/rt721-sdca-sdw.h | 7 + sound/soc/codecs/rt721-sdca.c | 359 +++++++++++++++++++++++++++--- sound/soc/codecs/rt721-sdca.h | 27 +++ 4 files changed, 390 insertions(+), 43 deletions(-)
sound/soc/codecs/rt721-sdca-sdw.c +34 -6
@@ -76,9 +76,16 @@ static bool rt721_sdca_mbq_readable_register(struct device *dev, unsigned int re {switch (reg) { case 0x0900004 ... 0x0900009: +case 0x0910000 : +case 0x0910001 : +case 0x0910002 : +case 0x0910003 : +case 0x0910202 :case 0x0a00005 :case 0x0c00005 :case 0x0d00014 : +case 0x0f00004 : +case 0x0f00005 :case 0x0310100 : case 0x2000000 ... 0x2000003:case 0x2000013 :
@@ -87,18 +94,25 @@ static bool rt721_sdca_mbq_readable_register(struct device *dev, unsigned int recase 0x200003c :case 0x2000046 :case 0x5810000 : +case 0x5810033 :case 0x5810036 :case 0x5810037 :case 0x5810038 :case 0x5810039 : +case 0x581003a : +case 0x581003b :case 0x5810100 : -case 0x5b10018 : -case 0x5b10019 : + case 0x5b10000 ... 0x5b10026: + case 0x5b10100 ... 0x5b10103: +case 0x5f00010 : +case 0x5f00043 :case 0x5f00045 :case 0x5f00048 :case 0x6100000 : +case 0x6100002 :case 0x6100005 :case 0x6100006 : +case 0x6100007 :case 0x610000d :case 0x6100010 :case 0x6100011 :
@@ -152,6 +166,7 @@ static bool rt721_sdca_mbq_volatile_register(struct device *dev, unsigned int recase 0x0a00005 :case 0x0c00005 :case 0x0d00014 : +case 0x0f00004 :case 0x2000000 :case 0x200000d :case 0x2000019 :
@@ -168,9 +183,11 @@ static bool rt721_sdca_mbq_volatile_register(struct device *dev, unsigned int recase 0x5810037 :case 0x5810038 :case 0x5810039 : +case 0x581003a : +case 0x581003b :case 0x5810100 : -case 0x5b10018 : -case 0x5b10019 : + case 0x5b10000 ... 0x5b10016: + case 0x5b10018 ... 0x5b10026:case 0x6100006 :return true;default :
@@ -318,6 +335,11 @@ static int rt721_sdca_interrupt_callback(struct sdw_slave *slave,int count =0 , retry =3 ;unsigned int sdca_cascade, scp_sdca_stat1, scp_sdca_stat2 =0 ; +if (rt721->imp_sensing_ongoing && rt721->wf_id ==RT721_S ) +dev_info (&slave->dev, +"%s: IRQ arrived DURING impedance sensing\n" , + __func__); +if (cancel_delayed_work_sync (&rt721->jack_detect_work)) {dev_warn (&slave->dev,"%s the pending delayed_work was cancelled" , __func__);/* avoid the HID owner doesn't change to device */
@@ -395,9 +417,15 @@ static int rt721_sdca_interrupt_callback(struct sdw_slave *slave, ret =sdw_read_no_pm (rt721->slave,SDW_SCP_SDCA_INT1 ); ret =sdw_read_no_pm (rt721->slave,SDW_SCP_SDCA_INT2 ); -if (status->sdca_cascade && !rt721->disable_irq) +if (status->sdca_cascade && !rt721->disable_irq) { +unsigned int delay_ms =280 ; + +if (rt721->imp_sensing_ongoing && rt721->wf_id ==RT721_S ) + delay_ms =800 ; +mod_delayed_work (system_power_efficient_wq, - &rt721->jack_detect_work,msecs_to_jiffies (280 )); + &rt721->jack_detect_work,msecs_to_jiffies (delay_ms)); + }mutex_unlock (&rt721->disable_irq_lock);
sound/soc/codecs/rt721-sdca-sdw.h +7 -0
@@ -80,18 +80,25 @@ static const struct reg_default rt721_sdca_reg_defaults[] = { };static const struct reg_default rt721_sdca_mbq_defaults[] = { + {0x0900006 ,0xe000 }, {0x0900007 ,0xc004 }, + {0x0910000 ,0x00a1 }, + {0x0910001 ,0x1256 }, + {0x0910002 ,0x0000 }, + {0x0910003 ,0x0000 }, {0x2000001 ,0x0000 }, {0x2000002 ,0x0000 }, {0x2000003 ,0x0000 }, {0x2000013 ,0x8001 }, {0x200003c ,0x0000 }, {0x2000046 ,0x3400 }, + {0x5b10017 ,0x1b07 }, {0x5f00044 ,0x6040 }, {0x5f00045 ,0x3333 }, {0x5f00048 ,0x0000 }, {0x6100005 ,0x0005 }, {0x6100006 ,0x0000 }, + {0x6100007 ,0x0007 }, {0x610000d ,0x0051 }, {0x6100010 ,0x0180 }, {0x6100011 ,0x0000 },
sound/soc/codecs/rt721-sdca.c +322 -37
441 lines not on this page · raw message
sound/soc/codecs/rt721-sdca.h +27 -0
@@ -29,6 +29,10 @@ struct rt721_sdca_priv {/* For Headset jack & Headphone */ unsigned int scp_sdca_stat1;unsigned int scp_sdca_stat2; +unsigned int int_cnt; +bool imp_sensing_ongoing; +bool imp_sensing_done; +int last_real_JD;struct snd_soc_jack *hs_jack;struct delayed_work jack_detect_work;struct delayed_work jack_btn_check_work;
@@ -54,8 +58,10 @@ struct rt721_sdca_dmic_kctrl_priv {/* NID */ #define RT721_ANA_POW_PART 0x01#define RT721_DAC_CTRL 0x04 +#define RT721_MIC_BIAS_CTRL 0x08#define RT721_JD_CTRL 0x09#define RT721_CBJ_CTRL 0x0a +#define RT721_CHARGE_PUMP_CTRL 0x0b#define RT721_CAP_PORT_CTRL 0x0c#define RT721_CLASD_AMP_CTRL 0x0d#define RT721_BOOST_CTRL 0x0f
@@ -81,17 +87,28 @@ struct rt721_sdca_dmic_kctrl_priv {#define RT721_DAC_2CH_CTRL3 0x02#define RT721_DAC_2CH_CTRL4 0x03 +/* Index (NID:08h) */ +#define RT721_MIC_BIAS_TOP_CTRL2 0x02 +/* Index (NID:09h) */ +#define RT721_JD_1PIN_TOP_CTRL3 0x04 +#define RT721_JD_1PIN_GAT_CTRL1 0x06#define RT721_JD_1PIN_GAT_CTRL2 0x07 +#define RT721_JD_1PIN_GAT_STA1 0x09/* Index (NID:0ah) */ #define RT721_CBJ_A0_GAT_CTRL1 0x04#define RT721_CBJ_A0_GAT_CTRL2 0x05 +/* Index (NID:0bh) */ +#define RT721_CHGPMP_GAT_CTRL1 0x01 +/* Index (NID:0Ch) */ #define RT721_HP_AMP_2CH_CAL1 0x05 +#define RT721_HP_AMP_2CH_CAL2 0x06#define RT721_HP_AMP_2CH_CAL4 0x08#define RT721_HP_AMP_2CH_CAL18 0x1b +#define RT721_HP_AMP_2CH_CAL27 0x24/* Index (NID:0dh) */ #define RT721_CLASD_AMP_2CH_CAL 0x14
@@ -129,10 +146,13 @@ struct rt721_sdca_dmic_kctrl_priv {/* Index (NID:5fh) */ #define RT721_MISC_POWER_CTL0 0x00 +#define RT721_MISC_POWER_CTL10 0x10#define RT721_MISC_POWER_CTL31 0x31 +#define RT721_UAJ_TOP_TCON12 0x43#define RT721_UAJ_TOP_TCON13 0x44#define RT721_UAJ_TOP_TCON14 0x45#define RT721_UAJ_TOP_TCON17 0x48 +#define RT721_UAJ_TOP_TCON_ANY 0x70/* Index (NID:61h) */ #define RT721_HDA_LEGACY_MUX_CTL0 0x00
@@ -181,6 +201,13 @@ struct rt721_sdca_dmic_kctrl_priv {#define RT721_BUF_ADDR_HID1 0x44030000#define RT721_BUF_ADDR_HID2 0x44030020 +/* Impedance Sensing Control */ +#define RT721_IMP_SEN_CTRL11 0x5b10017 +#define RT721_IMP_SEN_CTRL13 0x5b1001b + +/* ADC Bias Control 3 */ +#define RT721_ADC_BIAS_CTRL3 0x0910202 +/* RT721 SDCA Control - function number */ #define FUNC_NUM_JACK_CODEC 0x01#define FUNC_NUM_MIC_ARRAY 0x02
Signature · 1 line
2.55.0
Mark Brown
maintainerQuoted 1 line · On Thu, 01 Oct 2026 10:46:57 +0800, [email protected] wrote:
ASoC: rt721-sdca: Adjust blindwrite flow to fix type detection issue
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4
Thanks!
[1/1] ASoC: rt721-sdca: Adjust blindwrite flow to fix type detection issue
https://git.kernel.org/broonie/sound/c/e2eb4873b901
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark