ASoC: rt5645: Fix the electric noise due to the CBJ contacts floating
Subsystems (6)
Sasha Levin
maintainerPATCH 1/9 ASoC: rt5645: Fix the electric noise due to the CBJ contacts floating
From: Derek Fang <[email protected]>
[ Upstream commit 103abab975087e1f01b76fcb54c91dbb65dbc249 ]
The codec leaves tie combo jack's sleeve/ring2 to floating status default. It would cause electric noise while connecting the active speaker jack during boot or shutdown.
This patch requests a gpio to control the additional jack circuit to tie the contacts to the ground or floating.
--- sound/soc/codecs/rt5645.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
sound/soc/codecs/rt5645.c +25 -0
@@ -414,6 +414,7 @@ struct rt5645_priv {struct regmap *regmap;struct i2c_client *i2c;struct gpio_desc *gpiod_hp_det; +struct gpio_desc *gpiod_cbj_sleeve;struct snd_soc_jack *hp_jack;struct snd_soc_jack *mic_jack;struct snd_soc_jack *btn_jack;
@@ -3169,6 +3170,9 @@ static int rt5645_jack_detect(struct snd_soc_component *component, int jack_inseregmap_update_bits (rt5645->regmap,RT5645_IN1_CTRL2 ,RT5645_CBJ_MN_JD ,0 ); +if (rt5645->gpiod_cbj_sleeve) +gpiod_set_value (rt5645->gpiod_cbj_sleeve,1 ); +msleep (600 );regmap_read (rt5645->regmap,RT5645_IN1_CTRL3 , &val); val &=0x7 ;
@@ -3185,6 +3189,8 @@ static int rt5645_jack_detect(struct snd_soc_component *component, int jack_insesnd_soc_dapm_disable_pin (dapm,"Mic Det Power" );snd_soc_dapm_sync (dapm); rt5645->jack_type =SND_JACK_HEADPHONE ; +if (rt5645->gpiod_cbj_sleeve) +gpiod_set_value (rt5645->gpiod_cbj_sleeve,0 ); }if (rt5645->pdata.level_trigger_irq) regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2,
@@ -3210,6 +3216,9 @@ static int rt5645_jack_detect(struct snd_soc_component *component, int jack_inseif (rt5645->pdata.level_trigger_irq)regmap_update_bits (rt5645->regmap,RT5645_IRQ_CTRL2 ,RT5645_JD_1_1_MASK ,RT5645_JD_1_1_INV ); + +if (rt5645->gpiod_cbj_sleeve) +gpiod_set_value (rt5645->gpiod_cbj_sleeve,0 ); }return rt5645->jack_type;
@@ -3882,6 +3891,16 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,return ret; } + rt5645->gpiod_cbj_sleeve =devm_gpiod_get_optional (&i2c->dev,"cbj-sleeve" , +GPIOD_OUT_LOW ); + +if (IS_ERR (rt5645->gpiod_cbj_sleeve)) { + ret =PTR_ERR (rt5645->gpiod_cbj_sleeve); +dev_info (&i2c->dev,"failed to initialize gpiod, ret=%d\n" , ret); +if (ret != -ENOENT ) +return ret; + } +for (i =0 ; i <ARRAY_SIZE (rt5645->supplies); i++) rt5645->supplies[i].supply = rt5645_supply_names[i];
@@ -4125,6 +4144,9 @@ static int rt5645_i2c_remove(struct i2c_client *i2c)cancel_delayed_work_sync (&rt5645->jack_detect_work);cancel_delayed_work_sync (&rt5645->rcclock_work); +if (rt5645->gpiod_cbj_sleeve) +gpiod_set_value (rt5645->gpiod_cbj_sleeve,0 ); +regulator_bulk_disable (ARRAY_SIZE (rt5645->supplies), rt5645->supplies);return 0 ;
@@ -4142,6 +4164,9 @@ static void rt5645_i2c_shutdown(struct i2c_client *i2c) 0);msleep (20 );regmap_write (rt5645->regmap,RT5645_RESET ,0 ); + +if (rt5645->gpiod_cbj_sleeve) +gpiod_set_value (rt5645->gpiod_cbj_sleeve,0 ); }static struct i2c_driver rt5645_i2c_driver = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/9 ASoC: dt-bindings: rt5645: add cbj sleeve gpio property
From: Derek Fang <[email protected]>
[ Upstream commit 306b38e3fa727d22454a148a364123709e356600 ]
Add an optional gpio property to control external CBJ circuits to avoid some electric noise caused by sleeve/ring2 contacts floating.
--- Documentation/devicetree/bindings/sound/rt5645.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/sound/rt5645.txt +6 -0
@@ -20,6 +20,11 @@ Optional properties: a GPIO spec for the external headphone detect pin. If jd-mode = 0, we will get the JD status by getting the value of hp-detect-gpios. +- cbj-sleeve-gpios: + a GPIO spec to control the external combo jack circuit to tie the sleeve/ring2 + contacts to the ground or floating. It could avoid some electric noise from the + active speaker jacks. + - realtek,in2-differential Boolean. Indicate MIC2 input are differential, rather than single-ended.
@@ -68,6 +73,7 @@ codec: rt5650@1a { compatible = "realtek,rt5650"; reg = <0x1a>; hp-detect-gpios = <&gpio 19 0>; + cbj-sleeve-gpios = <&gpio 20 0>; interrupt-parent = <&gpio>; interrupts = <7 IRQ_TYPE_EDGE_FALLING>; realtek,dmic-en = "true";
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/9 regulator: vqmmc-ipq4019: fix module autoloading
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 68adb581a39ae63a0ed082c47f01fbbe515efa0e ]
Add MODULE_DEVICE_TABLE(), so the module could be properly autoloaded based on the alias from of_device_id table.
--- drivers/regulator/vqmmc-ipq4019-regulator.c | 1 + 1 file changed, 1 insertion(+)
drivers/regulator/vqmmc-ipq4019-regulator.c +1 -0
@@ -86,6 +86,7 @@ static const struct of_device_id regulator_ipq4019_of_match[] = { { .compatible = "qcom,vqmmc-ipq4019-regulator", }, {}, }; +MODULE_DEVICE_TABLE (of, regulator_ipq4019_of_match);static struct platform_driver ipq4019_regulator_driver = { .probe = ipq4019_regulator_probe,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/9 ASoC: rt715: add vendor clear control register
In reply to Sasha LevinFrom: Jack Yu <[email protected]>
[ Upstream commit cebfbc89ae2552dbb58cd9b8206a5c8e0e6301e9 ]
Add vendor clear control register in readable register's callback function. This prevents an access failure reported in Intel CI tests.
--- sound/soc/codecs/rt715-sdw.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/rt715-sdw.c +1 -0
@@ -110,6 +110,7 @@ static bool rt715_readable_register(struct device *dev, unsigned int reg)case 0x839d :case 0x83a7 :case 0x83a9 : +case 0x752001 :case 0x752039 :return true;default :
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/9 net: qede: sanitize 'rc' in qede_add_tc_flower_fltr()
In reply to Sasha LevinFrom: Asbjørn Sloth Tønnesen <[email protected]>
[ Upstream commit e25714466abd9d96901b15efddf82c60a38abd86 ]
Explicitly set 'rc' (return code), before jumping to the unlock and return path.
By not having any code depend on that 'rc' remains at it's initial value of -EINVAL, then we can re-use 'rc' for the return code of function calls in subsequent patches.
Only compile tested.
--- drivers/net/ethernet/qlogic/qede/qede_filter.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +8 -3
@@ -1877,8 +1877,8 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto, struct flow_cls_offload *f) {struct qede_arfs_fltr_node *n; -int min_hlen, rc = -EINVAL ;struct qede_arfs_tuple t; +int min_hlen, rc;__qede_lock (edev);
@@ -1888,8 +1888,10 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto, }/* parse flower attribute and prepare filter */ -if (qede_parse_flow_attr (edev, proto, f->rule, &t)) +if (qede_parse_flow_attr (edev, proto, f->rule, &t)) { + rc = -EINVAL ; goto unlock; + }/* Validate profile mode and number of filters */ if ((edev->arfs->filter_count && edev->arfs->mode != t.mode) ||
@@ -1897,12 +1899,15 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,DP_NOTICE (edev,"Filter configuration invalidated, filter mode=0x%x, configured mode=0x%x, filter count=0x%x\n" , t.mode, edev->arfs->mode, edev->arfs->filter_count); + rc = -EINVAL ; goto unlock; }/* parse tc actions and get the vf_id */ -if (qede_parse_actions (edev, &f->rule->action, f->common.extack)) +if (qede_parse_actions (edev, &f->rule->action, f->common.extack)) { + rc = -EINVAL ; goto unlock; + }if (qede_flow_find_fltr (edev, &t)) { rc = -EEXIST ;
Signature · 1 line
2.43.0
Re: [PATCH AUTOSEL 5.10 5/9] net: qede: sanitize 'rc' in qede_add_tc_flower_fltr()
Hi!
Quoted 8 lines
Explicitly set 'rc' (return code), before jumping to the unlock and return path.
By not having any code depend on that 'rc' remains at it's initial value of
-EINVAL, then we can re-use 'rc' for the return code of function calls in subsequent patches.Only compile tested.
Only compile tested, and is a preparation for something we won't do in stable. Does not fix a bug, please drop.
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Re: [PATCH AUTOSEL 5.10 5/9] net: qede: sanitize 'rc' in qede_add_tc_flower_fltr()
Hi Pavel and Sasha,
Quoted 11 lines · Pavel Machek
Quoted 8 lines
Explicitly set 'rc' (return code), before jumping to the unlock and return path.
By not having any code depend on that 'rc' remains at it's initial value of
-EINVAL, then we can re-use 'rc' for the return code of function calls in subsequent patches.Only compile tested.
Only compile tested, and is a preparation for something we won't do in stable. Does not fix a bug, please drop.
Please see the original thread about this series[1], this patch is a requirement for two of the next patches, which does fix a few bugs with overruled error codes returned to user space.
I was originally going to ignore these AUTOSEL mails, since the whole series was already added to the queued more than 24 hours earlier[2]. In the queue Sasha has also added "Stable-dep-of:'.
So the weird thing is that AUTOSEL selected this patch, given that it was already in the queue.
[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/log/?h=queue/5.10
Signature · 4 lines
Best regards Asbjørn Sloth Tønnesen Network Engineer Fiberby - AS42541
Sasha Levin
maintainerRe: [PATCH AUTOSEL 5.10 5/9] net: qede: sanitize 'rc' in qede_add_tc_flower_fltr()
Quoted 15 lines · Asbjørn Sloth Tønnesen
Hi Pavel and Sasha,
Quoted 11 lines · Pavel Machek
Quoted 8 lines
Explicitly set 'rc' (return code), before jumping to the unlock and return path.
By not having any code depend on that 'rc' remains at it's initial value of
-EINVAL, then we can re-use 'rc' for the return code of function calls in subsequent patches.Only compile tested.
Only compile tested, and is a preparation for something we won't do in stable. Does not fix a bug, please drop.
Quoted 8 lines
Please see the original thread about this series[1], this patch is a requirement for two of the next patches, which does fix a few bugs with overruled error codes returned to user space.
I was originally going to ignore these AUTOSEL mails, since the whole series was already added to the queued more than 24 hours earlier[2]. In the queue Sasha has also added "Stable-dep-of:'.
So the weird thing is that AUTOSEL selected this patch, given that it was already in the queue.
Two different processes on my end, sorry for the noise!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 6/9 firewire: nosy: ensure user_length is taken into account when fetching packet contents
In reply to Sasha LevinFrom: Thanassis Avgerinos <[email protected]>
[ Upstream commit 38762a0763c10c24a4915feee722d7aa6e73eb98 ]
Ensure that packet_buffer_get respects the user_length provided. If the length of the head packet exceeds the user_length, packet_buffer_get will now return 0 to signify to the user that no data were read and a larger buffer size is required. Helps prevent user space overflows.
--- drivers/firewire/nosy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/firewire/nosy.c +4 -2
@@ -148,10 +148,12 @@ packet_buffer_get(struct client *client, char __user *data, size_t user_length)if (atomic_read (&buffer->size) ==0 )return -ENODEV ; -/* FIXME: Check length <= user_length. */ + length = buffer->head->length; + +if (length > user_length) +return 0 ; end = buffer->data + buffer->capacity; - length = buffer->head->length;if (&buffer->head->data[length] < end) {if (copy_to_user (data, buffer->head->data, length))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/9 ASoC: da7219-aad: fix usage of device_get_named_child_node()
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit e8a6a5ad73acbafd98e8fd3f0cbf6e379771bb76 ]
The documentation for device_get_named_child_node() mentions this important point:
"
The caller is responsible for calling fwnode_handle_put() on the returned fwnode pointer.
"
Add fwnode_handle_put() to avoid a leaked reference.
--- sound/soc/codecs/da7219-aad.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/codecs/da7219-aad.c +5 -1
@@ -629,8 +629,10 @@ static struct da7219_aad_pdata *da7219_aad_fw_to_pdata(struct device *dev)return NULL ; aad_pdata =devm_kzalloc (dev,sizeof (*aad_pdata),GFP_KERNEL ); -if (!aad_pdata) +if (!aad_pdata) { +fwnode_handle_put (aad_np);return NULL ; + } aad_pdata->irq = i2c->irq;
@@ -705,6 +707,8 @@ static struct da7219_aad_pdata *da7219_aad_fw_to_pdata(struct device *dev)else aad_pdata->adc_1bit_rpt =DA7219_AAD_ADC_1BIT_RPT_1 ; +fwnode_handle_put (aad_np); +return aad_pdata; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/9 drm/amdkfd: Flush the process wq before creating a kfd_process
In reply to Sasha LevinFrom: Lancelot SIX <[email protected]>
[ Upstream commit f5b9053398e70a0c10aa9cb4dd5910ab6bc457c5 ]
There is a race condition when re-creating a kfd_process for a process. This has been observed when a process under the debugger executes exec(3). In this scenario:
- The process executes exec.
- This will eventually release the process's mm, which will cause the kfd_process object associated with the process to be freed (kfd_process_free_notifier decrements the reference count to the kfd_process to 0). This causes kfd_process_ref_release to enqueue kfd_process_wq_release to the kfd_process_wq.
- The debugger receives the PTRACE_EVENT_EXEC notification, and tries to re-enable AMDGPU traps (KFD_IOC_DBG_TRAP_ENABLE).
- When handling this request, KFD tries to re-create a kfd_process. This eventually calls kfd_create_process and kobject_init_and_add.
At this point the call to kobject_init_and_add can fail because the old kfd_process.kobj has not been freed yet by kfd_process_wq_release.
This patch proposes to avoid this race by making sure to drain kfd_process_wq before creating a new kfd_process object. This way, we know that any cleanup task is done executing when we reach kobject_init_and_add.
--- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +8 -0
@@ -766,6 +766,14 @@ struct kfd_process *kfd_create_process(struct file *filep)if (process) {pr_debug ("Process already found\n" ); }else { +/* If the process just called exec(3), it is possible that the +* cleanup of the kfd_process (following the release of the mm +* of the old process image) is still in the cleanup work queue. +* Make sure to drain any job before trying to recreate any +* resource for this process. +*/ +flush_workqueue (kfd_process_wq); + process =create_process (thread);if (IS_ERR (process)) goto out;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/9 nvme: find numa distance only if controller has valid numa id
In reply to Sasha LevinFrom: Nilay Shroff <[email protected]>
[ Upstream commit 863fe60ed27f2c85172654a63c5b827e72c8b2e6 ]
On system where native nvme multipath is configured and iopolicy is set to numa but the nvme controller numa node id is undefined or -1 (NUMA_NO_NODE) then avoid calculating node distance for finding optimal io path. In such case we may access numa distance table with invalid index and that may potentially refer to incorrect memory. So this patch ensures that if the nvme controller numa node id is -1 then instead of calculating node distance for finding optimal io path, we set the numa node distance of such controller to default 10 (LOCAL_DISTANCE).
--- drivers/nvme/host/multipath.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/multipath.c +2 -1
@@ -168,7 +168,8 @@ static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int node)if (nvme_path_is_disabled (ns))continue ; -if (READ_ONCE (head->subsys->iopolicy) ==NVME_IOPOLICY_NUMA ) +if (ns->ctrl->numa_node !=NUMA_NO_NODE && +READ_ONCE (head->subsys->iopolicy) ==NVME_IOPOLICY_NUMA ) distance =node_distance (node, ns->ctrl->numa_node);else distance =LOCAL_DISTANCE ;
Signature · 1 line
2.43.0