linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] ASoC: meson: g12a-toacodec: add support for SM1
@ 2021-05-05  7:26 Neil Armstrong
  2021-05-05  7:26 ` [PATCH v2 1/2] ASoC: meson: g12a-toacodec: use regmap fields to prepare SM1 support Neil Armstrong
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Neil Armstrong @ 2021-05-05  7:26 UTC (permalink / raw)
  To: jbrunet, broonie
  Cc: alsa-devel, linux-amlogic, linux-arm-kernel, linux-kernel,
	Neil Armstrong

This patchset adds Amlogic SM1 support on the TOACODEC driver, first by switching
to regmap fields for some bit fields to avoid code duplication, and then by adding
the corresponding bits & struct for the SM1 changed bits.

Changes since v1 at [1]:
- switch to regmap field

[1] https://lore.kernel.org/r/20210429170147.3615883-1-narmstrong@baylibre.com

Neil Armstrong (2):
  ASoC: meson: g12a-toacodec: use regmap fields to prepare SM1 support
  ASoC: meson: g12a-toacodec: add support for SM1 TOACODEC

 sound/soc/meson/g12a-toacodec.c | 144 +++++++++++++++++++++++++++-----
 1 file changed, 125 insertions(+), 19 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] ASoC: meson: g12a-toacodec: use regmap fields to prepare SM1 support
  2021-05-05  7:26 [PATCH v2 0/2] ASoC: meson: g12a-toacodec: add support for SM1 Neil Armstrong
@ 2021-05-05  7:26 ` Neil Armstrong
  2021-05-05  7:26 ` [PATCH v2 2/2] ASoC: meson: g12a-toacodec: add support for SM1 TOACODEC Neil Armstrong
  2021-05-05  7:26 ` [PATCH v2 2/2] sound: " Neil Armstrong
  2 siblings, 0 replies; 6+ messages in thread
From: Neil Armstrong @ 2021-05-05  7:26 UTC (permalink / raw)
  To: jbrunet, broonie
  Cc: alsa-devel, linux-amlogic, linux-arm-kernel, linux-kernel,
	Neil Armstrong

Switch usage to regmap field for bits handled by the g12a_toacodec_mux_put_enum()
function to avoid uselesss code duplication when adding SM1 variant support.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 sound/soc/meson/g12a-toacodec.c | 80 +++++++++++++++++++++++++--------
 1 file changed, 62 insertions(+), 18 deletions(-)

diff --git a/sound/soc/meson/g12a-toacodec.c b/sound/soc/meson/g12a-toacodec.c
index 9339fabccb79..2084c9542c9c 100644
--- a/sound/soc/meson/g12a-toacodec.c
+++ b/sound/soc/meson/g12a-toacodec.c
@@ -21,17 +21,31 @@
 
 #define TOACODEC_CTRL0			0x0
 #define  CTRL0_ENABLE_SHIFT		31
-#define  CTRL0_DAT_SEL_SHIFT		14
-#define  CTRL0_DAT_SEL			(0x3 << CTRL0_DAT_SEL_SHIFT)
+#define  CTRL0_DAT_SEL_MSB		15
+#define  CTRL0_DAT_SEL_LSB		14
 #define  CTRL0_LANE_SEL			12
-#define  CTRL0_LRCLK_SEL		GENMASK(9, 8)
+#define  CTRL0_LRCLK_SEL_MSB		9
+#define  CTRL0_LRCLK_SEL_LSB		8
 #define  CTRL0_BLK_CAP_INV		BIT(7)
 #define  CTRL0_BCLK_O_INV		BIT(6)
-#define  CTRL0_BCLK_SEL			GENMASK(5, 4)
+#define  CTRL0_BCLK_SEL_MSB		5
+#define  CTRL0_BCLK_SEL_LSB		4
 #define  CTRL0_MCLK_SEL			GENMASK(2, 0)
 
 #define TOACODEC_OUT_CHMAX		2
 
+struct g12a_toacodec {
+	struct regmap_field *field_dat_sel;
+	struct regmap_field *field_lrclk_sel;
+	struct regmap_field *field_bclk_sel;
+};
+
+struct g12a_toacodec_match_data {
+	struct reg_field field_dat_sel;
+	struct reg_field field_lrclk_sel;
+	struct reg_field field_bclk_sel;
+};
+
 static const char * const g12a_toacodec_mux_texts[] = {
 	"I2S A", "I2S B", "I2S C",
 };
@@ -41,29 +55,24 @@ static int g12a_toacodec_mux_put_enum(struct snd_kcontrol *kcontrol,
 {
 	struct snd_soc_component *component =
 		snd_soc_dapm_kcontrol_component(kcontrol);
+	struct g12a_toacodec *priv = snd_soc_component_get_drvdata(component);
 	struct snd_soc_dapm_context *dapm =
 		snd_soc_dapm_kcontrol_dapm(kcontrol);
 	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
-	unsigned int mux, changed;
+	unsigned int mux, reg;
 
 	mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]);
-	changed = snd_soc_component_test_bits(component, e->reg,
-					      CTRL0_DAT_SEL,
-					      FIELD_PREP(CTRL0_DAT_SEL, mux));
+	regmap_field_read(priv->field_dat_sel, &reg);
 
-	if (!changed)
+	if (mux == reg)
 		return 0;
 
 	/* Force disconnect of the mux while updating */
 	snd_soc_dapm_mux_update_power(dapm, kcontrol, 0, NULL, NULL);
 
-	snd_soc_component_update_bits(component, e->reg,
-				      CTRL0_DAT_SEL |
-				      CTRL0_LRCLK_SEL |
-				      CTRL0_BCLK_SEL,
-				      FIELD_PREP(CTRL0_DAT_SEL, mux) |
-				      FIELD_PREP(CTRL0_LRCLK_SEL, mux) |
-				      FIELD_PREP(CTRL0_BCLK_SEL, mux));
+	regmap_field_write(priv->field_dat_sel, mux);
+	regmap_field_write(priv->field_lrclk_sel, mux);
+	regmap_field_write(priv->field_bclk_sel, mux);
 
 	/*
 	 * FIXME:
@@ -86,7 +95,7 @@ static int g12a_toacodec_mux_put_enum(struct snd_kcontrol *kcontrol,
 }
 
 static SOC_ENUM_SINGLE_DECL(g12a_toacodec_mux_enum, TOACODEC_CTRL0,
-			    CTRL0_DAT_SEL_SHIFT,
+			    CTRL0_DAT_SEL_LSB,
 			    g12a_toacodec_mux_texts);
 
 static const struct snd_kcontrol_new g12a_toacodec_mux =
@@ -205,19 +214,42 @@ static const struct regmap_config g12a_toacodec_regmap_cfg = {
 	.reg_stride	= 4,
 };
 
+static const struct g12a_toacodec_match_data g12a_toacodec_match_data = {
+	.field_dat_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_DAT_SEL_LSB, CTRL0_DAT_SEL_MSB),
+	.field_lrclk_sel = REG_FIELD(TOACODEC_CTRL0, CTRL0_LRCLK_SEL_LSB, CTRL0_LRCLK_SEL_MSB),
+	.field_bclk_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_BCLK_SEL_LSB, CTRL0_BCLK_SEL_MSB),
+};
+
 static const struct of_device_id g12a_toacodec_of_match[] = {
-	{ .compatible = "amlogic,g12a-toacodec", },
+	{
+		.compatible = "amlogic,g12a-toacodec",
+		.data = &g12a_toacodec_match_data,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, g12a_toacodec_of_match);
 
 static int g12a_toacodec_probe(struct platform_device *pdev)
 {
+	const struct g12a_toacodec_match_data *data;
 	struct device *dev = &pdev->dev;
+	struct g12a_toacodec *priv;
 	void __iomem *regs;
 	struct regmap *map;
 	int ret;
 
+	data = device_get_match_data(dev);
+	if (!data) {
+		dev_err(dev, "failed to match device\n");
+		return -ENODEV;
+	}
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, priv);
+
 	ret = device_reset(dev);
 	if (ret)
 		return ret;
@@ -233,6 +265,18 @@ static int g12a_toacodec_probe(struct platform_device *pdev)
 		return PTR_ERR(map);
 	}
 
+	priv->field_dat_sel = devm_regmap_field_alloc(dev, map, data->field_dat_sel);
+	if (IS_ERR(priv->field_dat_sel))
+		return PTR_ERR(priv->field_dat_sel);
+
+	priv->field_lrclk_sel = devm_regmap_field_alloc(dev, map, data->field_lrclk_sel);
+	if (IS_ERR(priv->field_lrclk_sel))
+		return PTR_ERR(priv->field_lrclk_sel);
+
+	priv->field_bclk_sel = devm_regmap_field_alloc(dev, map, data->field_bclk_sel);
+	if (IS_ERR(priv->field_bclk_sel))
+		return PTR_ERR(priv->field_bclk_sel);
+
 	return devm_snd_soc_register_component(dev,
 			&g12a_toacodec_component_drv, g12a_toacodec_dai_drv,
 			ARRAY_SIZE(g12a_toacodec_dai_drv));
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] ASoC: meson: g12a-toacodec: add support for SM1 TOACODEC
  2021-05-05  7:26 [PATCH v2 0/2] ASoC: meson: g12a-toacodec: add support for SM1 Neil Armstrong
  2021-05-05  7:26 ` [PATCH v2 1/2] ASoC: meson: g12a-toacodec: use regmap fields to prepare SM1 support Neil Armstrong
@ 2021-05-05  7:26 ` Neil Armstrong
  2021-05-05  7:26 ` [PATCH v2 2/2] sound: " Neil Armstrong
  2 siblings, 0 replies; 6+ messages in thread
From: Neil Armstrong @ 2021-05-05  7:26 UTC (permalink / raw)
  To: jbrunet, broonie
  Cc: alsa-devel, linux-amlogic, linux-arm-kernel, linux-kernel,
	Neil Armstrong

This adds support for the TOACODEC found in Amlogic SM1 SoCs.

The bits are shifted for more selection of clock sources, so this only
maps the same support for G12A to the SM1 bits.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 sound/soc/meson/g12a-toacodec.c | 64 ++++++++++++++++++++++++++++++++-
 1 file changed, 63 insertions(+), 1 deletion(-)

diff --git a/sound/soc/meson/g12a-toacodec.c b/sound/soc/meson/g12a-toacodec.c
index 2084c9542c9c..5437ecba9c47 100644
--- a/sound/soc/meson/g12a-toacodec.c
+++ b/sound/soc/meson/g12a-toacodec.c
@@ -21,13 +21,22 @@
 
 #define TOACODEC_CTRL0			0x0
 #define  CTRL0_ENABLE_SHIFT		31
+#define  CTRL0_DAT_SEL_SM1_MSB		19
+#define  CTRL0_DAT_SEL_SM1_LSB		18
 #define  CTRL0_DAT_SEL_MSB		15
 #define  CTRL0_DAT_SEL_LSB		14
+#define  CTRL0_LANE_SEL_SM1		16
 #define  CTRL0_LANE_SEL			12
+#define  CTRL0_LRCLK_SEL_SM1_MSB	14
+#define  CTRL0_LRCLK_SEL_SM1_LSB	12
 #define  CTRL0_LRCLK_SEL_MSB		9
 #define  CTRL0_LRCLK_SEL_LSB		8
+#define  CTRL0_LRCLK_INV_SM1		BIT(10)
+#define  CTRL0_BLK_CAP_INV_SM1		BIT(9)
 #define  CTRL0_BLK_CAP_INV		BIT(7)
+#define  CTRL0_BCLK_O_INV_SM1		BIT(8)
 #define  CTRL0_BCLK_O_INV		BIT(6)
+#define  CTRL0_BCLK_SEL_SM1_MSB		6
 #define  CTRL0_BCLK_SEL_MSB		5
 #define  CTRL0_BCLK_SEL_LSB		4
 #define  CTRL0_MCLK_SEL			GENMASK(2, 0)
@@ -41,6 +50,7 @@ struct g12a_toacodec {
 };
 
 struct g12a_toacodec_match_data {
+	const struct snd_soc_component_driver *component_drv;
 	struct reg_field field_dat_sel;
 	struct reg_field field_lrclk_sel;
 	struct reg_field field_bclk_sel;
@@ -98,11 +108,20 @@ static SOC_ENUM_SINGLE_DECL(g12a_toacodec_mux_enum, TOACODEC_CTRL0,
 			    CTRL0_DAT_SEL_LSB,
 			    g12a_toacodec_mux_texts);
 
+static SOC_ENUM_SINGLE_DECL(sm1_toacodec_mux_enum, TOACODEC_CTRL0,
+			    CTRL0_DAT_SEL_SM1_LSB,
+			    g12a_toacodec_mux_texts);
+
 static const struct snd_kcontrol_new g12a_toacodec_mux =
 	SOC_DAPM_ENUM_EXT("Source", g12a_toacodec_mux_enum,
 			  snd_soc_dapm_get_enum_double,
 			  g12a_toacodec_mux_put_enum);
 
+static const struct snd_kcontrol_new sm1_toacodec_mux =
+	SOC_DAPM_ENUM_EXT("Source", sm1_toacodec_mux_enum,
+			  snd_soc_dapm_get_enum_double,
+			  g12a_toacodec_mux_put_enum);
+
 static const struct snd_kcontrol_new g12a_toacodec_out_enable =
 	SOC_DAPM_SINGLE_AUTODISABLE("Switch", TOACODEC_CTRL0,
 				    CTRL0_ENABLE_SHIFT, 1, 0);
@@ -114,6 +133,13 @@ static const struct snd_soc_dapm_widget g12a_toacodec_widgets[] = {
 			    &g12a_toacodec_out_enable),
 };
 
+static const struct snd_soc_dapm_widget sm1_toacodec_widgets[] = {
+	SND_SOC_DAPM_MUX("SRC", SND_SOC_NOPM, 0, 0,
+			 &sm1_toacodec_mux),
+	SND_SOC_DAPM_SWITCH("OUT EN", SND_SOC_NOPM, 0, 0,
+			    &g12a_toacodec_out_enable),
+};
+
 static int g12a_toacodec_input_hw_params(struct snd_pcm_substream *substream,
 					 struct snd_pcm_hw_params *params,
 					 struct snd_soc_dai *dai)
@@ -184,6 +210,13 @@ static int g12a_toacodec_component_probe(struct snd_soc_component *c)
 				       CTRL0_BLK_CAP_INV);
 }
 
+static int sm1_toacodec_component_probe(struct snd_soc_component *c)
+{
+	/* Initialize the static clock parameters */
+	return snd_soc_component_write(c, TOACODEC_CTRL0,
+				       CTRL0_BLK_CAP_INV_SM1);
+}
+
 static const struct snd_soc_dapm_route g12a_toacodec_routes[] = {
 	{ "SRC", "I2S A", "IN A Playback" },
 	{ "SRC", "I2S B", "IN B Playback" },
@@ -196,6 +229,10 @@ static const struct snd_kcontrol_new g12a_toacodec_controls[] = {
 	SOC_SINGLE("Lane Select", TOACODEC_CTRL0, CTRL0_LANE_SEL, 3, 0),
 };
 
+static const struct snd_kcontrol_new sm1_toacodec_controls[] = {
+	SOC_SINGLE("Lane Select", TOACODEC_CTRL0, CTRL0_LANE_SEL_SM1, 3, 0),
+};
+
 static const struct snd_soc_component_driver g12a_toacodec_component_drv = {
 	.probe			= g12a_toacodec_component_probe,
 	.controls		= g12a_toacodec_controls,
@@ -208,6 +245,18 @@ static const struct snd_soc_component_driver g12a_toacodec_component_drv = {
 	.non_legacy_dai_naming	= 1,
 };
 
+static const struct snd_soc_component_driver sm1_toacodec_component_drv = {
+	.probe			= sm1_toacodec_component_probe,
+	.controls		= sm1_toacodec_controls,
+	.num_controls		= ARRAY_SIZE(sm1_toacodec_controls),
+	.dapm_widgets		= sm1_toacodec_widgets,
+	.num_dapm_widgets	= ARRAY_SIZE(sm1_toacodec_widgets),
+	.dapm_routes		= g12a_toacodec_routes,
+	.num_dapm_routes	= ARRAY_SIZE(g12a_toacodec_routes),
+	.endianness		= 1,
+	.non_legacy_dai_naming	= 1,
+};
+
 static const struct regmap_config g12a_toacodec_regmap_cfg = {
 	.reg_bits	= 32,
 	.val_bits	= 32,
@@ -215,16 +264,29 @@ static const struct regmap_config g12a_toacodec_regmap_cfg = {
 };
 
 static const struct g12a_toacodec_match_data g12a_toacodec_match_data = {
+	.component_drv	= &g12a_toacodec_component_drv,
 	.field_dat_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_DAT_SEL_LSB, CTRL0_DAT_SEL_MSB),
 	.field_lrclk_sel = REG_FIELD(TOACODEC_CTRL0, CTRL0_LRCLK_SEL_LSB, CTRL0_LRCLK_SEL_MSB),
 	.field_bclk_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_BCLK_SEL_LSB, CTRL0_BCLK_SEL_MSB),
 };
 
+static const struct g12a_toacodec_match_data sm1_toacodec_match_data = {
+	.component_drv	= &sm1_toacodec_component_drv,
+	.field_dat_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_DAT_SEL_SM1_LSB, CTRL0_DAT_SEL_SM1_MSB),
+	.field_lrclk_sel = REG_FIELD(TOACODEC_CTRL0, CTRL0_LRCLK_SEL_SM1_LSB,
+				     CTRL0_LRCLK_SEL_SM1_MSB),
+	.field_bclk_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_BCLK_SEL_LSB, CTRL0_BCLK_SEL_SM1_MSB),
+};
+
 static const struct of_device_id g12a_toacodec_of_match[] = {
 	{
 		.compatible = "amlogic,g12a-toacodec",
 		.data = &g12a_toacodec_match_data,
 	},
+	{
+		.compatible = "amlogic,sm1-toacodec",
+		.data = &sm1_toacodec_match_data,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, g12a_toacodec_of_match);
@@ -278,7 +340,7 @@ static int g12a_toacodec_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->field_bclk_sel);
 
 	return devm_snd_soc_register_component(dev,
-			&g12a_toacodec_component_drv, g12a_toacodec_dai_drv,
+			data->component_drv, g12a_toacodec_dai_drv,
 			ARRAY_SIZE(g12a_toacodec_dai_drv));
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] sound: meson: g12a-toacodec: add support for SM1 TOACODEC
  2021-05-05  7:26 [PATCH v2 0/2] ASoC: meson: g12a-toacodec: add support for SM1 Neil Armstrong
  2021-05-05  7:26 ` [PATCH v2 1/2] ASoC: meson: g12a-toacodec: use regmap fields to prepare SM1 support Neil Armstrong
  2021-05-05  7:26 ` [PATCH v2 2/2] ASoC: meson: g12a-toacodec: add support for SM1 TOACODEC Neil Armstrong
@ 2021-05-05  7:26 ` Neil Armstrong
  2021-05-05  7:27   ` Neil Armstrong
  2 siblings, 1 reply; 6+ messages in thread
From: Neil Armstrong @ 2021-05-05  7:26 UTC (permalink / raw)
  To: jbrunet, broonie
  Cc: alsa-devel, linux-amlogic, linux-arm-kernel, linux-kernel,
	Neil Armstrong

This adds support for the TOACODEC found in Amlogic SM1 SoCs.

The bits are shifted for more selection of clock sources, so this only
maps the same support for G12A to the SM1 bits.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 sound/soc/meson/g12a-toacodec.c | 64 ++++++++++++++++++++++++++++++++-
 1 file changed, 63 insertions(+), 1 deletion(-)

diff --git a/sound/soc/meson/g12a-toacodec.c b/sound/soc/meson/g12a-toacodec.c
index 2084c9542c9c..5437ecba9c47 100644
--- a/sound/soc/meson/g12a-toacodec.c
+++ b/sound/soc/meson/g12a-toacodec.c
@@ -21,13 +21,22 @@
 
 #define TOACODEC_CTRL0			0x0
 #define  CTRL0_ENABLE_SHIFT		31
+#define  CTRL0_DAT_SEL_SM1_MSB		19
+#define  CTRL0_DAT_SEL_SM1_LSB		18
 #define  CTRL0_DAT_SEL_MSB		15
 #define  CTRL0_DAT_SEL_LSB		14
+#define  CTRL0_LANE_SEL_SM1		16
 #define  CTRL0_LANE_SEL			12
+#define  CTRL0_LRCLK_SEL_SM1_MSB	14
+#define  CTRL0_LRCLK_SEL_SM1_LSB	12
 #define  CTRL0_LRCLK_SEL_MSB		9
 #define  CTRL0_LRCLK_SEL_LSB		8
+#define  CTRL0_LRCLK_INV_SM1		BIT(10)
+#define  CTRL0_BLK_CAP_INV_SM1		BIT(9)
 #define  CTRL0_BLK_CAP_INV		BIT(7)
+#define  CTRL0_BCLK_O_INV_SM1		BIT(8)
 #define  CTRL0_BCLK_O_INV		BIT(6)
+#define  CTRL0_BCLK_SEL_SM1_MSB		6
 #define  CTRL0_BCLK_SEL_MSB		5
 #define  CTRL0_BCLK_SEL_LSB		4
 #define  CTRL0_MCLK_SEL			GENMASK(2, 0)
@@ -41,6 +50,7 @@ struct g12a_toacodec {
 };
 
 struct g12a_toacodec_match_data {
+	const struct snd_soc_component_driver *component_drv;
 	struct reg_field field_dat_sel;
 	struct reg_field field_lrclk_sel;
 	struct reg_field field_bclk_sel;
@@ -98,11 +108,20 @@ static SOC_ENUM_SINGLE_DECL(g12a_toacodec_mux_enum, TOACODEC_CTRL0,
 			    CTRL0_DAT_SEL_LSB,
 			    g12a_toacodec_mux_texts);
 
+static SOC_ENUM_SINGLE_DECL(sm1_toacodec_mux_enum, TOACODEC_CTRL0,
+			    CTRL0_DAT_SEL_SM1_LSB,
+			    g12a_toacodec_mux_texts);
+
 static const struct snd_kcontrol_new g12a_toacodec_mux =
 	SOC_DAPM_ENUM_EXT("Source", g12a_toacodec_mux_enum,
 			  snd_soc_dapm_get_enum_double,
 			  g12a_toacodec_mux_put_enum);
 
+static const struct snd_kcontrol_new sm1_toacodec_mux =
+	SOC_DAPM_ENUM_EXT("Source", sm1_toacodec_mux_enum,
+			  snd_soc_dapm_get_enum_double,
+			  g12a_toacodec_mux_put_enum);
+
 static const struct snd_kcontrol_new g12a_toacodec_out_enable =
 	SOC_DAPM_SINGLE_AUTODISABLE("Switch", TOACODEC_CTRL0,
 				    CTRL0_ENABLE_SHIFT, 1, 0);
@@ -114,6 +133,13 @@ static const struct snd_soc_dapm_widget g12a_toacodec_widgets[] = {
 			    &g12a_toacodec_out_enable),
 };
 
+static const struct snd_soc_dapm_widget sm1_toacodec_widgets[] = {
+	SND_SOC_DAPM_MUX("SRC", SND_SOC_NOPM, 0, 0,
+			 &sm1_toacodec_mux),
+	SND_SOC_DAPM_SWITCH("OUT EN", SND_SOC_NOPM, 0, 0,
+			    &g12a_toacodec_out_enable),
+};
+
 static int g12a_toacodec_input_hw_params(struct snd_pcm_substream *substream,
 					 struct snd_pcm_hw_params *params,
 					 struct snd_soc_dai *dai)
@@ -184,6 +210,13 @@ static int g12a_toacodec_component_probe(struct snd_soc_component *c)
 				       CTRL0_BLK_CAP_INV);
 }
 
+static int sm1_toacodec_component_probe(struct snd_soc_component *c)
+{
+	/* Initialize the static clock parameters */
+	return snd_soc_component_write(c, TOACODEC_CTRL0,
+				       CTRL0_BLK_CAP_INV_SM1);
+}
+
 static const struct snd_soc_dapm_route g12a_toacodec_routes[] = {
 	{ "SRC", "I2S A", "IN A Playback" },
 	{ "SRC", "I2S B", "IN B Playback" },
@@ -196,6 +229,10 @@ static const struct snd_kcontrol_new g12a_toacodec_controls[] = {
 	SOC_SINGLE("Lane Select", TOACODEC_CTRL0, CTRL0_LANE_SEL, 3, 0),
 };
 
+static const struct snd_kcontrol_new sm1_toacodec_controls[] = {
+	SOC_SINGLE("Lane Select", TOACODEC_CTRL0, CTRL0_LANE_SEL_SM1, 3, 0),
+};
+
 static const struct snd_soc_component_driver g12a_toacodec_component_drv = {
 	.probe			= g12a_toacodec_component_probe,
 	.controls		= g12a_toacodec_controls,
@@ -208,6 +245,18 @@ static const struct snd_soc_component_driver g12a_toacodec_component_drv = {
 	.non_legacy_dai_naming	= 1,
 };
 
+static const struct snd_soc_component_driver sm1_toacodec_component_drv = {
+	.probe			= sm1_toacodec_component_probe,
+	.controls		= sm1_toacodec_controls,
+	.num_controls		= ARRAY_SIZE(sm1_toacodec_controls),
+	.dapm_widgets		= sm1_toacodec_widgets,
+	.num_dapm_widgets	= ARRAY_SIZE(sm1_toacodec_widgets),
+	.dapm_routes		= g12a_toacodec_routes,
+	.num_dapm_routes	= ARRAY_SIZE(g12a_toacodec_routes),
+	.endianness		= 1,
+	.non_legacy_dai_naming	= 1,
+};
+
 static const struct regmap_config g12a_toacodec_regmap_cfg = {
 	.reg_bits	= 32,
 	.val_bits	= 32,
@@ -215,16 +264,29 @@ static const struct regmap_config g12a_toacodec_regmap_cfg = {
 };
 
 static const struct g12a_toacodec_match_data g12a_toacodec_match_data = {
+	.component_drv	= &g12a_toacodec_component_drv,
 	.field_dat_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_DAT_SEL_LSB, CTRL0_DAT_SEL_MSB),
 	.field_lrclk_sel = REG_FIELD(TOACODEC_CTRL0, CTRL0_LRCLK_SEL_LSB, CTRL0_LRCLK_SEL_MSB),
 	.field_bclk_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_BCLK_SEL_LSB, CTRL0_BCLK_SEL_MSB),
 };
 
+static const struct g12a_toacodec_match_data sm1_toacodec_match_data = {
+	.component_drv	= &sm1_toacodec_component_drv,
+	.field_dat_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_DAT_SEL_SM1_LSB, CTRL0_DAT_SEL_SM1_MSB),
+	.field_lrclk_sel = REG_FIELD(TOACODEC_CTRL0, CTRL0_LRCLK_SEL_SM1_LSB,
+				     CTRL0_LRCLK_SEL_SM1_MSB),
+	.field_bclk_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_BCLK_SEL_LSB, CTRL0_BCLK_SEL_SM1_MSB),
+};
+
 static const struct of_device_id g12a_toacodec_of_match[] = {
 	{
 		.compatible = "amlogic,g12a-toacodec",
 		.data = &g12a_toacodec_match_data,
 	},
+	{
+		.compatible = "amlogic,sm1-toacodec",
+		.data = &sm1_toacodec_match_data,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, g12a_toacodec_of_match);
@@ -278,7 +340,7 @@ static int g12a_toacodec_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->field_bclk_sel);
 
 	return devm_snd_soc_register_component(dev,
-			&g12a_toacodec_component_drv, g12a_toacodec_dai_drv,
+			data->component_drv, g12a_toacodec_dai_drv,
 			ARRAY_SIZE(g12a_toacodec_dai_drv));
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] sound: meson: g12a-toacodec: add support for SM1 TOACODEC
  2021-05-05  7:26 ` [PATCH v2 2/2] sound: " Neil Armstrong
@ 2021-05-05  7:27   ` Neil Armstrong
  2021-05-07  7:38     ` Jerome Brunet
  0 siblings, 1 reply; 6+ messages in thread
From: Neil Armstrong @ 2021-05-05  7:27 UTC (permalink / raw)
  To: jbrunet, broonie
  Cc: alsa-devel, linux-amlogic, linux-arm-kernel, linux-kernel

On 05/05/2021 09:26, Neil Armstrong wrote:
> This adds support for the TOACODEC found in Amlogic SM1 SoCs.
> 
> The bits are shifted for more selection of clock sources, so this only
> maps the same support for G12A to the SM1 bits.
> 
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  sound/soc/meson/g12a-toacodec.c | 64 ++++++++++++++++++++++++++++++++-
>  1 file changed, 63 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/meson/g12a-toacodec.c b/sound/soc/meson/g12a-toacodec.c
> index 2084c9542c9c..5437ecba9c47 100644
> --- a/sound/soc/meson/g12a-toacodec.c
> +++ b/sound/soc/meson/g12a-toacodec.c
> @@ -21,13 +21,22 @@
>  
>  #define TOACODEC_CTRL0			0x0
>  #define  CTRL0_ENABLE_SHIFT		31
> +#define  CTRL0_DAT_SEL_SM1_MSB		19
> +#define  CTRL0_DAT_SEL_SM1_LSB		18
>  #define  CTRL0_DAT_SEL_MSB		15
>  #define  CTRL0_DAT_SEL_LSB		14
> +#define  CTRL0_LANE_SEL_SM1		16
>  #define  CTRL0_LANE_SEL			12
> +#define  CTRL0_LRCLK_SEL_SM1_MSB	14
> +#define  CTRL0_LRCLK_SEL_SM1_LSB	12
>  #define  CTRL0_LRCLK_SEL_MSB		9
>  #define  CTRL0_LRCLK_SEL_LSB		8
> +#define  CTRL0_LRCLK_INV_SM1		BIT(10)
> +#define  CTRL0_BLK_CAP_INV_SM1		BIT(9)
>  #define  CTRL0_BLK_CAP_INV		BIT(7)
> +#define  CTRL0_BCLK_O_INV_SM1		BIT(8)
>  #define  CTRL0_BCLK_O_INV		BIT(6)
> +#define  CTRL0_BCLK_SEL_SM1_MSB		6
>  #define  CTRL0_BCLK_SEL_MSB		5
>  #define  CTRL0_BCLK_SEL_LSB		4
>  #define  CTRL0_MCLK_SEL			GENMASK(2, 0)
> @@ -41,6 +50,7 @@ struct g12a_toacodec {
>  };
>  
>  struct g12a_toacodec_match_data {
> +	const struct snd_soc_component_driver *component_drv;
>  	struct reg_field field_dat_sel;
>  	struct reg_field field_lrclk_sel;
>  	struct reg_field field_bclk_sel;
> @@ -98,11 +108,20 @@ static SOC_ENUM_SINGLE_DECL(g12a_toacodec_mux_enum, TOACODEC_CTRL0,
>  			    CTRL0_DAT_SEL_LSB,
>  			    g12a_toacodec_mux_texts);
>  
> +static SOC_ENUM_SINGLE_DECL(sm1_toacodec_mux_enum, TOACODEC_CTRL0,
> +			    CTRL0_DAT_SEL_SM1_LSB,
> +			    g12a_toacodec_mux_texts);
> +
>  static const struct snd_kcontrol_new g12a_toacodec_mux =
>  	SOC_DAPM_ENUM_EXT("Source", g12a_toacodec_mux_enum,
>  			  snd_soc_dapm_get_enum_double,
>  			  g12a_toacodec_mux_put_enum);
>  
> +static const struct snd_kcontrol_new sm1_toacodec_mux =
> +	SOC_DAPM_ENUM_EXT("Source", sm1_toacodec_mux_enum,
> +			  snd_soc_dapm_get_enum_double,
> +			  g12a_toacodec_mux_put_enum);
> +
>  static const struct snd_kcontrol_new g12a_toacodec_out_enable =
>  	SOC_DAPM_SINGLE_AUTODISABLE("Switch", TOACODEC_CTRL0,
>  				    CTRL0_ENABLE_SHIFT, 1, 0);
> @@ -114,6 +133,13 @@ static const struct snd_soc_dapm_widget g12a_toacodec_widgets[] = {
>  			    &g12a_toacodec_out_enable),
>  };
>  
> +static const struct snd_soc_dapm_widget sm1_toacodec_widgets[] = {
> +	SND_SOC_DAPM_MUX("SRC", SND_SOC_NOPM, 0, 0,
> +			 &sm1_toacodec_mux),
> +	SND_SOC_DAPM_SWITCH("OUT EN", SND_SOC_NOPM, 0, 0,
> +			    &g12a_toacodec_out_enable),
> +};
> +
>  static int g12a_toacodec_input_hw_params(struct snd_pcm_substream *substream,
>  					 struct snd_pcm_hw_params *params,
>  					 struct snd_soc_dai *dai)
> @@ -184,6 +210,13 @@ static int g12a_toacodec_component_probe(struct snd_soc_component *c)
>  				       CTRL0_BLK_CAP_INV);
>  }
>  
> +static int sm1_toacodec_component_probe(struct snd_soc_component *c)
> +{
> +	/* Initialize the static clock parameters */
> +	return snd_soc_component_write(c, TOACODEC_CTRL0,
> +				       CTRL0_BLK_CAP_INV_SM1);
> +}
> +
>  static const struct snd_soc_dapm_route g12a_toacodec_routes[] = {
>  	{ "SRC", "I2S A", "IN A Playback" },
>  	{ "SRC", "I2S B", "IN B Playback" },
> @@ -196,6 +229,10 @@ static const struct snd_kcontrol_new g12a_toacodec_controls[] = {
>  	SOC_SINGLE("Lane Select", TOACODEC_CTRL0, CTRL0_LANE_SEL, 3, 0),
>  };
>  
> +static const struct snd_kcontrol_new sm1_toacodec_controls[] = {
> +	SOC_SINGLE("Lane Select", TOACODEC_CTRL0, CTRL0_LANE_SEL_SM1, 3, 0),
> +};
> +
>  static const struct snd_soc_component_driver g12a_toacodec_component_drv = {
>  	.probe			= g12a_toacodec_component_probe,
>  	.controls		= g12a_toacodec_controls,
> @@ -208,6 +245,18 @@ static const struct snd_soc_component_driver g12a_toacodec_component_drv = {
>  	.non_legacy_dai_naming	= 1,
>  };
>  
> +static const struct snd_soc_component_driver sm1_toacodec_component_drv = {
> +	.probe			= sm1_toacodec_component_probe,
> +	.controls		= sm1_toacodec_controls,
> +	.num_controls		= ARRAY_SIZE(sm1_toacodec_controls),
> +	.dapm_widgets		= sm1_toacodec_widgets,
> +	.num_dapm_widgets	= ARRAY_SIZE(sm1_toacodec_widgets),
> +	.dapm_routes		= g12a_toacodec_routes,
> +	.num_dapm_routes	= ARRAY_SIZE(g12a_toacodec_routes),
> +	.endianness		= 1,
> +	.non_legacy_dai_naming	= 1,
> +};
> +
>  static const struct regmap_config g12a_toacodec_regmap_cfg = {
>  	.reg_bits	= 32,
>  	.val_bits	= 32,
> @@ -215,16 +264,29 @@ static const struct regmap_config g12a_toacodec_regmap_cfg = {
>  };
>  
>  static const struct g12a_toacodec_match_data g12a_toacodec_match_data = {
> +	.component_drv	= &g12a_toacodec_component_drv,
>  	.field_dat_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_DAT_SEL_LSB, CTRL0_DAT_SEL_MSB),
>  	.field_lrclk_sel = REG_FIELD(TOACODEC_CTRL0, CTRL0_LRCLK_SEL_LSB, CTRL0_LRCLK_SEL_MSB),
>  	.field_bclk_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_BCLK_SEL_LSB, CTRL0_BCLK_SEL_MSB),
>  };
>  
> +static const struct g12a_toacodec_match_data sm1_toacodec_match_data = {
> +	.component_drv	= &sm1_toacodec_component_drv,
> +	.field_dat_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_DAT_SEL_SM1_LSB, CTRL0_DAT_SEL_SM1_MSB),
> +	.field_lrclk_sel = REG_FIELD(TOACODEC_CTRL0, CTRL0_LRCLK_SEL_SM1_LSB,
> +				     CTRL0_LRCLK_SEL_SM1_MSB),
> +	.field_bclk_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_BCLK_SEL_LSB, CTRL0_BCLK_SEL_SM1_MSB),
> +};
> +
>  static const struct of_device_id g12a_toacodec_of_match[] = {
>  	{
>  		.compatible = "amlogic,g12a-toacodec",
>  		.data = &g12a_toacodec_match_data,
>  	},
> +	{
> +		.compatible = "amlogic,sm1-toacodec",
> +		.data = &sm1_toacodec_match_data,
> +	},
>  	{}
>  };
>  MODULE_DEVICE_TABLE(of, g12a_toacodec_of_match);
> @@ -278,7 +340,7 @@ static int g12a_toacodec_probe(struct platform_device *pdev)
>  		return PTR_ERR(priv->field_bclk_sel);
>  
>  	return devm_snd_soc_register_component(dev,
> -			&g12a_toacodec_component_drv, g12a_toacodec_dai_drv,
> +			data->component_drv, g12a_toacodec_dai_drv,
>  			ARRAY_SIZE(g12a_toacodec_dai_drv));
>  }
>  
> 

Oops, spurious one, please ignore it.

Neil

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] sound: meson: g12a-toacodec: add support for SM1 TOACODEC
  2021-05-05  7:27   ` Neil Armstrong
@ 2021-05-07  7:38     ` Jerome Brunet
  0 siblings, 0 replies; 6+ messages in thread
From: Jerome Brunet @ 2021-05-07  7:38 UTC (permalink / raw)
  To: Neil Armstrong, broonie
  Cc: alsa-devel, linux-amlogic, linux-arm-kernel, linux-kernel


On Wed 05 May 2021 at 09:27, Neil Armstrong <narmstrong@baylibre.com> wrote:

> On 05/05/2021 09:26, Neil Armstrong wrote:
>> This adds support for the TOACODEC found in Amlogic SM1 SoCs.
>> 
>> The bits are shifted for more selection of clock sources, so this only
>> maps the same support for G12A to the SM1 bits.
>> 
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>>  sound/soc/meson/g12a-toacodec.c | 64 ++++++++++++++++++++++++++++++++-
>>  1 file changed, 63 insertions(+), 1 deletion(-)
>> 
>> diff --git a/sound/soc/meson/g12a-toacodec.c b/sound/soc/meson/g12a-toacodec.c
>> index 2084c9542c9c..5437ecba9c47 100644
>> --- a/sound/soc/meson/g12a-toacodec.c
>> +++ b/sound/soc/meson/g12a-toacodec.c
>> @@ -21,13 +21,22 @@
>>  
>>  #define TOACODEC_CTRL0			0x0
>>  #define  CTRL0_ENABLE_SHIFT		31
>> +#define  CTRL0_DAT_SEL_SM1_MSB		19
>> +#define  CTRL0_DAT_SEL_SM1_LSB		18
>>  #define  CTRL0_DAT_SEL_MSB		15
>>  #define  CTRL0_DAT_SEL_LSB		14
>> +#define  CTRL0_LANE_SEL_SM1		16
>>  #define  CTRL0_LANE_SEL			12
>> +#define  CTRL0_LRCLK_SEL_SM1_MSB	14
>> +#define  CTRL0_LRCLK_SEL_SM1_LSB	12
>>  #define  CTRL0_LRCLK_SEL_MSB		9
>>  #define  CTRL0_LRCLK_SEL_LSB		8
>> +#define  CTRL0_LRCLK_INV_SM1		BIT(10)
>> +#define  CTRL0_BLK_CAP_INV_SM1		BIT(9)
>>  #define  CTRL0_BLK_CAP_INV		BIT(7)
>> +#define  CTRL0_BCLK_O_INV_SM1		BIT(8)
>>  #define  CTRL0_BCLK_O_INV		BIT(6)
>> +#define  CTRL0_BCLK_SEL_SM1_MSB		6
>>  #define  CTRL0_BCLK_SEL_MSB		5
>>  #define  CTRL0_BCLK_SEL_LSB		4
>>  #define  CTRL0_MCLK_SEL			GENMASK(2, 0)
>> @@ -41,6 +50,7 @@ struct g12a_toacodec {
>>  };
>>  
>>  struct g12a_toacodec_match_data {
>> +	const struct snd_soc_component_driver *component_drv;
>>  	struct reg_field field_dat_sel;
>>  	struct reg_field field_lrclk_sel;
>>  	struct reg_field field_bclk_sel;
>> @@ -98,11 +108,20 @@ static SOC_ENUM_SINGLE_DECL(g12a_toacodec_mux_enum, TOACODEC_CTRL0,
>>  			    CTRL0_DAT_SEL_LSB,
>>  			    g12a_toacodec_mux_texts);
>>  
>> +static SOC_ENUM_SINGLE_DECL(sm1_toacodec_mux_enum, TOACODEC_CTRL0,
>> +			    CTRL0_DAT_SEL_SM1_LSB,
>> +			    g12a_toacodec_mux_texts);
>> +
>>  static const struct snd_kcontrol_new g12a_toacodec_mux =
>>  	SOC_DAPM_ENUM_EXT("Source", g12a_toacodec_mux_enum,
>>  			  snd_soc_dapm_get_enum_double,
>>  			  g12a_toacodec_mux_put_enum);
>>  
>> +static const struct snd_kcontrol_new sm1_toacodec_mux =
>> +	SOC_DAPM_ENUM_EXT("Source", sm1_toacodec_mux_enum,
>> +			  snd_soc_dapm_get_enum_double,
>> +			  g12a_toacodec_mux_put_enum);
>> +
>>  static const struct snd_kcontrol_new g12a_toacodec_out_enable =
>>  	SOC_DAPM_SINGLE_AUTODISABLE("Switch", TOACODEC_CTRL0,
>>  				    CTRL0_ENABLE_SHIFT, 1, 0);
>> @@ -114,6 +133,13 @@ static const struct snd_soc_dapm_widget g12a_toacodec_widgets[] = {
>>  			    &g12a_toacodec_out_enable),
>>  };
>>  
>> +static const struct snd_soc_dapm_widget sm1_toacodec_widgets[] = {
>> +	SND_SOC_DAPM_MUX("SRC", SND_SOC_NOPM, 0, 0,
>> +			 &sm1_toacodec_mux),
>> +	SND_SOC_DAPM_SWITCH("OUT EN", SND_SOC_NOPM, 0, 0,
>> +			    &g12a_toacodec_out_enable),
>> +};
>> +
>>  static int g12a_toacodec_input_hw_params(struct snd_pcm_substream *substream,
>>  					 struct snd_pcm_hw_params *params,
>>  					 struct snd_soc_dai *dai)
>> @@ -184,6 +210,13 @@ static int g12a_toacodec_component_probe(struct snd_soc_component *c)
>>  				       CTRL0_BLK_CAP_INV);
>>  }
>>  
>> +static int sm1_toacodec_component_probe(struct snd_soc_component *c)
>> +{
>> +	/* Initialize the static clock parameters */
>> +	return snd_soc_component_write(c, TOACODEC_CTRL0,
>> +				       CTRL0_BLK_CAP_INV_SM1);
>> +}
>> +
>>  static const struct snd_soc_dapm_route g12a_toacodec_routes[] = {
>>  	{ "SRC", "I2S A", "IN A Playback" },
>>  	{ "SRC", "I2S B", "IN B Playback" },
>> @@ -196,6 +229,10 @@ static const struct snd_kcontrol_new g12a_toacodec_controls[] = {
>>  	SOC_SINGLE("Lane Select", TOACODEC_CTRL0, CTRL0_LANE_SEL, 3, 0),
>>  };
>>  
>> +static const struct snd_kcontrol_new sm1_toacodec_controls[] = {
>> +	SOC_SINGLE("Lane Select", TOACODEC_CTRL0, CTRL0_LANE_SEL_SM1, 3, 0),
>> +};
>> +
>>  static const struct snd_soc_component_driver g12a_toacodec_component_drv = {
>>  	.probe			= g12a_toacodec_component_probe,
>>  	.controls		= g12a_toacodec_controls,
>> @@ -208,6 +245,18 @@ static const struct snd_soc_component_driver g12a_toacodec_component_drv = {
>>  	.non_legacy_dai_naming	= 1,
>>  };
>>  
>> +static const struct snd_soc_component_driver sm1_toacodec_component_drv = {
>> +	.probe			= sm1_toacodec_component_probe,
>> +	.controls		= sm1_toacodec_controls,
>> +	.num_controls		= ARRAY_SIZE(sm1_toacodec_controls),
>> +	.dapm_widgets		= sm1_toacodec_widgets,
>> +	.num_dapm_widgets	= ARRAY_SIZE(sm1_toacodec_widgets),
>> +	.dapm_routes		= g12a_toacodec_routes,
>> +	.num_dapm_routes	= ARRAY_SIZE(g12a_toacodec_routes),
>> +	.endianness		= 1,
>> +	.non_legacy_dai_naming	= 1,
>> +};
>> +
>>  static const struct regmap_config g12a_toacodec_regmap_cfg = {
>>  	.reg_bits	= 32,
>>  	.val_bits	= 32,
>> @@ -215,16 +264,29 @@ static const struct regmap_config g12a_toacodec_regmap_cfg = {
>>  };
>>  
>>  static const struct g12a_toacodec_match_data g12a_toacodec_match_data = {
>> +	.component_drv	= &g12a_toacodec_component_drv,
>>  	.field_dat_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_DAT_SEL_LSB, CTRL0_DAT_SEL_MSB),
>>  	.field_lrclk_sel = REG_FIELD(TOACODEC_CTRL0, CTRL0_LRCLK_SEL_LSB, CTRL0_LRCLK_SEL_MSB),
>>  	.field_bclk_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_BCLK_SEL_LSB, CTRL0_BCLK_SEL_MSB),
>>  };
>>  
>> +static const struct g12a_toacodec_match_data sm1_toacodec_match_data = {
>> +	.component_drv	= &sm1_toacodec_component_drv,
>> +	.field_dat_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_DAT_SEL_SM1_LSB, CTRL0_DAT_SEL_SM1_MSB),
>> +	.field_lrclk_sel = REG_FIELD(TOACODEC_CTRL0, CTRL0_LRCLK_SEL_SM1_LSB,
>> +				     CTRL0_LRCLK_SEL_SM1_MSB),
>> +	.field_bclk_sel	= REG_FIELD(TOACODEC_CTRL0, CTRL0_BCLK_SEL_LSB, CTRL0_BCLK_SEL_SM1_MSB),
>> +};

If you make another round, the LSB/MSB defines don't really help
readability here (and in the other patch)

Feel free to put the values directly.

>> +
>>  static const struct of_device_id g12a_toacodec_of_match[] = {
>>  	{
>>  		.compatible = "amlogic,g12a-toacodec",
>>  		.data = &g12a_toacodec_match_data,
>>  	},
>> +	{
>> +		.compatible = "amlogic,sm1-toacodec",
>> +		.data = &sm1_toacodec_match_data,
>> +	},
>>  	{}
>>  };
>>  MODULE_DEVICE_TABLE(of, g12a_toacodec_of_match);
>> @@ -278,7 +340,7 @@ static int g12a_toacodec_probe(struct platform_device *pdev)
>>  		return PTR_ERR(priv->field_bclk_sel);
>>  
>>  	return devm_snd_soc_register_component(dev,
>> -			&g12a_toacodec_component_drv, g12a_toacodec_dai_drv,
>> +			data->component_drv, g12a_toacodec_dai_drv,
>>  			ARRAY_SIZE(g12a_toacodec_dai_drv));
>>  }
>>  
>> 
>
> Oops, spurious one, please ignore it.
>
> Neil


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-07  7:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05  7:26 [PATCH v2 0/2] ASoC: meson: g12a-toacodec: add support for SM1 Neil Armstrong
2021-05-05  7:26 ` [PATCH v2 1/2] ASoC: meson: g12a-toacodec: use regmap fields to prepare SM1 support Neil Armstrong
2021-05-05  7:26 ` [PATCH v2 2/2] ASoC: meson: g12a-toacodec: add support for SM1 TOACODEC Neil Armstrong
2021-05-05  7:26 ` [PATCH v2 2/2] sound: " Neil Armstrong
2021-05-05  7:27   ` Neil Armstrong
2021-05-07  7:38     ` Jerome Brunet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).