linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: da9062: support SMBus and I2C mode
@ 2021-11-24  6:51 Andrej Picej
  2021-11-24  9:29 ` Adam Thomson
  2021-11-29 12:12 ` Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Andrej Picej @ 2021-11-24  6:51 UTC (permalink / raw)
  To: support.opensource, lee.jones; +Cc: linux-kernel, andrej.picej

Enable the I2C bus mode if I2C_FUNC_I2C is set. Based on da6093 commit:
"586478bfc9f7 mfd: da9063: Support SMBus and I2C mode"

Signed-off-by: Andrej Picej <andrej.picej@norik.com>
---
 drivers/mfd/da9062-core.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
index 01f8e10dfa55..2774b2cbaea6 100644
--- a/drivers/mfd/da9062-core.c
+++ b/drivers/mfd/da9062-core.c
@@ -556,6 +556,7 @@ static const struct regmap_range da9062_aa_writeable_ranges[] = {
 	regmap_reg_range(DA9062AA_VBUCK3_B, DA9062AA_VBUCK3_B),
 	regmap_reg_range(DA9062AA_VLDO1_B, DA9062AA_VLDO4_B),
 	regmap_reg_range(DA9062AA_BBAT_CONT, DA9062AA_BBAT_CONT),
+	regmap_reg_range(DA9062AA_CONFIG_J, DA9062AA_CONFIG_J),
 	regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19),
 };
 
@@ -674,6 +675,17 @@ static int da9062_i2c_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
+	/* If SMBus is not available and only I2C is possible, enter I2C mode */
+	if (i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C)) {
+		dev_info(chip->dev, "Entering I2C mode!\n");
+		ret = regmap_clear_bits(chip->regmap, DA9062AA_CONFIG_J,
+					DA9062AA_TWOWIRE_TO_MASK);
+		if (ret < 0) {
+			dev_err(chip->dev, "Failed to set Two-Wire Bus Mode.\n");
+			return ret;
+		}
+	}
+
 	ret = da9062_clear_fault_log(chip);
 	if (ret < 0)
 		dev_warn(chip->dev, "Cannot clear fault log\n");
-- 
2.25.1


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

* RE: [PATCH] mfd: da9062: support SMBus and I2C mode
  2021-11-24  6:51 [PATCH] mfd: da9062: support SMBus and I2C mode Andrej Picej
@ 2021-11-24  9:29 ` Adam Thomson
  2021-11-29 12:12 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Adam Thomson @ 2021-11-24  9:29 UTC (permalink / raw)
  To: Andrej Picej, Support Opensource, lee.jones; +Cc: linux-kernel

On 24 November 2021 06:51, Andrej Picej wrote:

> Enable the I2C bus mode if I2C_FUNC_I2C is set. Based on da6093 commit:
> "586478bfc9f7 mfd: da9063: Support SMBus and I2C mode"
> 
> Signed-off-by: Andrej Picej <andrej.picej@norik.com>

Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

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

* Re: [PATCH] mfd: da9062: support SMBus and I2C mode
  2021-11-24  6:51 [PATCH] mfd: da9062: support SMBus and I2C mode Andrej Picej
  2021-11-24  9:29 ` Adam Thomson
@ 2021-11-29 12:12 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2021-11-29 12:12 UTC (permalink / raw)
  To: Andrej Picej; +Cc: support.opensource, linux-kernel

On Wed, 24 Nov 2021, Andrej Picej wrote:

> Enable the I2C bus mode if I2C_FUNC_I2C is set. Based on da6093 commit:
> "586478bfc9f7 mfd: da9063: Support SMBus and I2C mode"
> 
> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
> ---
>  drivers/mfd/da9062-core.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2021-11-29 13:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24  6:51 [PATCH] mfd: da9062: support SMBus and I2C mode Andrej Picej
2021-11-24  9:29 ` Adam Thomson
2021-11-29 12:12 ` Lee Jones

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).