da9055: Driver initialisation fixes, add DT support
Subsystems (9)
v2 cover da9055: Driver initialisation fixes, add DT support
This patch series provides the following updates for DA9055 drivers:
- Fixes an issue with da9055 driver initialisation (conflicting device ids) of PMIC (MFD) and CODEC drivers which means they cannot be used together on the same I2C bus.
- Add initial DT support for DA9055 related drivers, including binding documentation.
- Remove use of regmap_irq_get_virq() in driver probes which was conflicting with use of platform_get_irq_byname(). platform_get_irq_byname() already returns the VIRQ number due to MFD core translation so using regmap_irq_get_virq() on that returned value results in an incorrect IRQ being requested. The driver probes then fail because of this.
[Changes since v1]:
- Regulator:
* fixed coding style issue (lack of braces for if,else statement)
* removal of 'ifdef' around DT related headers
* Use of 'of_regulator_match()' for retrieving regulator related info from DT nodes.
- General:
* Instead of removing platform_get_irq_byname() usage and device resources to fix IRQ conflict in driver probes, now removed 'regmap_irq_get_virq()' as advised. This has been tested on target for both DT and non-DT setups and works as expected.
Adam Thomson (8):
ASoC: da9055: Fix device registration of PMIC and CODEC devices
ASoC: da9055: Add DT support for CODEC
mfd: da9055: Add DT support for PMIC
regulator: da9055: Add DT support
onkey: da9055: Remove use of regmap_irq_get_virq()
hwmon: da9055: Remove use of regmap_irq_get_virq()
rtc: da9055: Remove use of regmap_irq_get_virq()
regulator: da9055: Remove use of regmap_irq_get_virq()
Documentation/devicetree/bindings/mfd/da9055.txt | 73 ++++++++++++++++++++ Documentation/devicetree/bindings/sound/da9055.txt | 22 ++++++ drivers/hwmon/da9055-hwmon.c | 4 - drivers/input/misc/da9055_onkey.c | 1 - drivers/mfd/da9055-i2c.c | 20 +++++- drivers/regulator/da9055-regulator.c | 73 ++++++++++++++++++-- drivers/rtc/rtc-da9055.c | 4 +- sound/soc/codecs/da9055.c | 19 +++++- 8 files changed, 201 insertions(+), 15 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/da9055.txt create mode 100644 Documentation/devicetree/bindings/sound/da9055.txt
PATCH v2 1/8 ASoC: da9055: Fix device registration of PMIC and CODEC devices
Currently the I2C device Ids conflict for the MFD and CODEC so cannot be both instantiated on one platform. This patch updates the Ids and names to make them unique from each other.
It should be noted that the I2C addresses for both PMIC and CODEC are modifiable so instantiation of the two are kept as separate devices, rather than instantiating the CODEC from the MFD code.
--- drivers/mfd/da9055-i2c.c | 12 ++++++++++-- sound/soc/codecs/da9055.c | 11 +++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-)
drivers/mfd/da9055-i2c.c +10 -2
@@ -53,17 +53,25 @@ static int da9055_i2c_remove(struct i2c_client *i2c)return 0 ; } +/* +* DO NOT change the device Ids. The naming is intentionally specific as both +* the PMIC and CODEC parts of this chip are instantiated separately as I2C +* devices (both have configurable I2C addresses, and are to all intents and +* purposes separate). As a result there are specific DA9055 ids for PMIC +* and CODEC, which must be different to operate together. +*/ static struct i2c_device_id da9055_i2c_id[] = { - {"da9055" ,0 }, + {"da9055-pmic" ,0 }, { } }; +MODULE_DEVICE_TABLE (i2c, da9055_i2c_id);static struct i2c_driver da9055_i2c_driver = { .probe = da9055_i2c_probe, .remove = da9055_i2c_remove, .id_table = da9055_i2c_id, .driver = { - .name ="da9055" , + .name ="da9055-pmic" , .owner =THIS_MODULE , }, };
sound/soc/codecs/da9055.c +9 -2
@@ -1523,8 +1523,15 @@ static int da9055_remove(struct i2c_client *client)return 0 ; } +/* +* DO NOT change the device Ids. The naming is intentionally specific as both +* the CODEC and PMIC parts of this chip are instantiated separately as I2C +* devices (both have configurable I2C addresses, and are to all intents and +* purposes separate). As a result there are specific DA9055 Ids for CODEC +* and PMIC, which must be different to operate together. +*/ static const struct i2c_device_id da9055_i2c_id[] = { - {"da9055" ,0 }, + {"da9055-codec" ,0 }, { } };MODULE_DEVICE_TABLE (i2c, da9055_i2c_id);
@@ -1532,7 +1539,7 @@ MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);/* I2C codec control layer */ static struct i2c_driver da9055_i2c_driver = { .driver = { - .name ="da9055" , + .name ="da9055-codec" , .owner =THIS_MODULE , }, .probe = da9055_i2c_probe,
--
1.7.0.4
Re: [PATCH v2 1/8] ASoC: da9055: Fix device registration of PMIC and CODEC devices
Quoted 20 lines
Currently the I2C device Ids conflict for the MFD and CODEC so cannot be both instantiated on one platform. This patch updates the Ids and names to make them unique from each other.
It should be noted that the I2C addresses for both PMIC and CODEC are modifiable so instantiation of the two are kept as separate devices, rather than instantiating the CODEC from the MFD code.
Signed-off-by Adam Thomson <[email protected]>Acked-by Mark Brown <[email protected]>--- drivers/mfd/da9055-i2c.c | 12 ++++++++++-- sound/soc/codecs/da9055.c | 11 +++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-)drivers/mfd/da9055-i2c.c +0
-0
drivers/mfd/da9055-i2c.c static int da9055_i2c_remove(struct i2c_client *i2c) · line 62
Quoted 10 lines
drivers/mfd/da9055-i2c.c +7
-0@@ -53,17 +53,25 @@ static int da9055_i2c_remove(struct i2c_client *i2c)return 0 ; } +/* +* DO NOT change the device Ids. The naming is intentionally specific as both +* the PMIC and CODEC parts of this chip are instantiated separately as I2C +* devices (both have configurable I2C addresses, and are to all intents and +* purposes separate). As a result there are specific DA9055 ids for PMIC +* and CODEC, which must be different to operate together. +*/
I'm not sure this comment is required.
Most device IDs are named this way.
Quoted 22 lines
drivers/mfd/da9055-i2c.c +3
-2static struct i2c_device_id da9055_i2c_id[] = { - {"da9055" ,0 }, + {"da9055-pmic" ,0 }, { } }; +MODULE_DEVICE_TABLE (i2c, da9055_i2c_id);static struct i2c_driver da9055_i2c_driver = { .probe = da9055_i2c_probe, .remove = da9055_i2c_remove, .id_table = da9055_i2c_id, .driver = { - .name ="da9055" , + .name ="da9055-pmic" , .owner =THIS_MODULE , }, };sound/soc/codecs/da9055.c +0
-0
sound/soc/codecs/da9055.c static int da9055_remove(struct i2c_client *client) · line 1532
Quoted 10 lines
sound/soc/codecs/da9055.c +7
-0@@ -1523,8 +1523,15 @@ static int da9055_remove(struct i2c_client *client)return 0 ; } +/* +* DO NOT change the device Ids. The naming is intentionally specific as both +* the CODEC and PMIC parts of this chip are instantiated separately as I2C +* devices (both have configurable I2C addresses, and are to all intents and +* purposes separate). As a result there are specific DA9055 Ids for CODEC +* and PMIC, which must be different to operate together. +*/
And here, really, no need.
Quoted 15 lines
sound/soc/codecs/da9055.c +2
-2static const struct i2c_device_id da9055_i2c_id[] = { - {"da9055" ,0 }, + {"da9055-codec" ,0 }, { } };MODULE_DEVICE_TABLE (i2c, da9055_i2c_id);@@ -1532,7 +1539,7 @@ MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);/* I2C codec control layer */ static struct i2c_driver da9055_i2c_driver = { .driver = { - .name ="da9055" , + .name ="da9055-codec" , .owner =THIS_MODULE , }, .probe = da9055_i2c_probe,
Signature · 8 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Mark Brown
maintainerRe: [PATCH v2 1/8] ASoC: da9055: Fix device registration of PMIC and CODEC devices
Quoted 9 lines · Lee Jones
Quoted 7 lines
+/*
+ * DO NOT change the device Ids. The naming is intentionally specific as both
+ * the PMIC and CODEC parts of this chip are instantiated separately as I2C
+ * devices (both have configurable I2C addresses, and are to all intents and
+ * purposes separate). As a result there are specific DA9055 ids for PMIC
+ * and CODEC, which must be different to operate together.
+ */I'm not sure this comment is required.
They are, we've already had the suffixes removed from both PMIC and CODEC drivers by people doing code review causing the drivers to fail to load for several kernel releases (this should be tagged to stable as a result).
Quoted 1 line
Most device IDs are named this way.
Having the suffix on a subdevice would be normal but it's not normal for the primary I2C device, usually you can just put the part number in.
Re: [PATCH v2 1/8] ASoC: da9055: Fix device registration of PMIC and CODEC devices
Quoted 15 lines
Quoted 9 lines
Quoted 7 lines
+/*
+ * DO NOT change the device Ids. The naming is intentionally specific as both
+ * the PMIC and CODEC parts of this chip are instantiated separately as I2C
+ * devices (both have configurable I2C addresses, and are to all intents and
+ * purposes separate). As a result there are specific DA9055 ids for PMIC
+ * and CODEC, which must be different to operate together.
+ */I'm not sure this comment is required.
They are, we've already had the suffixes removed from both PMIC and CODEC drivers by people doing code review causing the drivers to fail to load for several kernel releases (this should be tagged to stable as a result).
Quoted 4 lines
Quoted 1 line
Most device IDs are named this way.
Having the suffix on a subdevice would be normal but it's not normal for the primary I2C device, usually you can just put the part number in.
Okay, no problem then. Ignore my last.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v2 1/8] ASoC: da9055: Fix device registration of PMIC and CODEC devices
In reply to Adam ThomsonQuoted 3 lines · Adam Thomson
Currently the I2C device Ids conflict for the MFD and CODEC so cannot be both instantiated on one platform. This patch updates the Ids and names to make them unique from each other.
Applied, thanks.
Re: [PATCH v2 1/8] ASoC: da9055: Fix device registration of PMIC and CODEC devices
Quoted 5 lines
Quoted 3 lines
Currently the I2C device Ids conflict for the MFD and CODEC so cannot be both instantiated on one platform. This patch updates the Ids and names to make them unique from each other.
Applied, thanks.
Actually, do you mind if I take this and apply it to an immutable?
I'd rather not be on the wrong end of some wrath, due to not playing the game properly.
Signature · 8 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Mark Brown
maintainerRe: [PATCH v2 1/8] ASoC: da9055: Fix device registration of PMIC and CODEC devices
Quoted 6 lines · Lee Jones
Quoted 1 line
Applied, thanks.
Actually, do you mind if I take this and apply it to an immutable?
I'd rather not be on the wrong end of some wrath, due to not playing the game properly.
OK, but it does need to go in as a fix targetted for stable.
Re: [PATCH v2 1/8] ASoC: da9055: Fix device registration of PMIC and CODEC devices
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Applied, thanks.
Actually, do you mind if I take this and apply it to an immutable?
I'd rather not be on the wrong end of some wrath, due to not playing the game properly.
OK, but it does need to go in as a fix targetted for stable.
Ah, in which case there's no need, as I don't have anything in my -fixes branch with touches this file. Simply take it in, no problem.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Mark Brown
maintainerRe: [PATCH v2 1/8] ASoC: da9055: Fix device registration of PMIC and CODEC devices
Quoted 4 lines · Lee Jones
Quoted 1 line
OK, but it does need to go in as a fix targetted for stable.
Ah, in which case there's no need, as I don't have anything in my -fixes branch with touches this file. Simply take it in, no problem.
I'll do that - thanks for confirming.
PATCH v2 2/8 ASoC: da9055: Add DT support for CODEC
In reply to Adam Thomson--- Documentation/devicetree/bindings/sound/da9055.txt | 22 ++++++++++++++++++++ sound/soc/codecs/da9055.c | 8 +++++++ 2 files changed, 30 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/da9055.txt
Documentation/devicetree/bindings/sound/da9055.txt new file +22 -0
@@ -0,0 +1,22 @@ +* Dialog DA9055 Audio CODEC + +DA9055 provides Audio CODEC support (I2C only). + +The Audio CODEC device in DA9055 has it's own I2C address which is configurable, +so the device is instantiated separately from the PMIC (MFD) device. + +For details on accompanying PMIC I2C device, see the following: +Documentation/devicetree/bindings/mfd/da9055.txt + +Required properties: + + - compatible: "dlg,da9055-codec" + - reg: Specifies the I2C slave address + + +Example: + + codec: da9055-codec@1a { + compatible = "dlg,da9055-codec"; + reg = <0x1a>; + };
sound/soc/codecs/da9055.c +8 -0
@@ -18,6 +18,8 @@#include <linux/regmap.h> #include <linux/slab.h> #include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h>
@@ -1536,11 +1538,17 @@ static const struct i2c_device_id da9055_i2c_id[] = { };MODULE_DEVICE_TABLE (i2c, da9055_i2c_id); +static const struct of_device_id da9055_of_match[] = { + { .compatible ="dlg,da9055-codec" , }, + { } +}; +/* I2C codec control layer */ static struct i2c_driver da9055_i2c_driver = { .driver = { .name ="da9055-codec" , .owner =THIS_MODULE , + .of_match_table =of_match_ptr (da9055_of_match), }, .probe = da9055_i2c_probe, .remove = da9055_remove,
--
1.7.0.4
Mark Brown
maintainerRe: [PATCH v2 2/8] ASoC: da9055: Add DT support for CODEC
Quoted 1 line · Adam Thomson
Signed-off-by Adam Thomson <[email protected]>
This doesn't apply against my current for-next or v3.14-rc1, can you please check and resend?
Mark Brown
maintainerRe: [PATCH v2 2/8] ASoC: da9055: Add DT support for CODEC
Quoted 5 lines · Mark Brown
Quoted 1 line · Adam Thomson
Signed-off-by Adam Thomson <[email protected]>This doesn't apply against my current for-next or v3.14-rc1, can you please check and resend?
Ugh, sorry - it'll be due to patch 1 of course which I'd skipped due to the MFD bit. If you need to resend it's probably easier all round to just send the MFD and ASoC bits of that separately since there's no direct dependency.
RE: [PATCH v2 2/8] ASoC: da9055: Add DT support for CODEC
Quoted 11 lines · Mark Brown
Quoted 5 lines · Mark Brown
Quoted 1 line · Adam Thomson
Signed-off-by Adam Thomson <[email protected]>This doesn't apply against my current for-next or v3.14-rc1, can you please check and resend?
Ugh, sorry - it'll be due to patch 1 of course which I'd skipped due to the MFD bit. If you need to resend it's probably easier all round to just send the MFD and ASoC bits of that separately since there's no direct dependency.
Ok, no problem. Will see what Lee comes back and go from there.
PATCH v2 3/8 mfd: da9055: Add DT support for PMIC
In reply to Adam Thomson--- Documentation/devicetree/bindings/mfd/da9055.txt | 73 ++++++++++++++++++++++ drivers/mfd/da9055-i2c.c | 8 +++ 2 files changed, 81 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/da9055.txt
Documentation/devicetree/bindings/mfd/da9055.txt new file +73 -0
@@ -0,0 +1,73 @@ +* Dialog DA9055 Power Management Integrated Circuit (PMIC) + +DA9055 consists of a large and varied group of sub-devices (I2C Only): + +Device Supply Names Description +------ ------------ ----------- +da9055-gpio : : GPIOs +da9055-regulator : : Regulators +da9055-onkey : : On key +da9055-rtc : : RTC +da9055-hwmon : : ADC +da9055-watchdog : : Watchdog + +The CODEC device in DA9055 has a separate, configurable I2C address and so +is instantiated separately from the PMIC. + +For details on accompanying CODEC I2C device, see the following: +Documentation/devicetree/bindings/sound/da9055.txt + +====== + +Required properties: +- compatible : Should be "dlg,da9055-pmic" +- reg: Specifies the I2C slave address (defaults to 0x5a but can be modified) +- interrupt-parent: Specifies the phandle of the interrupt controller to which + the IRQs from da9055 are delivered to. +- interrupts: IRQ line info for da9055 chip. +- interrupt-controller: da9055 has internal IRQs (has own IRQ domain). +- #interrupt-cells: Should be 1, is the local IRQ number for da9055. + +Sub-nodes: +- regulators : Contain the regulator nodes. The DA9055 regulators are + bound using their names as listed below: + + buck1 : regulator BUCK1 + buck2 : regulator BUCK2 + ldo1 : regulator LDO1 + ldo2 : regulator LDO2 + ldo3 : regulator LDO3 + ldo4 : regulator LDO4 + ldo5 : regulator LDO5 + ldo6 : regulator LDO6 + + The bindings details of individual regulator device can be found in: + Documentation/devicetree/bindings/regulator/regulator.txt + + +Example: + + pmic: da9055-pmic@5a { + compatible = "dlg,da9055-pmic"; + reg = <0x5a>; + interrupt-parent = <&intc>; + interrupts = <5 0x8>; + interrupt-controller; + #interrupt-cells = <1>; + + regulators { + buck1: BUCK1 { + regulator-min-microvolt = <725000>; + regulator-max-microvolt = <2075000>; + }; + + buck2: BUCK2 { + regulator-min-microvolt = <925000>; + regulator-max-microvolt = <2500000>; + }; + ldo1: LDO1 { + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <3300000>; + }; + }; + };
drivers/mfd/da9055-i2c.c +8 -0
@@ -15,6 +15,8 @@#include <linux/device.h> #include <linux/i2c.h> #include <linux/err.h> +#include <linux/of.h> +#include <linux/of_device.h> #include <linux/mfd/da9055/core.h>
@@ -66,6 +68,11 @@ static struct i2c_device_id da9055_i2c_id[] = { };MODULE_DEVICE_TABLE (i2c, da9055_i2c_id); +static const struct of_device_id da9055_of_match[] = { + { .compatible ="dlg,da9055-pmic" , .data = (void *)&da9055_i2c_id[0 ] }, + { } +}; +static struct i2c_driver da9055_i2c_driver = { .probe = da9055_i2c_probe, .remove = da9055_i2c_remove,
@@ -73,6 +80,7 @@ static struct i2c_driver da9055_i2c_driver = { .driver = { .name = "da9055-pmic", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(da9055_of_match), }, };
--
1.7.0.4
Re: [PATCH v2 3/8] mfd: da9055: Add DT support for PMIC
Quoted 4 lines
Signed-off-by Adam Thomson <[email protected]>--- Documentation/devicetree/bindings/mfd/da9055.txt | 73 ++++++++++++++++++++++ drivers/mfd/da9055-i2c.c | 8 +++
Can you break this up please.
Bindings should be separate to the binding document.
Quoted 96 lines
2 files changed, 81 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/da9055.txtDocumentation/devicetree/bindings/mfd/da9055.txt new file +73
-0@@ -0,0 +1,73 @@ +* Dialog DA9055 Power Management Integrated Circuit (PMIC) + +DA9055 consists of a large and varied group of sub-devices (I2C Only): + +Device Supply Names Description +------ ------------ ----------- +da9055-gpio : : GPIOs +da9055-regulator : : Regulators +da9055-onkey : : On key +da9055-rtc : : RTC +da9055-hwmon : : ADC +da9055-watchdog : : Watchdog + +The CODEC device in DA9055 has a separate, configurable I2C address and so +is instantiated separately from the PMIC. + +For details on accompanying CODEC I2C device, see the following: +Documentation/devicetree/bindings/sound/da9055.txt + +====== + +Required properties: +- compatible : Should be "dlg,da9055-pmic" +- reg: Specifies the I2C slave address (defaults to 0x5a but can be modified) +- interrupt-parent: Specifies the phandle of the interrupt controller to which + the IRQs from da9055 are delivered to. +- interrupts: IRQ line info for da9055 chip. +- interrupt-controller: da9055 has internal IRQs (has own IRQ domain). +- #interrupt-cells: Should be 1, is the local IRQ number for da9055. + +Sub-nodes: +- regulators : Contain the regulator nodes. The DA9055 regulators are + bound using their names as listed below: + + buck1 : regulator BUCK1 + buck2 : regulator BUCK2 + ldo1 : regulator LDO1 + ldo2 : regulator LDO2 + ldo3 : regulator LDO3 + ldo4 : regulator LDO4 + ldo5 : regulator LDO5 + ldo6 : regulator LDO6 + + The bindings details of individual regulator device can be found in: + Documentation/devicetree/bindings/regulator/regulator.txt + + +Example: + + pmic: da9055-pmic@5a { + compatible = "dlg,da9055-pmic"; + reg = <0x5a>; + interrupt-parent = <&intc>; + interrupts = <5 0x8>; + interrupt-controller; + #interrupt-cells = <1>; + + regulators { + buck1: BUCK1 { + regulator-min-microvolt = <725000>; + regulator-max-microvolt = <2075000>; + }; + + buck2: BUCK2 { + regulator-min-microvolt = <925000>; + regulator-max-microvolt = <2500000>; + }; + ldo1: LDO1 { + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <3300000>; + }; + }; + };drivers/mfd/da9055-i2c.c +2
-0@@ -15,6 +15,8 @@#include <linux/device.h> #include <linux/i2c.h> #include <linux/err.h> +#include <linux/of.h> +#include <linux/of_device.h> #include <linux/mfd/da9055/core.h>
drivers/mfd/da9055-i2c.c static struct i2c_device_id da9055_i2c_id[] = { · line 72
Quoted 5 lines
drivers/mfd/da9055-i2c.c +2
-0@@ -66,6 +68,11 @@ static struct i2c_device_id da9055_i2c_id[] = { };MODULE_DEVICE_TABLE (i2c, da9055_i2c_id); +static const struct of_device_id da9055_of_match[] = { + { .compatible ="dlg,da9055-pmic" , .data = (void *)&da9055_i2c_id[0 ] },
Entangling the i2c_device_id table with the of_device_id table sounds a bit too wacky for my liking. Where do you even use it?
Quoted 14 lines
drivers/mfd/da9055-i2c.c +4
-0+ { } +}; +static struct i2c_driver da9055_i2c_driver = { .probe = da9055_i2c_probe, .remove = da9055_i2c_remove,@@ -73,6 +80,7 @@ static struct i2c_driver da9055_i2c_driver = { .driver = { .name = "da9055-pmic", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(da9055_of_match), }, };
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
RE: [PATCH v2 3/8] mfd: da9055: Add DT support for PMIC
T24gRnJpLCBGZWIgMDcsIDIwMTQgYXQgMTE6MDM6MThBTSArMDAwMCwgTGVlIEpvbmVzIHdyb3Rl Og0KDQo+IA0KPiBDYW4geW91IGJyZWFrIHRoaXMgdXAgcGxlYXNlLg0KPiANCj4gQmluZGluZ3Mg c2hvdWxkIGJlIHNlcGFyYXRlIHRvIHRoZSBiaW5kaW5nIGRvY3VtZW50Lg0KDQpSaWdodCwgZmlu ZS4gRmlndXJlZCBhcyB0aGV5IHdlcmUgZGlyZWN0bHkgcmVsYXRlZCB0aGV5IHNob3VsZCBiZSBp biBvbmUgcGF0Y2gNCmJ1dCB3aWxsIHNlcGFyYXRlIHRoZW0uDQoNCj4gRW50YW5nbGluZyB0aGUg aTJjX2RldmljZV9pZCB0YWJsZSB3aXRoIHRoZSBvZl9kZXZpY2VfaWQgdGFibGUgc291bmRzDQo+ IGEgYml0IHRvbyB3YWNreSBmb3IgbXkgbGlraW5nLiBXaGVyZSBkbyB5b3UgZXZlbiB1c2UgaXQ/ DQo+IA0KDQpZb3UncmUgcmlnaHQuIElzIG5vdCB1c2VkIHNvIGNhbiByZW1vdmUgaXQuDQo= --
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 4/8 regulator: da9055: Add DT support
In reply to Adam Thomson--- drivers/regulator/da9055-regulator.c | 69 ++++++++++++++++++++++++++++++++-- 1 files changed, 65 insertions(+), 4 deletions(-)
drivers/regulator/da9055-regulator.c +65 -4
@@ -19,6 +19,8 @@#include <linux/platform_device.h> #include <linux/regulator/driver.h> #include <linux/regulator/machine.h> +#include <linux/of.h> +#include <linux/regulator/of_regulator.h> #include <linux/mfd/da9055/core.h> #include <linux/mfd/da9055/reg.h>
@@ -446,6 +448,9 @@ static int da9055_gpio_init(struct da9055_regulator *regulator,struct da9055_regulator_info *info = regulator->info;int ret =0 ; +if (!pdata) +return 0 ; +if (pdata->gpio_ren && pdata->gpio_ren[id]) {char name[18 ];int gpio_mux = pdata->gpio_ren[id];
@@ -530,6 +535,59 @@ static inline struct da9055_regulator_info *find_regulator_info(int id)return NULL ; } +#ifdef CONFIG_OF +static struct of_regulator_match da9055_reg_matches[] = { + { .name ="BUCK1" , }, + { .name ="BUCK2" , }, + { .name ="LDO1" , }, + { .name ="LDO2" , }, + { .name ="LDO3" , }, + { .name ="LDO4" , }, + { .name ="LDO5" , }, + { .name ="LDO6" , }, +}; + +static int da9055_regulator_dt_init (struct platform_device *pdev, +struct da9055_regulator *regulator, +struct regulator_config *config, +int regid) +{ +struct device_node *nproot, *np; +int ret; + + nproot =of_node_get (pdev->dev.parent->of_node); +if (!nproot) +return -ENODEV ; + + np =of_find_node_by_name (nproot,"regulators" ); +if (!np) +return -ENODEV ; + + ret =of_regulator_match (&pdev->dev, np, &da9055_reg_matches[regid],1 ); +of_node_put (nproot); +if (ret <0 ) { +dev_err (&pdev->dev,"Error matching regulator: %d\n" , ret); +return -ENODEV ; + } + + config->init_data = da9055_reg_matches[regid].init_data; + config->of_node = da9055_reg_matches[regid].of_node; + +if (!config->of_node) +return -ENODEV ; + +return 0 ; +} +#else +static inline da9055_regulator_dt_init(struct platform_device *pdev, + struct da9055_regulator *regulator, + struct regulator_config *config, + int regid) +{ + return -ENODEV; +} +#endif /* CONFIG_OF */ +static int da9055_regulator_probe (struct platform_device *pdev) {struct regulator_config config = { };
@@ -538,9 +596,6 @@ static int da9055_regulator_probe(struct platform_device *pdev)struct da9055_pdata *pdata =dev_get_platdata (da9055->dev);int ret, irq; -if (pdata ==NULL || pdata->regulators[pdev->id] ==NULL ) -return -ENODEV ; - regulator =devm_kzalloc (&pdev->dev,sizeof (struct da9055_regulator ),GFP_KERNEL );if (!regulator)
@@ -557,8 +612,14 @@ static int da9055_regulator_probe(struct platform_device *pdev) config.driver_data = regulator; config.regmap = da9055->regmap; -if (pdata && pdata->regulators) +if (pdata && pdata->regulators) { config.init_data = pdata->regulators[pdev->id]; + }else { + ret =da9055_regulator_dt_init (pdev, regulator, &config, + pdev->id); +if (ret <0 ) +return ret; + } ret =da9055_gpio_init (regulator, &config, pdata, pdev->id);if (ret <0 )
--
1.7.0.4
Re: [PATCH v2 4/8] regulator: da9055: Add DT support
Quoted 1 line · Adam Thomson
Signed-off-by Adam Thomson <[email protected]>
Applied, thanks.
PATCH v2 5/8 onkey: da9055: Remove use of regmap_irq_get_virq()
In reply to Adam ThomsonUsing platform_get_irq_byname() to retrieve the IRQ number returns the VIRQ number rather than the local IRQ number for the device. Passing that value then into regmap_irq_get_virq() causes a failure because the function is expecting the local IRQ number (e.g. 0, 1, 2, 3, etc). This patch removes use of regmap_irq_get_virq() to prevent this failure from happening.
--- drivers/input/misc/da9055_onkey.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/input/misc/da9055_onkey.c +0 -1
@@ -109,7 +109,6 @@ static int da9055_onkey_probe(struct platform_device *pdev)INIT_DELAYED_WORK (&onkey->work, da9055_onkey_work); - irq =regmap_irq_get_virq (da9055->irq_data, irq); err =request_threaded_irq (irq,NULL , da9055_onkey_irq,IRQF_TRIGGER_HIGH |IRQF_ONESHOT ,"ONKEY" , onkey);
--
1.7.0.4
PATCH v2 6/8 hwmon: da9055: Remove use of regmap_irq_get_virq()
In reply to Adam Thomson--- drivers/hwmon/da9055-hwmon.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/hwmon/da9055-hwmon.c +0 -4
@@ -278,10 +278,6 @@ static int da9055_hwmon_probe(struct platform_device *pdev)if (hwmon_irq <0 )return hwmon_irq; - hwmon_irq =regmap_irq_get_virq (hwmon->da9055->irq_data, hwmon_irq); -if (hwmon_irq <0 ) -return hwmon_irq; - ret = devm_request_threaded_irq(&pdev->dev, hwmon_irq, NULL, da9055_auxadc_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
--
1.7.0.4
Guenter Roeck
maintainerRe: [PATCH v2 6/8] hwmon: da9055: Remove use of regmap_irq_get_virq()
Quoted 2 lines · Adam Thomson
Signed-off-by Adam Thomson <[email protected]>---
Applied (after adding the explanation from the introduction).
Thanks,
Guenter
PATCH v2 7/8 rtc: da9055: Remove use of regmap_irq_get_virq()
In reply to Adam Thomson--- drivers/rtc/rtc-da9055.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/rtc/rtc-da9055.c +3 -1
@@ -302,7 +302,9 @@ static int da9055_rtc_probe(struct platform_device *pdev) } alm_irq =platform_get_irq_byname (pdev,"ALM" ); - alm_irq =regmap_irq_get_virq (rtc->da9055->irq_data, alm_irq); +if (alm_irq <0 ) +return alm_irq; + ret = devm_request_threaded_irq(&pdev->dev, alm_irq, NULL, da9055_rtc_alm_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
--
1.7.0.4
PATCH v2 8/8 regulator: da9055: Remove use of regmap_irq_get_virq()
In reply to Adam Thomson--- drivers/regulator/da9055-regulator.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/regulator/da9055-regulator.c +3 -1
@@ -637,7 +637,9 @@ static int da9055_regulator_probe(struct platform_device *pdev)/* Only LDO 5 and 6 has got the over current interrupt */ if (pdev->id ==DA9055_ID_LDO5 || pdev->id ==DA9055_ID_LDO6 ) { irq =platform_get_irq_byname (pdev,"REGULATOR" ); - irq =regmap_irq_get_virq (da9055->irq_data, irq); +if (irq <0 ) +return irq; + ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, da9055_ldo5_6_oc_irq, IRQF_TRIGGER_HIGH |
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 8/8] regulator: da9055: Remove use of regmap_irq_get_virq()
Quoted 1 line · Adam Thomson
Signed-off-by Adam Thomson <[email protected]>
Applied, thanks.