Skip to contentSkip to conversation

mfd: da9052: Fix SPI access and IRQ config

PATCH Applied Adam Ward 2 participants 5 messages Mar 4, 2015

Subsystems (2)
lore
Share & tools
lore

Adam Ward

author
#0 lore raw

cover mfd: da9052: Fix SPI access and IRQ config

Hi,

This patch set is based on mainline v4.0-rc2.

It corrects the SPI configuration to support both the basic hardware requirements and the defined OTP settings the device will be delivered with, to customers using an SPI configuration.

It also configures the IRQ so the RTC component can perform wake-from-suspend, which is established in a separate patch set for that subsystem, to follow.

Best regards,
Adam

Adam Ward (2):
mfd: da9052: Fix register access via SPI
mfd: da9052: Register ability of device to cause a wake-up interrupt

 drivers/mfd/da9052-irq.c | 2 ++
 drivers/mfd/da9052-spi.c | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
Signature · 1 line
end-of-patch for mfd: da9052: Fix SPI access and IRQ config
author
#1 lore raw

PATCH 1/2 mfd: da9052: Fix register access via SPI

The range of registers used by this driver exceeds that available via SPI with no paging (127), so we have to override the values from the default config which is set-up for I2C access. Also change SPI settings to match device's recommended OTP values.

---
 drivers/mfd/da9052-spi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mfd/da9052-spi.c +5 -1
index 45ae0b7..b5de8a6 100644
@@ -32,7 +32,7 @@ static int da9052_spi_probe(struct spi_device *spi)
 	if (!da9052)
 		return -ENOMEM;
 
-	spi->mode = SPI_MODE_0 | SPI_CPOL;
+	spi->mode = SPI_MODE_0;
 	spi->bits_per_word = 8;
 	spi_setup(spi);
 
@@ -43,6 +43,10 @@ static int da9052_spi_probe(struct spi_device *spi)
 
 	config = da9052_regmap_config;
 	config.read_flag_mask = 1;
+	config.reg_bits = 7;
+	config.pad_bits = 1;
+	config.val_bits = 8;
+	config.use_single_rw = 1;
 
 	da9052->regmap = devm_regmap_init_spi(spi, &config);
 	if (IS_ERR(da9052->regmap)) {
Signature · 1 line
end-of-patch for mfd: da9052: Fix SPI access and IRQ config
#2 lore raw

Re: [PATCH v1 1/2] mfd: da9052: Fix register access via SPI

Quoted 7 lines · Adam Ward

The range of registers used by this driver exceeds that available via SPI with no paging (127), so we have to override the values from the default config which is set-up for I2C access. Also change SPI settings to match device's recommended OTP values.

I'd be worried if you hadn't tested it.

In future, Signed-off-by is sufficient.

Patch applied, thanks.

Quoted 28 lines
---
 drivers/mfd/da9052-spi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mfd/da9052-spi.c +5 -1
index 45ae0b7..b5de8a6 100644
@@ -32,7 +32,7 @@ static int da9052_spi_probe(struct spi_device *spi)
 	if (!da9052)
 		return -ENOMEM;
 
-	spi->mode = SPI_MODE_0 | SPI_CPOL;
+	spi->mode = SPI_MODE_0;
 	spi->bits_per_word = 8;
 	spi_setup(spi);
 
@@ -43,6 +43,10 @@ static int da9052_spi_probe(struct spi_device *spi)
 
 	config = da9052_regmap_config;
 	config.read_flag_mask = 1;
+	config.reg_bits = 7;
+	config.pad_bits = 1;
+	config.val_bits = 8;
+	config.use_single_rw = 1;
 
 	da9052->regmap = devm_regmap_init_spi(spi, &config);
 	if (IS_ERR(da9052->regmap)) {
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#3 lore raw

PATCH 2/2 mfd: da9052: Register ability of device to cause a wake-up interrupt

In reply to Adam Ward
---
 drivers/mfd/da9052-irq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mfd/da9052-irq.c +2 -0
index 57ae784..e65ca19 100644
@@ -262,6 +262,8 @@ int da9052_irq_init(struct da9052 *da9052)
 		goto regmap_err;
 	}
 
+	enable_irq_wake(da9052->chip_irq);
+
 	ret = da9052_request_irq(da9052, DA9052_IRQ_ADC_EOM, "adc-irq",
 			    da9052_auxadc_irq, da9052);
 
Signature · 1 line
end-of-patch for mfd: da9052: Fix SPI access and IRQ config
Applied
#4 lore raw

Re: [PATCH v1 2/2] mfd: da9052: Register ability of device to cause a wake-up interrupt

Quoted 5 lines · Adam Ward
---
 drivers/mfd/da9052-irq.c | 2 ++
 1 file changed, 2 insertions(+)

Applied, thanks.

Quoted 13 lines
drivers/mfd/da9052-irq.c +2 -0
index 57ae784..e65ca19 100644
@@ -262,6 +262,8 @@ int da9052_irq_init(struct da9052 *da9052)
 		goto regmap_err;
 	}
 
+	enable_irq_wake(da9052->chip_irq);
+
 	ret = da9052_request_irq(da9052, DA9052_IRQ_ADC_EOM, "adc-irq",
 			    da9052_auxadc_irq, da9052);
 
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog