From: ChiYuan Huang <[email protected]>
This patch series create a TDM source select property and use it to
decide which TDM data source is connected.
Following by the below patch disccuion
https://lore.kernel.org/lkml/[email protected]/#t
It may not be a good choice to add the user controlable mixer control
item. Since it follows the board design, make it as a device property.
ChiYuan Huang (2):
ASoC: dt-bindings: rtq9128: Add TDM input source slect property
ASoC: codecs: rtq9128: Add TDM input source select
.../bindings/sound/richtek,rtq9128.yaml | 7 +++++++
sound/soc/codecs/rtq9128.c | 16 +++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
base-commit: 3efcb471f871cc095841d411f98c593228ecbac6
--
2.34.1
From: ChiYuan Huang <[email protected]>
Create a boolean property to select TDM input source coms from 'DATA2'.
Signed-off-by: ChiYuan Huang <[email protected]>
---
.../devicetree/bindings/sound/richtek,rtq9128.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/richtek,rtq9128.yaml b/Documentation/devicetree/bindings/sound/richtek,rtq9128.yaml
index d117f08fff30..d54686a19ab7 100644
--- a/Documentation/devicetree/bindings/sound/richtek,rtq9128.yaml
+++ b/Documentation/devicetree/bindings/sound/richtek,rtq9128.yaml
@@ -28,6 +28,13 @@ properties:
enable-gpios:
maxItems: 1
+ richtek,tdm-input-data2-select:
+ type: boolean
+ description:
+ By default, if TDM mode is used, TDM data input will select 'DATA1' pin
+ as the data source. This option will configure TDM data input source from
+ 'DATA1' to 'DATA2' pin.
+
'#sound-dai-cells':
const: 0
--
2.34.1
From: ChiYuan Huang <[email protected]>
Pase the property to decide the TDM input source comes from 'DATA1' or
'DATA2 pin.
Signed-off-by: ChiYuan Huang <[email protected]>
---
sound/soc/codecs/rtq9128.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rtq9128.c b/sound/soc/codecs/rtq9128.c
index 926b79ed8078..371d622c6214 100644
--- a/sound/soc/codecs/rtq9128.c
+++ b/sound/soc/codecs/rtq9128.c
@@ -14,6 +14,7 @@
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
+#include <linux/property.h>
#include <linux/regmap.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
@@ -41,6 +42,7 @@
#define RTQ9128_CHSTAT_VAL_MASK GENMASK(1, 0)
#define RTQ9128_DOLEN_MASK GENMASK(7, 6)
+#define RTQ9128_TDMSRCIN_MASK GENMASK(5, 4)
#define RTQ9128_AUDBIT_MASK GENMASK(5, 4)
#define RTQ9128_AUDFMT_MASK GENMASK(3, 0)
#define RTQ9128_MSMUTE_MASK BIT(0)
@@ -59,6 +61,7 @@ struct rtq9128_data {
struct gpio_desc *enable;
int tdm_slots;
int tdm_slot_width;
+ bool tdm_input_data2_select;
};
struct rtq9128_init_reg {
@@ -484,7 +487,7 @@ static int rtq9128_dai_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mas
struct rtq9128_data *data = snd_soc_dai_get_drvdata(dai);
struct snd_soc_component *comp = dai->component;
struct device *dev = dai->dev;
- unsigned int mask, start_loc;
+ unsigned int mask, start_loc, srcin_select;
int i, frame_length, ret;
dev_dbg(dev, "%s: slot %d slot_width %d, tx/rx mask 0x%x 0x%x\n", __func__, slots,
@@ -530,6 +533,14 @@ static int rtq9128_dai_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mas
}
}
+ srcin_select = data->tdm_input_data2_select ? RTQ9128_TDMSRCIN_MASK : 0;
+ ret = snd_soc_component_update_bits(comp, RTQ9128_REG_SDO_SEL, RTQ9128_TDMSRCIN_MASK,
+ srcin_select);
+ if (ret < 0) {
+ dev_err(dev, "Failed to configure TDM source input select\n");
+ return ret;
+ }
+
data->tdm_slots = slots;
data->tdm_slot_width = slot_width;
@@ -672,6 +683,9 @@ static int rtq9128_probe(struct i2c_client *i2c)
else if (data->enable)
usleep_range(10000, 11000);
+ data->tdm_input_data2_select = device_property_read_bool(dev,
+ "richtek,tdm-input-data2-select");
+
i2c_set_clientdata(i2c, data);
/*
--
2.34.1
On Thu, 28 Sep 2023 11:41:06 +0800, [email protected] wrote:
> This patch series create a TDM source select property and use it to
> decide which TDM data source is connected.
>
> Following by the below patch disccuion
> https://lore.kernel.org/lkml/[email protected]/#t
> It may not be a good choice to add the user controlable mixer control
> item. Since it follows the board design, make it as a device property.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: dt-bindings: rtq9128: Add TDM input source slect property
commit: bf38a0be7c57e43303600b5afc9b740882b3ed87
[2/2] ASoC: codecs: rtq9128: Add TDM input source select
commit: 54ac512048c98b720a8fbf5899308788dff8def0
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