summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/cs35l41.c
diff options
context:
space:
mode:
authorLucas Tanure <tanureal@opensource.cirrus.com>2022-04-13 10:37:15 +0200
committerTakashi Iwai <tiwai@suse.de>2022-04-13 10:42:33 +0200
commitfcad8950a50dec5962b1b7b18a285daf7c137178 (patch)
treefd36f29abd6ed195c37e7d3929315486b5946fb0 /sound/soc/codecs/cs35l41.c
parentALSA: cs35l41: Check hw_config before using it (diff)
downloadlinux-fcad8950a50dec5962b1b7b18a285daf7c137178.tar.xz
linux-fcad8950a50dec5962b1b7b18a285daf7c137178.zip
ALSA: cs35l41: Move cs35l41_gpio_config to shared lib
ASoC and HDA can use a single function to configure the chip gpios. Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220413083728.10730-4-tanureal@opensource.cirrus.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/soc/codecs/cs35l41.c')
-rw-r--r--sound/soc/codecs/cs35l41.c44
1 files changed, 1 insertions, 43 deletions
diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c
index 90dec80707ea..d25689fe0c60 100644
--- a/sound/soc/codecs/cs35l41.c
+++ b/sound/soc/codecs/cs35l41.c
@@ -1017,48 +1017,6 @@ static int cs35l41_set_pdata(struct cs35l41_private *cs35l41)
return 0;
}
-static int cs35l41_gpio_config(struct cs35l41_private *cs35l41)
-{
- struct cs35l41_gpio_cfg *gpio1 = &cs35l41->hw_cfg.gpio1;
- struct cs35l41_gpio_cfg *gpio2 = &cs35l41->hw_cfg.gpio2;
- int irq_pol = IRQF_TRIGGER_NONE;
-
- regmap_update_bits(cs35l41->regmap, CS35L41_GPIO1_CTRL1,
- CS35L41_GPIO_POL_MASK | CS35L41_GPIO_DIR_MASK,
- gpio1->pol_inv << CS35L41_GPIO_POL_SHIFT |
- !gpio1->out_en << CS35L41_GPIO_DIR_SHIFT);
-
- regmap_update_bits(cs35l41->regmap, CS35L41_GPIO2_CTRL1,
- CS35L41_GPIO_POL_MASK | CS35L41_GPIO_DIR_MASK,
- gpio2->pol_inv << CS35L41_GPIO_POL_SHIFT |
- !gpio2->out_en << CS35L41_GPIO_DIR_SHIFT);
-
- if (gpio1->valid)
- regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL,
- CS35L41_GPIO1_CTRL_MASK,
- gpio1->func << CS35L41_GPIO1_CTRL_SHIFT);
-
- if (gpio2->valid) {
- regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL,
- CS35L41_GPIO2_CTRL_MASK,
- gpio2->func << CS35L41_GPIO2_CTRL_SHIFT);
-
- switch (gpio2->func) {
- case CS35L41_GPIO2_INT_PUSH_PULL_LOW:
- case CS35L41_GPIO2_INT_OPEN_DRAIN:
- irq_pol = IRQF_TRIGGER_LOW;
- break;
- case CS35L41_GPIO2_INT_PUSH_PULL_HIGH:
- irq_pol = IRQF_TRIGGER_HIGH;
- break;
- default:
- break;
- }
- }
-
- return irq_pol;
-}
-
static int cs35l41_component_probe(struct snd_soc_component *component)
{
struct cs35l41_private *cs35l41 = snd_soc_component_get_drvdata(component);
@@ -1366,7 +1324,7 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, const struct cs35l41_hw_cfg *
cs35l41_test_key_lock(cs35l41->dev, cs35l41->regmap);
- irq_pol = cs35l41_gpio_config(cs35l41);
+ irq_pol = cs35l41_gpio_config(cs35l41->regmap, &cs35l41->hw_cfg);
/* Set interrupt masks for critical errors */
regmap_write(cs35l41->regmap, CS35L41_IRQ1_MASK1,