RE: [PATCH V3 1/2] tps6507x-ts: Add DT support
Hi Dmitry, On Mon, Jun 10, 2013 at 23:33:11, Dmitry Torokhov wrote: > Manish, > > On Mon, Jun 10, 2013 at 10:23:16AM +, Vishwanathrao Badarkhe, Manish > wrote: > > Hi Dmitry, > > > > On Mon, Jun 10, 2013 at 11:34:42, Dmitry Torokhov wrote: > > > Hi Manish, > > > > > > On Tue, May 21, 2013 at 02:24:17PM +0530, Vishwanathrao Badarkhe, Manish > > > wrote: > > > > > > > + struct touchscreen_init_data *init_data = NULL; > > > > + int err; > > > > + > > > > + if (node) > > > > + node = of_find_node_by_name(node, "tsc"); > > > > > > Why do you have to locate OF node manually instead of already having it > > > attached to the device stucture? > > > > As TPS6507x is mfd device containing two nodes, regulator and touchscreen. > > It is necessary to use "of_find_node_by_name" to find child "tsc" node > > of TPS6507x MFD device. > > I understand that TPS6507x is a MFD device, However, I still do not > understand why you do not attach OF data to the child platform device > representing touch screen when you create it. I gone through most of MFD devices in mainline kernel where "of_find_node_by_name" function is used in order to populate child node properties. See below example of max8925 MFD device. Max8025 MFD device has following modules 1. Touch screen 2. Charger 3. Backlight 4. regulator In DT case, device node for max8925 MFD device is in "arch/arm/boot/dts/mmp2-brownstone.dts" file having child nodes as regulator, backlight and charger. Respective drivers (regulator, backlight and charger) of max8925 MFD device used "of_find_node_by_name" function in order to populate child node properties. Here, also same case for TPS6507x MFD device TPS6507x MFD device has two childs: 1. regulator 2. touch screen. Regulator driver for TPS6507x is already in mainline and using function "of_find_node_by_name" to populate device tree properties for regulators. On similar lines I used "of_find_node_by_name" to populate device tree properties for touch screen. Still, I agreed that it is possible to attach OF data to child platform device but it requires changes in MFD driver of TPS6507x. Please let me know your opinion about this. Thanks, Manish -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH V3 1/2] tps6507x-ts: Add DT support
Hi Dmitry, On Mon, Jun 10, 2013 at 11:34:42, Dmitry Torokhov wrote: > Hi Manish, > > On Tue, May 21, 2013 at 02:24:17PM +0530, Vishwanathrao Badarkhe, Manish > wrote: > > Add device tree based support for TI's tps6507x touchscreen. > > > > Tested on da850-evm. > > > > Signed-off-by: Vishwanathrao Badarkhe, Manish > > --- > > Changes since V2: > > - Removed unnecessary code. > > - Updated Documentation to provide proper names of > >devicetree properties. > > > > Changes since V1: > > - Updated documentation to specify tps6507x as multifunctional > >device. > > - return proper error value in absence of platform and DT > >data for touchscreen. > > - Updated commit message. > > > > :100755 100755 8fffa3c... 65ee2cd... M > > Documentation/devicetree/bindings/mfd/tps6507x.txt > > :100644 100644 65e0f9a... 89232ee... M > > drivers/input/touchscreen/tps6507x-ts.c > > Documentation/devicetree/bindings/mfd/tps6507x.txt | 28 ++- > > drivers/input/touchscreen/tps6507x-ts.c| 98 > > ++-- > > 2 files changed, 95 insertions(+), 31 deletions(-) > > > > diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt > > b/Documentation/devicetree/bindings/mfd/tps6507x.txt > > index 8fffa3c..65ee2cd 100755 > > --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt > > +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt > > @@ -1,4 +1,8 @@ > > -TPS6507x Power Management Integrated Circuit > > +TPS6507x Multifunctional Device. > > + > > +Features provided by TPS6507x: > > +1.Power Management Integrated Circuit. > > +2.Touch-Screen. > > > > Required properties: > > - compatible: "ti,tps6507x" > > @@ -23,6 +27,12 @@ Required properties: > > vindcdc1_2-supply: VDCDC1 and VDCDC2 input. > > vindcdc3-supply : VDCDC3 input. > > vldo1_2-supply : VLDO1 and VLDO2 input. > > +- tsc: This node specifies touch screen data. > > + ti,poll-period : Time at which touch input is getting sampled in ms. > > + ti,min-pressure: Minimum pressure value to trigger touch. > > + ti,vref: voltage reference for ADC. > > + 0: Reference voltage for ADC is disabled. > > + 1: Reference voltage for ADC is enabled. > > > > Regulator Optional properties: > > - defdcdc_default: It's property of DCDC2 and DCDC3 regulators. > > @@ -30,6 +40,14 @@ Regulator Optional properties: > > 1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH. > >If this property is not defined, it defaults to 0 (not enabled). > > > > +Touchscreen Optional properties: > > +- ti,vendor : Touchscreen vendor id to populate > > + in sysclass interface. > > +- ti,product: Touchscreen product id to populate > > + in sysclass interface. > > +- ti,version: Touchscreen version id to populate > > + in sysclass interface. > > + > > Example: > > > > pmu: tps6507x@48 { > > @@ -88,4 +106,12 @@ Example: > > }; > > }; > > > > + tsc { > > + ti,poll-period = <30>; > > + ti,min-pressure = <0x30>; > > + ti,vref = <0>; > > + ti,vendor = <0>; > > + ti,product = <65070>; > > + ti,version = <0x100>; > > + }; > > }; > > diff --git a/drivers/input/touchscreen/tps6507x-ts.c > > b/drivers/input/touchscreen/tps6507x-ts.c > > index 65e0f9a..89232ee 100644 > > --- a/drivers/input/touchscreen/tps6507x-ts.c > > +++ b/drivers/input/touchscreen/tps6507x-ts.c > > @@ -21,6 +21,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > > > #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */ #define > > TPS_DEFAULT_MIN_PRESSURE 0x30 @@ -231,36 +233,76 @@ done: > > ret = tps6507x_adc_standby(tsc); > > } > > > > +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev, > > + struct input_dev *input_dev) > > +{ > > + struct device_node *node = tps6507x_dev->dev->of_node; > > + struct tps6507x_board *tps_board = > > + (struct tps6507x_board *)tps6507x_dev->dev->platform_data; > > > Please make tps_board const pointer and use dev_get_platdata() to fetch it. Ok, I will
RE: [PATCH V3 0/2] Add DT support for tps6507x touchscreen
Hi Dmitry Please let me know, are there any review comments on this patch series? Thanks Manish Badarkhe On Tue, May 21, 2013 at 14:24:16, Vishwanathrao Badarkhe, Manish wrote: > Patch set adds DT support for tps6507x based touchscreen. > Also, add DT data for tps6507x touchscreen in da850-evm by > providing touchscreen node inside tps6507x mfd device. > > This patch series applies on top of linux-next tree and depends on [1]. > > [1]tps6507x-ts: update to devm_* API >https://patchwork.kernel.org/patch/2324441/ > > Tested on da850-evm board. > > Changes since V2: > - Updated tps6507x documentation. > - Removed unnecessary code. > > Changes since V1: > - Updated tps6507x documentation. > - Updated commit message. > - return proper error value in absence platform and DT data >for touchscreen. > > Vishwanathrao Badarkhe, Manish (2): > tps6507x-ts: Add DT support > ARM: davinci: da850: add tps6507x touchscreen DT data > > Documentation/devicetree/bindings/mfd/tps6507x.txt | 28 ++- > arch/arm/boot/dts/da850-evm.dts|9 ++ > drivers/input/touchscreen/tps6507x-ts.c| 98 > ++-- > 3 files changed, 104 insertions(+), 31 deletions(-) > > -- > 1.7.4.1 > > Regards, Manish -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH] ARM: dts: omap2plus: remove interrupt-parent property
Hi Benoit, Are there any review comments on this patch? Could you please accept this patch if there are not any review comments? Thanks and Regards Manish Badarkhe -Original Message- From: Vishwanathrao Badarkhe, Manish Sent: Friday, April 12, 2013 12:20 PM To: Vishwanathrao Badarkhe, Manish; devicetree-disc...@lists.ozlabs.org; linux-arm-ker...@lists.infradead.org; linux-kernel@vger.kernel.org; linux-o...@vger.kernel.org Cc: t...@atomide.com; Cousson, Benoit; li...@arm.linux.org.uk Subject: RE: [PATCH] ARM: dts: omap2plus: remove interrupt-parent property Hi Benoit, Are there any review comments on this patch? Could you please accept this patch if there are not any review comments? Thanks Manish Badarkhe -Original Message- From: Vishwanathrao Badarkhe, Manish Sent: Monday, March 11, 2013 3:30 PM To: devicetree-disc...@lists.ozlabs.org; linux-arm-ker...@lists.infradead.org; linux-kernel@vger.kernel.org; linux-o...@vger.kernel.org Cc: t...@atomide.com; Cousson, Benoit; li...@arm.linux.org.uk; Vishwanathrao Badarkhe, Manish Subject: [PATCH] ARM: dts: omap2plus: remove interrupt-parent property Removed interrupt-parent property from dts file as it is already with root node in dtsi file. Signed-off-by: Vishwanathrao Badarkhe, Manish --- :100644 100644 f624dc8... 36e839a... M arch/arm/boot/dts/omap3-beagle.dts :100644 100644 e8ba1c2... a5375fd... M arch/arm/boot/dts/omap3-evm.dts :100644 100644 4122efe... 389c9c7... M arch/arm/boot/dts/omap4-panda.dts :100644 100644 43e5258... cdf5dfd... M arch/arm/boot/dts/omap4-sdp.dts :100644 100644 6601e6a... 1d4a9d4... M arch/arm/boot/dts/omap4-var-som.dts arch/arm/boot/dts/omap3-beagle.dts |1 - arch/arm/boot/dts/omap3-evm.dts |1 - arch/arm/boot/dts/omap4-panda.dts |2 -- arch/arm/boot/dts/omap4-sdp.dts |2 -- arch/arm/boot/dts/omap4-var-som.dts |1 - 5 files changed, 0 insertions(+), 7 deletions(-) diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts index f624dc8..36e839a 100644 --- a/arch/arm/boot/dts/omap3-beagle.dts +++ b/arch/arm/boot/dts/omap3-beagle.dts @@ -46,7 +46,6 @@ twl: twl@48 { reg = <0x48>; interrupts = <7>; /* SYS_NIRQ cascaded to intc */ - interrupt-parent = <&intc>; }; }; diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts index e8ba1c2..a5375fd 100644 --- a/arch/arm/boot/dts/omap3-evm.dts +++ b/arch/arm/boot/dts/omap3-evm.dts @@ -34,7 +34,6 @@ twl: twl@48 { reg = <0x48>; interrupts = <7>; /* SYS_NIRQ cascaded to intc */ - interrupt-parent = <&intc>; }; }; diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts index 4122efe..389c9c7 100644 --- a/arch/arm/boot/dts/omap4-panda.dts +++ b/arch/arm/boot/dts/omap4-panda.dts @@ -119,7 +119,6 @@ reg = <0x48>; /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ - interrupt-parent = <&gic>; }; twl6040: twl@4b { @@ -127,7 +126,6 @@ reg = <0x4b>; /* SPI = 0, IRQ# = 119, 4 = active high level-sensitive */ interrupts = <0 119 4>; /* IRQ_SYS_2N cascaded to gic */ - interrupt-parent = <&gic>; ti,audpwron-gpio = <&gpio4 31 0>; /* gpio line 127 */ vio-supply = <&v1v8>; diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts index 43e5258..cdf5dfd 100644 --- a/arch/arm/boot/dts/omap4-sdp.dts +++ b/arch/arm/boot/dts/omap4-sdp.dts @@ -221,7 +221,6 @@ reg = <0x48>; /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ - interrupt-parent = <&gic>; }; twl6040: twl@4b { @@ -229,7 +228,6 @@ reg = <0x4b>; /* SPI = 0, IRQ# = 119, 4 = active high level-sensitive */ interrupts = <0 119 4>; /* IRQ_SYS_2N cascaded to gic */ - interrupt-parent = <&gic>; ti,audpwron-gpio = <&gpio4 31 0>; /* gpio line 127 */ vio-supply = <&v1v8>; diff --git a/arch/arm/boot/dts/omap4-var-som.dts b/arch/arm/boot/dts/omap4-var-som.dts index 6601e6a..1d4a9d4 100644 --- a/arch/arm/boot/dts/omap4-var-som.dts +++ b/arch/arm/boot/dts/omap4-var-som.dts @@ -35,7 +35,6 @@ reg = <0x48>; /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ - interrupt-parent = <&gic>; };
[PATCH V3 2/2] ARM: davinci: da850: add tps6507x touchscreen DT data
Add tps6507x touchscreen DT node to da850-evm. Touchscreen DT data is added as per da850 board file. Tested on da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- Changes since V2: - Updated names of devicetree properties. Changes since V1: - Updated commit message. :100644 100644 c914357... 1ca1691... M arch/arm/boot/dts/da850-evm.dts arch/arm/boot/dts/da850-evm.dts |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts index c914357..1ca1691 100644 --- a/arch/arm/boot/dts/da850-evm.dts +++ b/arch/arm/boot/dts/da850-evm.dts @@ -155,4 +155,13 @@ regulator-boot-on; }; }; + + tsc { + ti,poll-period = <30>; + ti,min-pressure = <0x30>; + ti,vref = <0>; + ti,vendor = <0>; + ti,product = <65070>; + ti,version = <0x100>; + }; }; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V3 1/2] tps6507x-ts: Add DT support
Add device tree based support for TI's tps6507x touchscreen. Tested on da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- Changes since V2: - Removed unnecessary code. - Updated Documentation to provide proper names of devicetree properties. Changes since V1: - Updated documentation to specify tps6507x as multifunctional device. - return proper error value in absence of platform and DT data for touchscreen. - Updated commit message. :100755 100755 8fffa3c... 65ee2cd... M Documentation/devicetree/bindings/mfd/tps6507x.txt :100644 100644 65e0f9a... 89232ee... M drivers/input/touchscreen/tps6507x-ts.c Documentation/devicetree/bindings/mfd/tps6507x.txt | 28 ++- drivers/input/touchscreen/tps6507x-ts.c| 98 ++-- 2 files changed, 95 insertions(+), 31 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt b/Documentation/devicetree/bindings/mfd/tps6507x.txt index 8fffa3c..65ee2cd 100755 --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt @@ -1,4 +1,8 @@ -TPS6507x Power Management Integrated Circuit +TPS6507x Multifunctional Device. + +Features provided by TPS6507x: +1.Power Management Integrated Circuit. +2.Touch-Screen. Required properties: - compatible: "ti,tps6507x" @@ -23,6 +27,12 @@ Required properties: vindcdc1_2-supply: VDCDC1 and VDCDC2 input. vindcdc3-supply : VDCDC3 input. vldo1_2-supply : VLDO1 and VLDO2 input. +- tsc: This node specifies touch screen data. + ti,poll-period : Time at which touch input is getting sampled in ms. + ti,min-pressure: Minimum pressure value to trigger touch. + ti,vref: voltage reference for ADC. + 0: Reference voltage for ADC is disabled. + 1: Reference voltage for ADC is enabled. Regulator Optional properties: - defdcdc_default: It's property of DCDC2 and DCDC3 regulators. @@ -30,6 +40,14 @@ Regulator Optional properties: 1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH. If this property is not defined, it defaults to 0 (not enabled). +Touchscreen Optional properties: +- ti,vendor : Touchscreen vendor id to populate + in sysclass interface. +- ti,product: Touchscreen product id to populate + in sysclass interface. +- ti,version: Touchscreen version id to populate + in sysclass interface. + Example: pmu: tps6507x@48 { @@ -88,4 +106,12 @@ Example: }; }; + tsc { + ti,poll-period = <30>; + ti,min-pressure = <0x30>; + ti,vref = <0>; + ti,vendor = <0>; + ti,product = <65070>; + ti,version = <0x100>; + }; }; diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index 65e0f9a..89232ee 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */ #define TPS_DEFAULT_MIN_PRESSURE 0x30 @@ -231,36 +233,76 @@ done: ret = tps6507x_adc_standby(tsc); } +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev, + struct input_dev *input_dev) +{ + struct device_node *node = tps6507x_dev->dev->of_node; + struct tps6507x_board *tps_board = + (struct tps6507x_board *)tps6507x_dev->dev->platform_data; + struct touchscreen_init_data *init_data = NULL; + int err; + + if (node) + node = of_find_node_by_name(node, "tsc"); + if (tps_board) + init_data = tps_board->tps6507x_ts_init_data; + + if (node == NULL || init_data == NULL) { + err = -EINVAL; + goto error_ret; + } else if (init_data) { + tps6507x_dev->ts->poll_period = init_data->poll_period; + tps6507x_dev->ts->min_pressure = init_data->min_pressure; + tps6507x_dev->ts->vref = init_data->vref; + input_dev->id.vendor = init_data->vendor; + input_dev->id.product = init_data->product; + input_dev->id.version = init_data->version; + } else if (node) { + err = of_property_read_u32(node, "ti,poll-period", + (u32 *)&tps6507x_dev->ts->poll_period); + if (err < 0) + goto error_ret; + + err = of_property_read_u16(node, "ti,min-pressure", + &am
[PATCH V3 0/2] Add DT support for tps6507x touchscreen
Patch set adds DT support for tps6507x based touchscreen. Also, add DT data for tps6507x touchscreen in da850-evm by providing touchscreen node inside tps6507x mfd device. This patch series applies on top of linux-next tree and depends on [1]. [1]tps6507x-ts: update to devm_* API https://patchwork.kernel.org/patch/2324441/ Tested on da850-evm board. Changes since V2: - Updated tps6507x documentation. - Removed unnecessary code. Changes since V1: - Updated tps6507x documentation. - Updated commit message. - return proper error value in absence platform and DT data for touchscreen. Vishwanathrao Badarkhe, Manish (2): tps6507x-ts: Add DT support ARM: davinci: da850: add tps6507x touchscreen DT data Documentation/devicetree/bindings/mfd/tps6507x.txt | 28 ++- arch/arm/boot/dts/da850-evm.dts|9 ++ drivers/input/touchscreen/tps6507x-ts.c| 98 ++-- 3 files changed, 104 insertions(+), 31 deletions(-) -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH V2 1/2] tps6507x-ts: Add DT support
Hi Prabhakar, On Tue, May 07, 2013 at 11:11:21, Prabhakar Lad wrote: > Hi Manish, > > Thanks for the patch, below are few nits. > > On Sat, May 4, 2013 at 4:42 PM, Vishwanathrao Badarkhe, Manish > wrote: > > Add device tree based support for TI's tps6507x touchscreen. > [Snip] > > > +- tsc: This node specifies touch screen data. > > + ti,poll_period : Time at which touch input is getting sampled in ms. > > + ti,min_pressure: Minimum pressure value to trigger touch. > For devicetree properties '-' is preferred over '_'. Ok, I will use '-' hence forward for device tree properties. > > > + ti,vref: voltage reference for ADC. > > + 0: Reference voltage for ADC is disabled. > > + 1: Reference voltage for ADC is enabled. > > > > Regulator Optional properties: > > - defdcdc_default: It's property of DCDC2 and DCDC3 regulators. > > @@ -30,6 +40,14 @@ Regulator Optional properties: > > 1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH. > >If this property is not defined, it defaults to 0 (not enabled). > > > > +Touchscreen Optional properties: > > +- ti,vendor : Touchscreen vendor id to poppulate > > + in sysclass interface. > > +- ti,product: Touchscreen product id to poppulate > > + in sysclass interface. > > +- ti,version: Touchscreen version id to poppulate > > + in sysclass interface. > > + > s/poppulate/populate Ok, I will correct this. > > > Example: > > > > pmu: tps6507x@48 { > > @@ -88,4 +106,12 @@ Example: > > }; > > }; > > > > + tsc { > > + ti,poll_period = <30>; > > + ti,min_pressure = <0x30>; > > + ti,vref = <0>; > > + ti,vendor = <0>; > > + ti,product = <65070>; > > + ti,version = <0x100>; > > + }; > > }; > > diff --git a/drivers/input/touchscreen/tps6507x-ts.c > > b/drivers/input/touchscreen/tps6507x-ts.c > > index 65e0f9a..d5433d0 100644 > > --- a/drivers/input/touchscreen/tps6507x-ts.c > > +++ b/drivers/input/touchscreen/tps6507x-ts.c > > @@ -21,6 +21,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > > > #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */ #define > > TPS_DEFAULT_MIN_PRESSURE 0x30 @@ -231,36 +233,83 @@ done: > > ret = tps6507x_adc_standby(tsc); } > > > > +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev, > > + struct input_dev *input_dev) { > > + struct device_node *node = tps6507x_dev->dev->of_node; > > + struct tps6507x_board *tps_board = > > + (struct tps6507x_board *)tps6507x_dev->dev->platform_data; > > + struct touchscreen_init_data *init_data = NULL; > > + u32 val32; > > + int err; > > + > > + if (node) > > + node = of_find_node_by_name(node, "tsc"); > > + if (tps_board) > > + init_data = tps_board->tps6507x_ts_init_data; > > + > > + if (init_data) { > > + tps6507x_dev->ts->poll_period = init_data->poll_period; > > + tps6507x_dev->ts->min_pressure = init_data->min_pressure; > > + tps6507x_dev->ts->vref = init_data->vref; > > + input_dev->id.vendor = init_data->vendor; > > + input_dev->id.product = init_data->product; > > + input_dev->id.version = init_data->version; > > + } else if (node) { > > + err = of_property_read_u32(node, "ti,poll_period", > > + &val32); > why not pass tps6507x_dev->ts->poll_period instead of val32 and similarly > below that would avoid else case. Agreed, that will reduce some code. > > > + if (err < 0) > > + goto error_ret; > > + else > > + tps6507x_dev->ts->poll_period = val32; > > + > > + err = of_property_read_u32(node, "ti,min_pressure", &val32); > > + if (err < 0) > > + goto error_ret; > > + else > > + tps6507x_dev->ts->min_p
[PATCH V2 1/2] tps6507x-ts: Add DT support
Add device tree based support for TI's tps6507x touchscreen. Tested on da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- Changes since V1: - Updated documetation to specify tps6507x as multifunctional device. - return proper error value in absence of platform and DT data for touchscreen. - Updated commit message. :100755 100755 8fffa3c... cf8960c... M Documentation/devicetree/bindings/mfd/tps6507x.txt :100644 100644 65e0f9a... d5433d0... M drivers/input/touchscreen/tps6507x-ts.c Documentation/devicetree/bindings/mfd/tps6507x.txt | 28 +- drivers/input/touchscreen/tps6507x-ts.c| 105 ++-- 2 files changed, 102 insertions(+), 31 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt b/Documentation/devicetree/bindings/mfd/tps6507x.txt index 8fffa3c..cf8960c 100755 --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt @@ -1,4 +1,8 @@ -TPS6507x Power Management Integrated Circuit +TPS6507x Multifunctional Device. + +Features provided by TPS6507x: +1.Power Management Integrated Circuit. +2.Touch-Screen. Required properties: - compatible: "ti,tps6507x" @@ -23,6 +27,12 @@ Required properties: vindcdc1_2-supply: VDCDC1 and VDCDC2 input. vindcdc3-supply : VDCDC3 input. vldo1_2-supply : VLDO1 and VLDO2 input. +- tsc: This node specifies touch screen data. + ti,poll_period : Time at which touch input is getting sampled in ms. + ti,min_pressure: Minimum pressure value to trigger touch. + ti,vref: voltage reference for ADC. + 0: Reference voltage for ADC is disabled. + 1: Reference voltage for ADC is enabled. Regulator Optional properties: - defdcdc_default: It's property of DCDC2 and DCDC3 regulators. @@ -30,6 +40,14 @@ Regulator Optional properties: 1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH. If this property is not defined, it defaults to 0 (not enabled). +Touchscreen Optional properties: +- ti,vendor : Touchscreen vendor id to poppulate + in sysclass interface. +- ti,product: Touchscreen product id to poppulate + in sysclass interface. +- ti,version: Touchscreen version id to poppulate + in sysclass interface. + Example: pmu: tps6507x@48 { @@ -88,4 +106,12 @@ Example: }; }; + tsc { + ti,poll_period = <30>; + ti,min_pressure = <0x30>; + ti,vref = <0>; + ti,vendor = <0>; + ti,product = <65070>; + ti,version = <0x100>; + }; }; diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index 65e0f9a..d5433d0 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */ #define TPS_DEFAULT_MIN_PRESSURE 0x30 @@ -231,36 +233,83 @@ done: ret = tps6507x_adc_standby(tsc); } +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev, + struct input_dev *input_dev) +{ + struct device_node *node = tps6507x_dev->dev->of_node; + struct tps6507x_board *tps_board = + (struct tps6507x_board *)tps6507x_dev->dev->platform_data; + struct touchscreen_init_data *init_data = NULL; + u32 val32; + int err; + + if (node) + node = of_find_node_by_name(node, "tsc"); + if (tps_board) + init_data = tps_board->tps6507x_ts_init_data; + + if (init_data) { + tps6507x_dev->ts->poll_period = init_data->poll_period; + tps6507x_dev->ts->min_pressure = init_data->min_pressure; + tps6507x_dev->ts->vref = init_data->vref; + input_dev->id.vendor = init_data->vendor; + input_dev->id.product = init_data->product; + input_dev->id.version = init_data->version; + } else if (node) { + err = of_property_read_u32(node, "ti,poll_period", &val32); + if (err < 0) + goto error_ret; + else + tps6507x_dev->ts->poll_period = val32; + + err = of_property_read_u32(node, "ti,min_pressure", &val32); + if (err < 0) + goto error_ret; + else + tps6507x_dev->ts->min_pressure = val32; + + err = of_property_read_u32(node, "ti,vref&q
[PATCH V2 2/2] ARM: davinci: da850: add tps6507x touchscreen DT data
Add tps6507x touchscreen DT node to da850-evm. Touchscreen DT data is added as per da850 board file. Tested on da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- Changes since V1: - Updated commit message. :100644 100644 c914357... 9c136d1... M arch/arm/boot/dts/da850-evm.dts arch/arm/boot/dts/da850-evm.dts |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts index c914357..9c136d1 100644 --- a/arch/arm/boot/dts/da850-evm.dts +++ b/arch/arm/boot/dts/da850-evm.dts @@ -155,4 +155,13 @@ regulator-boot-on; }; }; + + tsc { + ti,poll_period = <30>; + ti,min_pressure = <0x30>; + ti,vref = <0>; + ti,vendor = <0>; + ti,product = <65070>; + ti,version = <0x100>; + }; }; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V2 0/2] Add DT support for tps6507x touchscreen
Patch set adds DT support for tps6507x based touchscreen Also, add DT data for tps6507x touchscreen in da850-evm by providing touchscreen node inside tps6507x mfd device. This patch series applies on top of linux-next tree and depends on [1]. [1]tps6507x-ts: update to devm_* API https://patchwork.kernel.org/patch/2324441/ Tested on da850-evm board. Changes since V1: - Updated tps6507x documentation. - Updated commit message. - return proper error value in absence platform and DT data for touchscreen. Vishwanathrao Badarkhe, Manish (2): tps6507x-ts: Add DT support ARM: davinci: da850: add tps6507x touchscreen DT data Documentation/devicetree/bindings/mfd/tps6507x.txt | 28 +- arch/arm/boot/dts/da850-evm.dts|9 ++ drivers/input/touchscreen/tps6507x-ts.c| 105 ++-- 3 files changed, 111 insertions(+), 31 deletions(-) -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH] ARM: dts: omap2plus: remove interrupt-parent property
Hi Benoit, Are there any review comments on this patch? Could you please accept this patch if there are not any review comments? Thanks Manish Badarkhe -Original Message- From: Vishwanathrao Badarkhe, Manish Sent: Monday, March 11, 2013 3:30 PM To: devicetree-disc...@lists.ozlabs.org; linux-arm-ker...@lists.infradead.org; linux-kernel@vger.kernel.org; linux-o...@vger.kernel.org Cc: t...@atomide.com; Cousson, Benoit; li...@arm.linux.org.uk; Vishwanathrao Badarkhe, Manish Subject: [PATCH] ARM: dts: omap2plus: remove interrupt-parent property Removed interrupt-parent property from dts file as it is already with root node in dtsi file. Signed-off-by: Vishwanathrao Badarkhe, Manish --- :100644 100644 f624dc8... 36e839a... M arch/arm/boot/dts/omap3-beagle.dts :100644 100644 e8ba1c2... a5375fd... M arch/arm/boot/dts/omap3-evm.dts :100644 100644 4122efe... 389c9c7... M arch/arm/boot/dts/omap4-panda.dts :100644 100644 43e5258... cdf5dfd... M arch/arm/boot/dts/omap4-sdp.dts :100644 100644 6601e6a... 1d4a9d4... M arch/arm/boot/dts/omap4-var-som.dts arch/arm/boot/dts/omap3-beagle.dts |1 - arch/arm/boot/dts/omap3-evm.dts |1 - arch/arm/boot/dts/omap4-panda.dts |2 -- arch/arm/boot/dts/omap4-sdp.dts |2 -- arch/arm/boot/dts/omap4-var-som.dts |1 - 5 files changed, 0 insertions(+), 7 deletions(-) diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts index f624dc8..36e839a 100644 --- a/arch/arm/boot/dts/omap3-beagle.dts +++ b/arch/arm/boot/dts/omap3-beagle.dts @@ -46,7 +46,6 @@ twl: twl@48 { reg = <0x48>; interrupts = <7>; /* SYS_NIRQ cascaded to intc */ - interrupt-parent = <&intc>; }; }; diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts index e8ba1c2..a5375fd 100644 --- a/arch/arm/boot/dts/omap3-evm.dts +++ b/arch/arm/boot/dts/omap3-evm.dts @@ -34,7 +34,6 @@ twl: twl@48 { reg = <0x48>; interrupts = <7>; /* SYS_NIRQ cascaded to intc */ - interrupt-parent = <&intc>; }; }; diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts index 4122efe..389c9c7 100644 --- a/arch/arm/boot/dts/omap4-panda.dts +++ b/arch/arm/boot/dts/omap4-panda.dts @@ -119,7 +119,6 @@ reg = <0x48>; /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ - interrupt-parent = <&gic>; }; twl6040: twl@4b { @@ -127,7 +126,6 @@ reg = <0x4b>; /* SPI = 0, IRQ# = 119, 4 = active high level-sensitive */ interrupts = <0 119 4>; /* IRQ_SYS_2N cascaded to gic */ - interrupt-parent = <&gic>; ti,audpwron-gpio = <&gpio4 31 0>; /* gpio line 127 */ vio-supply = <&v1v8>; diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts index 43e5258..cdf5dfd 100644 --- a/arch/arm/boot/dts/omap4-sdp.dts +++ b/arch/arm/boot/dts/omap4-sdp.dts @@ -221,7 +221,6 @@ reg = <0x48>; /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ - interrupt-parent = <&gic>; }; twl6040: twl@4b { @@ -229,7 +228,6 @@ reg = <0x4b>; /* SPI = 0, IRQ# = 119, 4 = active high level-sensitive */ interrupts = <0 119 4>; /* IRQ_SYS_2N cascaded to gic */ - interrupt-parent = <&gic>; ti,audpwron-gpio = <&gpio4 31 0>; /* gpio line 127 */ vio-supply = <&v1v8>; diff --git a/arch/arm/boot/dts/omap4-var-som.dts b/arch/arm/boot/dts/omap4-var-som.dts index 6601e6a..1d4a9d4 100644 --- a/arch/arm/boot/dts/omap4-var-som.dts +++ b/arch/arm/boot/dts/omap4-var-som.dts @@ -35,7 +35,6 @@ reg = <0x48>; /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ - interrupt-parent = <&gic>; }; }; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH 0/2] Add dT support for tps6507x touchscreen.
Hi all I am sending next version for this, as need to update commit message for some patches. Thanks Manish Badarkhe -Original Message- From: Vishwanathrao Badarkhe, Manish Sent: Saturday, March 23, 2013 6:29 PM To: devicetree-disc...@lists.ozlabs.org; linux-in...@vger.kernel.org; linux-kernel@vger.kernel.org; davinci-linux-open-sou...@linux.davincidsp.com; linux-...@vger.kernel.org Cc: dmitry.torok...@gmail.com; r...@landley.net; rob.herr...@calxeda.com; grant.lik...@secretlab.ca; Vishwanathrao Badarkhe, Manish Subject: [PATCH 0/2] Add dT support for tps6507x touchscreen. Patch set adds DT support for tps6507x based touchscreen Also, add DT data for tps6507x touchscreen in da850-evm by providing touchscreen node inside tps6507x mfd device. This patch series applies on top of v3.9-rc2 of linus tree and depends on [1]. [1]davinci: Add device tree data for tps6507x http://www.spinics.net/lists/linux-doc/msg09473.html Tested on da850-evm board. Vishwanathrao Badarkhe, Manish (2): tps6507x-ts: Add DT support ARM: davinci: da850: add tps6507x touchscreen DT data Documentation/devicetree/bindings/mfd/tps6507x.txt | 22 arch/arm/boot/dts/da850-evm.dts|9 ++ drivers/input/touchscreen/tps6507x-ts.c| 104 ++-- 3 files changed, 105 insertions(+), 30 deletions(-) -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] ARM: davinci: da850: add tps6507x touchscreen DT data
Add tps6507x touchscreen device tree data to da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- :100644 100644 d1d091b... 5652501... M arch/arm/boot/dts/da850-evm.dts arch/arm/boot/dts/da850-evm.dts |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts index d1d091b..5652501 100644 --- a/arch/arm/boot/dts/da850-evm.dts +++ b/arch/arm/boot/dts/da850-evm.dts @@ -108,4 +108,13 @@ regulator-boot-on; }; }; + + tsc { + ti,poll_period = <30>; + ti,min_pressure = <0x30>; + ti,vref = <0>; + ti,vendor = <0>; + ti,product = <65070>; + ti,version = <0x100>; + }; }; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] tps6507x-ts: Add DT support
Add device tree based support for TI's tps6507x touchscreen. Signed-off-by: Vishwanathrao Badarkhe, Manish --- :100755 100755 8fffa3c... 6d3b3a6... M Documentation/devicetree/bindings/mfd/tps6507x.txt :100644 100644 65e0f9a... 6890f05... M drivers/input/touchscreen/tps6507x-ts.c Documentation/devicetree/bindings/mfd/tps6507x.txt | 22 drivers/input/touchscreen/tps6507x-ts.c| 104 ++-- 2 files changed, 96 insertions(+), 30 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt b/Documentation/devicetree/bindings/mfd/tps6507x.txt index 8fffa3c..6d3b3a6 100755 --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt @@ -23,6 +23,12 @@ Required properties: vindcdc1_2-supply: VDCDC1 and VDCDC2 input. vindcdc3-supply : VDCDC3 input. vldo1_2-supply : VLDO1 and VLDO2 input. +- tsc: This node specifies touch screen data. + ti,poll_period : Time at which touch input is getting sampled in ms. + ti,min_pressure: Minimum pressure value to trigger touch. + ti,vref: voltage reference for ADC. + 0: Reference voltage for ADC is disabled. + 1: Reference voltage for ADC is enabled. Regulator Optional properties: - defdcdc_default: It's property of DCDC2 and DCDC3 regulators. @@ -30,6 +36,14 @@ Regulator Optional properties: 1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH. If this property is not defined, it defaults to 0 (not enabled). +Touchscreen Optional properties: +- ti,vendor : Touchscreen vendor id to poppulate + in sysclass interface. +- ti,product: Touchscreen product id to poppulate + in sysclass interface. +- ti,version: Touchscreen version id to poppulate + in sysclass interface. + Example: pmu: tps6507x@48 { @@ -88,4 +102,12 @@ Example: }; }; + tsc { + ti,poll_period = <30>; + ti,min_pressure = <0x30>; + ti,vref = <0>; + ti,vendor = <0>; + ti,product = <65070>; + ti,version = <0x100>; + }; }; diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index 65e0f9a..6890f05 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */ #define TPS_DEFAULT_MIN_PRESSURE 0x30 @@ -231,36 +233,82 @@ done: ret = tps6507x_adc_standby(tsc); } +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev, + struct input_dev *input_dev) +{ + struct device_node *node = tps6507x_dev->dev->of_node; + struct tps6507x_board *tps_board = + (struct tps6507x_board *)tps6507x_dev->dev->platform_data; + struct touchscreen_init_data *init_data = NULL; + u32 val32; + int err; + + if (node) + node = of_find_node_by_name(node, "tsc"); + if (tps_board) + init_data = tps_board->tps6507x_ts_init_data; + + if (init_data) { + tps6507x_dev->ts->poll_period = init_data->poll_period; + tps6507x_dev->ts->min_pressure = init_data->min_pressure; + tps6507x_dev->ts->vref = init_data->vref; + input_dev->id.vendor = init_data->vendor; + input_dev->id.product = init_data->product; + input_dev->id.version = init_data->version; + } else if (node) { + err = of_property_read_u32(node, "ti,poll_period", &val32); + if (err < 0) + goto error_ret; + else + tps6507x_dev->ts->poll_period = val32; + + err = of_property_read_u32(node, "ti,min_pressure", &val32); + if (err < 0) + goto error_ret; + else + tps6507x_dev->ts->min_pressure = val32; + + err = of_property_read_u32(node, "ti,vref", &val32); + if (err < 0) + goto error_ret; + else + tps6507x_dev->ts->vref = val32; + + err = of_property_read_u32(node, "ti,vendor", &val32); + if (err < 0) + goto error_ret; + else + input_dev->id.vendor = val32; + + err = of_property_read_u32(node, "ti,product", &val32); + if (err <
[PATCH 0/2] Add dT support for tps6507x touchscreen.
Patch set adds DT support for tps6507x based touchscreen Also, add DT data for tps6507x touchscreen in da850-evm by providing touchscreen node inside tps6507x mfd device. This patch series applies on top of v3.9-rc2 of linus tree and depends on [1]. [1]davinci: Add device tree data for tps6507x http://www.spinics.net/lists/linux-doc/msg09473.html Tested on da850-evm board. Vishwanathrao Badarkhe, Manish (2): tps6507x-ts: Add DT support ARM: davinci: da850: add tps6507x touchscreen DT data Documentation/devicetree/bindings/mfd/tps6507x.txt | 22 arch/arm/boot/dts/da850-evm.dts|9 ++ drivers/input/touchscreen/tps6507x-ts.c| 104 ++-- 3 files changed, 105 insertions(+), 30 deletions(-) -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] tps6507x-ts: update to devm_* API
Update the code to use devm_* API so that driver core will manage resources. Signed-off-by: Vishwanathrao Badarkhe, Manish --- :100644 100644 820a066... 65e0f9a... M drivers/input/touchscreen/tps6507x-ts.c drivers/input/touchscreen/tps6507x-ts.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index 820a066..65e0f9a 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c @@ -261,7 +261,7 @@ static int tps6507x_ts_probe(struct platform_device *pdev) init_data = tps_board->tps6507x_ts_init_data; - tsc = kzalloc(sizeof(struct tps6507x_ts), GFP_KERNEL); + tsc = devm_kzalloc(&pdev->dev, sizeof(struct tps6507x_ts), GFP_KERNEL); if (!tsc) { dev_err(tps6507x_dev->dev, "failed to allocate driver data\n"); error = -ENOMEM; @@ -339,7 +339,6 @@ err2: cancel_delayed_work_sync(&tsc->work); input_free_device(input_dev); err1: - kfree(tsc); tps6507x_dev->ts = NULL; err0: return error; @@ -356,7 +355,6 @@ static int tps6507x_ts_remove(struct platform_device *pdev) input_unregister_device(input_dev); tps6507x_dev->ts = NULL; - kfree(tsc); return 0; } -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH V4] i2c: davinci: update to devm_* API
Hi Wolfram Added your updated mail id in loop. Are there any review comments on this patch? Could you please accept this patch if there are not any review comments? Thanks Manish Badarkhe On Tue, Mar 05, 2013 at 17:14:45, Vishwanathrao Badarkhe, Manish wrote: > Update the code to use devm_* API so that driver core will manage resources. > > Signed-off-by: Vishwanathrao Badarkhe, Manish > --- > Changes since V3: > - Use devm_ioremap_resource API instead of devm_request_and_ioremap. > - Update commit message. > - Rebase on top of v3.9-rc1 linus tree. > Changes since V2: > - if "devm_request_and_ioremap" fails return -EADDRNOTAVAIL. > instead of -EBUSY. > Changes since V1: > - Rebase on top of v3.8-rc6 of linus tree. > - Apply devm operation on clk_get. > > :100644 100644 7d1e590... 1fb5a22... Mdrivers/i2c/busses/i2c-davinci.c > drivers/i2c/busses/i2c-davinci.c | 49 +++-- > 1 files changed, 15 insertions(+), 34 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-davinci.c > b/drivers/i2c/busses/i2c-davinci.c > index 7d1e590..1fb5a22 100644 > --- a/drivers/i2c/busses/i2c-davinci.c > +++ b/drivers/i2c/busses/i2c-davinci.c > @@ -643,7 +643,7 @@ static int davinci_i2c_probe(struct platform_device > *pdev) { > struct davinci_i2c_dev *dev; > struct i2c_adapter *adap; > - struct resource *mem, *irq, *ioarea; > + struct resource *mem, *irq; > int r; > > /* NOTE: driver uses the static register mapping */ @@ -659,17 +659,11 > @@ static int davinci_i2c_probe(struct platform_device *pdev) > return -ENODEV; > } > > - ioarea = request_mem_region(mem->start, resource_size(mem), > - pdev->name); > - if (!ioarea) { > - dev_err(&pdev->dev, "I2C region already claimed\n"); > - return -EBUSY; > - } > - > - dev = kzalloc(sizeof(struct davinci_i2c_dev), GFP_KERNEL); > + dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev), > + GFP_KERNEL); > if (!dev) { > - r = -ENOMEM; > - goto err_release_region; > + dev_err(&pdev->dev, "Memory allocation failed\n"); > + return -ENOMEM; > } > > init_completion(&dev->cmd_complete); > @@ -699,22 +693,24 @@ static int davinci_i2c_probe(struct platform_device > *pdev) > dev->pdata = &davinci_i2c_platform_data_default; > } > > - dev->clk = clk_get(&pdev->dev, NULL); > + dev->clk = devm_clk_get(&pdev->dev, NULL); > if (IS_ERR(dev->clk)) { > r = -ENODEV; > goto err_free_mem; > } > clk_prepare_enable(dev->clk); > > - dev->base = ioremap(mem->start, resource_size(mem)); > - if (!dev->base) { > - r = -EBUSY; > - goto err_mem_ioremap; > + dev->base = devm_ioremap_resource(&pdev->dev, mem); > + if (IS_ERR(dev->base)) { > + r = PTR_ERR(dev->base); > + dev_err(&pdev->dev, "I2C region already claimed\n"); > + goto err_unuse_clocks; > } > > i2c_davinci_init(dev); > > - r = request_irq(dev->irq, i2c_davinci_isr, 0, pdev->name, dev); > + r = devm_request_irq(&pdev->dev, dev->irq, i2c_davinci_isr, 0, > + pdev->name, dev); > if (r) { > dev_err(&pdev->dev, "failure requesting irq %i\n", dev->irq); > goto err_unuse_clocks; > @@ -723,7 +719,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) > r = i2c_davinci_cpufreq_register(dev); > if (r) { > dev_err(&pdev->dev, "failed to register cpufreq\n"); > - goto err_free_irq; > + goto err_unuse_clocks; > } > > adap = &dev->adapter; > @@ -740,25 +736,17 @@ static int davinci_i2c_probe(struct platform_device > *pdev) > r = i2c_add_numbered_adapter(adap); > if (r) { > dev_err(&pdev->dev, "failure adding adapter\n"); > - goto err_free_irq; > + goto err_unuse_clocks; > } > of_i2c_register_devices(adap); > > return 0; > > -err_free_irq: > - free_irq(dev->irq, dev); > err_unuse_clocks: > - iounmap(dev->base); > -err_mem_ioremap: > clk_disable_unprepare(dev->clk); > - clk_put(dev->clk); > dev->clk = NULL; >
[PATCH] rtc: omap: update to devm_* API
From: Vishwanathrao Badarkhe, Manish Update the code to use devm_* API so that driver core will manage resources. Signed-off-by: Vishwanathrao Badarkhe, Manish --- Applied on top of linux-next: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git with tag next-20130312. :100644 100644 172cc5c... a1f9d30... M drivers/rtc/rtc-omap.c drivers/rtc/rtc-omap.c | 45 + 1 files changed, 9 insertions(+), 36 deletions(-) diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 172cc5c..a1f9d30 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c @@ -324,7 +324,7 @@ MODULE_DEVICE_TABLE(of, omap_rtc_of_match); static int __init omap_rtc_probe(struct platform_device *pdev) { - struct resource *res, *mem; + struct resource *res; struct rtc_device *rtc; u8 reg, new_ctrl; const struct platform_device_id *id_entry; @@ -352,18 +352,9 @@ static int __init omap_rtc_probe(struct platform_device *pdev) return -ENOENT; } - mem = request_mem_region(res->start, resource_size(res), pdev->name); - if (!mem) { - pr_debug("%s: RTC registers at %08x are not free\n", - pdev->name, res->start); - return -EBUSY; - } - - rtc_base = ioremap(res->start, resource_size(res)); - if (!rtc_base) { - pr_debug("%s: RTC registers can't be mapped\n", pdev->name); - goto fail; - } + rtc_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(rtc_base)) + return PTR_ERR(rtc_base); /* Enable the clock/module so that we can access the registers */ pm_runtime_enable(&pdev->dev); @@ -375,7 +366,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev) rtc_writel(KICK1_VALUE, OMAP_RTC_KICK1_REG); } - rtc = rtc_device_register(pdev->name, &pdev->dev, + rtc = devm_rtc_device_register(&pdev->dev, pdev->name, &omap_rtc_ops, THIS_MODULE); if (IS_ERR(rtc)) { pr_debug("%s: can't register RTC device, err %ld\n", @@ -383,7 +374,6 @@ static int __init omap_rtc_probe(struct platform_device *pdev) goto fail0; } platform_set_drvdata(pdev, rtc); - dev_set_drvdata(&rtc->dev, mem); /* clear pending irqs, and set 1/second periodic, * which we'll use instead of update irqs @@ -401,18 +391,18 @@ static int __init omap_rtc_probe(struct platform_device *pdev) rtc_write(OMAP_RTC_STATUS_ALARM, OMAP_RTC_STATUS_REG); /* handle periodic and alarm irqs */ - if (request_irq(omap_rtc_timer, rtc_irq, 0, + if (devm_request_irq(&pdev->dev, omap_rtc_timer, rtc_irq, 0, dev_name(&rtc->dev), rtc)) { pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n", pdev->name, omap_rtc_timer); - goto fail1; + goto fail0; } if ((omap_rtc_timer != omap_rtc_alarm) && - (request_irq(omap_rtc_alarm, rtc_irq, 0, + (devm_request_irq(&pdev->dev, omap_rtc_alarm, rtc_irq, 0, dev_name(&rtc->dev), rtc))) { pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n", pdev->name, omap_rtc_alarm); - goto fail2; + goto fail0; } /* On boards with split power, RTC_ON_NOFF won't reset the RTC */ @@ -446,25 +436,16 @@ static int __init omap_rtc_probe(struct platform_device *pdev) return 0; -fail2: - free_irq(omap_rtc_timer, rtc); -fail1: - rtc_device_unregister(rtc); fail0: if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) rtc_writel(0, OMAP_RTC_KICK0_REG); pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); - iounmap(rtc_base); -fail: - release_mem_region(mem->start, resource_size(mem)); return -EIO; } static int __exit omap_rtc_remove(struct platform_device *pdev) { - struct rtc_device *rtc = platform_get_drvdata(pdev); - struct resource *mem = dev_get_drvdata(&rtc->dev); const struct platform_device_id *id_entry = platform_get_device_id(pdev); @@ -473,12 +454,6 @@ static int __exit omap_rtc_remove(struct platform_device *pdev) /* leave rtc running, but disable irqs */ rtc_write(0, OMAP_RTC_INTERRUPTS_REG); - free_irq(omap_rtc_timer, rtc); - - if (omap_rtc_timer != omap_rtc_alarm) - free_irq(
[PATCH] ARM: dts: omap2plus: remove interrupt-parent property
Removed interrupt-parent property from dts file as it is already with root node in dtsi file. Signed-off-by: Vishwanathrao Badarkhe, Manish --- :100644 100644 f624dc8... 36e839a... M arch/arm/boot/dts/omap3-beagle.dts :100644 100644 e8ba1c2... a5375fd... M arch/arm/boot/dts/omap3-evm.dts :100644 100644 4122efe... 389c9c7... M arch/arm/boot/dts/omap4-panda.dts :100644 100644 43e5258... cdf5dfd... M arch/arm/boot/dts/omap4-sdp.dts :100644 100644 6601e6a... 1d4a9d4... M arch/arm/boot/dts/omap4-var-som.dts arch/arm/boot/dts/omap3-beagle.dts |1 - arch/arm/boot/dts/omap3-evm.dts |1 - arch/arm/boot/dts/omap4-panda.dts |2 -- arch/arm/boot/dts/omap4-sdp.dts |2 -- arch/arm/boot/dts/omap4-var-som.dts |1 - 5 files changed, 0 insertions(+), 7 deletions(-) diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts index f624dc8..36e839a 100644 --- a/arch/arm/boot/dts/omap3-beagle.dts +++ b/arch/arm/boot/dts/omap3-beagle.dts @@ -46,7 +46,6 @@ twl: twl@48 { reg = <0x48>; interrupts = <7>; /* SYS_NIRQ cascaded to intc */ - interrupt-parent = <&intc>; }; }; diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts index e8ba1c2..a5375fd 100644 --- a/arch/arm/boot/dts/omap3-evm.dts +++ b/arch/arm/boot/dts/omap3-evm.dts @@ -34,7 +34,6 @@ twl: twl@48 { reg = <0x48>; interrupts = <7>; /* SYS_NIRQ cascaded to intc */ - interrupt-parent = <&intc>; }; }; diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts index 4122efe..389c9c7 100644 --- a/arch/arm/boot/dts/omap4-panda.dts +++ b/arch/arm/boot/dts/omap4-panda.dts @@ -119,7 +119,6 @@ reg = <0x48>; /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ - interrupt-parent = <&gic>; }; twl6040: twl@4b { @@ -127,7 +126,6 @@ reg = <0x4b>; /* SPI = 0, IRQ# = 119, 4 = active high level-sensitive */ interrupts = <0 119 4>; /* IRQ_SYS_2N cascaded to gic */ - interrupt-parent = <&gic>; ti,audpwron-gpio = <&gpio4 31 0>; /* gpio line 127 */ vio-supply = <&v1v8>; diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts index 43e5258..cdf5dfd 100644 --- a/arch/arm/boot/dts/omap4-sdp.dts +++ b/arch/arm/boot/dts/omap4-sdp.dts @@ -221,7 +221,6 @@ reg = <0x48>; /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ - interrupt-parent = <&gic>; }; twl6040: twl@4b { @@ -229,7 +228,6 @@ reg = <0x4b>; /* SPI = 0, IRQ# = 119, 4 = active high level-sensitive */ interrupts = <0 119 4>; /* IRQ_SYS_2N cascaded to gic */ - interrupt-parent = <&gic>; ti,audpwron-gpio = <&gpio4 31 0>; /* gpio line 127 */ vio-supply = <&v1v8>; diff --git a/arch/arm/boot/dts/omap4-var-som.dts b/arch/arm/boot/dts/omap4-var-som.dts index 6601e6a..1d4a9d4 100644 --- a/arch/arm/boot/dts/omap4-var-som.dts +++ b/arch/arm/boot/dts/omap4-var-som.dts @@ -35,7 +35,6 @@ reg = <0x48>; /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ - interrupt-parent = <&gic>; }; }; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RESEND 2/2] ARM: davinci: da850: add tps6507x regulator DT data
Add tps6507x regulator device tree data to da850-evm by adding regulator consumers with tightened constraints and regulator-name.TPS6507x regulator handle can be obtained by using this regulator name. Regulator constraints are added as per da850 board file. Regulator names are given as per maximum output voltage the regulator is capable to provide. for e.g. regulator name for dcdc1 is "VDCDC1_3.3V". Also, add tps6507x PMIC I2C slave device under I2C0 node. Tested on da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- :100644 100644 f712fb6... d1d091b... M arch/arm/boot/dts/da850-evm.dts arch/arm/boot/dts/da850-evm.dts | 63 +++ 1 files changed, 63 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts index f712fb6..d1d091b 100644 --- a/arch/arm/boot/dts/da850-evm.dts +++ b/arch/arm/boot/dts/da850-evm.dts @@ -35,6 +35,10 @@ clock-frequency = <10>; pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins>; + + tps: tps@48 { + reg = <0x48>; + }; }; wdt: wdt@1c21000 { status = "okay"; @@ -45,4 +49,63 @@ pinctrl-names = "default"; pinctrl-0 = <&nand_cs3_pins>; }; + vbat: fixedregulator@0 { + compatible = "regulator-fixed"; + regulator-name = "vbat"; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + regulator-boot-on; + }; +}; + +/include/ "tps6507x.dtsi" + +&tps { + vdcdc1_2-supply = <&vbat>; + vdcdc3-supply = <&vbat>; + vldo1_2-supply = <&vbat>; + + regulators { + vdcdc1_reg: regulator@0 { + regulator-name = "VDCDC1_3.3V"; + regulator-min-microvolt = <315>; + regulator-max-microvolt = <345>; + regulator-always-on; + regulator-boot-on; + }; + + vdcdc2_reg: regulator@1 { + regulator-name = "VDCDC2_3.3V"; + regulator-min-microvolt = <171>; + regulator-max-microvolt = <345>; + regulator-always-on; + regulator-boot-on; + ti,defdcdc_default = <1>; + }; + + vdcdc3_reg: regulator@2 { + regulator-name = "VDCDC3_1.2V"; + regulator-min-microvolt = <95>; + regulator-max-microvolt = <135>; + regulator-always-on; + regulator-boot-on; + ti,defdcdc_default = <1>; + }; + + ldo1_reg: regulator@3 { + regulator-name = "LDO1_1.8V"; + regulator-min-microvolt = <171>; + regulator-max-microvolt = <189>; + regulator-always-on; + regulator-boot-on; + }; + + ldo2_reg: regulator@4 { + regulator-name = "LDO2_1.2V"; + regulator-min-microvolt = <114>; + regulator-max-microvolt = <132>; + regulator-always-on; + regulator-boot-on; + }; + }; }; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RESEND 1/2] ARM: regulator: add tps6507x device tree data
Add device tree data for tps6507x regulator by adding all tps6507x regulator nodes. Regulators are initialized based on compatible name provided in tps6507x DT file. All tps6507x PMIC regulator device tree nodes are placed in a separate device tree include file (tps6507x.dtsi). tps6507x.dtsi file is created using datasheet http://www.ti.com/lit/ds/symlink/tps65070.pdf Tested on da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- :00 100644 000... 4c326e5... A arch/arm/boot/dts/tps6507x.dtsi arch/arm/boot/dts/tps6507x.dtsi | 47 +++ 1 files changed, 47 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/tps6507x.dtsi b/arch/arm/boot/dts/tps6507x.dtsi new file mode 100644 index 000..4c326e5 --- /dev/null +++ b/arch/arm/boot/dts/tps6507x.dtsi @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/* + * Integrated Power Management Chip + * http://www.ti.com/lit/ds/symlink/tps65070.pdf + */ + +&tps { + compatible = "ti,tps6507x"; + + regulators { + #address-cells = <1>; + #size-cells = <0>; + + vdcdc1_reg: regulator@0 { + reg = <0>; + regulator-compatible = "VDCDC1"; + }; + + vdcdc2_reg: regulator@1 { + reg = <1>; + regulator-compatible = "VDCDC2"; + }; + + vdcdc3_reg: regulator@2 { + reg = <2>; + regulator-compatible = "VDCDC3"; + }; + + ldo1_reg: regulator@3 { + reg = <3>; + regulator-compatible = "LDO1"; + }; + + ldo2_reg: regulator@4 { + reg = <4>; + regulator-compatible = "LDO2"; + }; + + }; +}; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RESEND 0/2] davinci: Add device tree data for tps6507x.
Add device tree data for regulator via tps6507x mfd device in da850-evm. Applies on top of v3.9-rc1 of linus tree. Tested on da850-evm device. Test procedure followed as below: Once device boots up, issue command as: $for reg in /sys/class/regulator/*; do echo $reg `cat $reg/name` `cat $reg/state` `cat $reg/microvolts`; done This command will print all available regulators with its name, status (enabled/disabled) and voltages(in microvolts) like as below: /sys/class/regulator/regulator.1 VDCDC1_3.3V enabled 330 /sys/class/regulator/regulator.2 VDCDC2_3.3V enabled 330 /sys/class/regulator/regulator.3 VDCDC3_1.2V enabled 120 /sys/class/regulator/regulator.4 LDO1_1.8V enabled 180 /sys/class/regulator/regulator.5 LDO2_1.2V enabled 120 Note: Some of patches in this series are already accepted and residing in v3.9-rc1 kernel. These patches are as follows: 1. mfd: tps6507x: add device-tree support. 2. regulator: tps6507x: add device tree support. 3. ARM: davinci: da850: add DT node for I2C0. Vishwanathrao Badarkhe, Manish (2): ARM: regulator: add tps6507x device tree data ARM: davinci: da850: add tps6507x regulator DT data arch/arm/boot/dts/da850-evm.dts | 63 +++ arch/arm/boot/dts/tps6507x.dtsi | 47 + 2 files changed, 110 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/dts/tps6507x.dtsi -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V4] i2c: davinci: update to devm_* API
Update the code to use devm_* API so that driver core will manage resources. Signed-off-by: Vishwanathrao Badarkhe, Manish --- Changes since V3: - Use devm_ioremap_resource API instead of devm_request_and_ioremap. - Update commit message. - Rebase on top of v3.9-rc1 linus tree. Changes since V2: - if "devm_request_and_ioremap" fails return -EADDRNOTAVAIL. instead of -EBUSY. Changes since V1: - Rebase on top of v3.8-rc6 of linus tree. - Apply devm operation on clk_get. :100644 100644 7d1e590... 1fb5a22... M drivers/i2c/busses/i2c-davinci.c drivers/i2c/busses/i2c-davinci.c | 49 +++-- 1 files changed, 15 insertions(+), 34 deletions(-) diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 7d1e590..1fb5a22 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -643,7 +643,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) { struct davinci_i2c_dev *dev; struct i2c_adapter *adap; - struct resource *mem, *irq, *ioarea; + struct resource *mem, *irq; int r; /* NOTE: driver uses the static register mapping */ @@ -659,17 +659,11 @@ static int davinci_i2c_probe(struct platform_device *pdev) return -ENODEV; } - ioarea = request_mem_region(mem->start, resource_size(mem), - pdev->name); - if (!ioarea) { - dev_err(&pdev->dev, "I2C region already claimed\n"); - return -EBUSY; - } - - dev = kzalloc(sizeof(struct davinci_i2c_dev), GFP_KERNEL); + dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev), + GFP_KERNEL); if (!dev) { - r = -ENOMEM; - goto err_release_region; + dev_err(&pdev->dev, "Memory allocation failed\n"); + return -ENOMEM; } init_completion(&dev->cmd_complete); @@ -699,22 +693,24 @@ static int davinci_i2c_probe(struct platform_device *pdev) dev->pdata = &davinci_i2c_platform_data_default; } - dev->clk = clk_get(&pdev->dev, NULL); + dev->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(dev->clk)) { r = -ENODEV; goto err_free_mem; } clk_prepare_enable(dev->clk); - dev->base = ioremap(mem->start, resource_size(mem)); - if (!dev->base) { - r = -EBUSY; - goto err_mem_ioremap; + dev->base = devm_ioremap_resource(&pdev->dev, mem); + if (IS_ERR(dev->base)) { + r = PTR_ERR(dev->base); + dev_err(&pdev->dev, "I2C region already claimed\n"); + goto err_unuse_clocks; } i2c_davinci_init(dev); - r = request_irq(dev->irq, i2c_davinci_isr, 0, pdev->name, dev); + r = devm_request_irq(&pdev->dev, dev->irq, i2c_davinci_isr, 0, + pdev->name, dev); if (r) { dev_err(&pdev->dev, "failure requesting irq %i\n", dev->irq); goto err_unuse_clocks; @@ -723,7 +719,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) r = i2c_davinci_cpufreq_register(dev); if (r) { dev_err(&pdev->dev, "failed to register cpufreq\n"); - goto err_free_irq; + goto err_unuse_clocks; } adap = &dev->adapter; @@ -740,25 +736,17 @@ static int davinci_i2c_probe(struct platform_device *pdev) r = i2c_add_numbered_adapter(adap); if (r) { dev_err(&pdev->dev, "failure adding adapter\n"); - goto err_free_irq; + goto err_unuse_clocks; } of_i2c_register_devices(adap); return 0; -err_free_irq: - free_irq(dev->irq, dev); err_unuse_clocks: - iounmap(dev->base); -err_mem_ioremap: clk_disable_unprepare(dev->clk); - clk_put(dev->clk); dev->clk = NULL; err_free_mem: put_device(&pdev->dev); - kfree(dev); -err_release_region: - release_mem_region(mem->start, resource_size(mem)); return r; } @@ -766,7 +754,6 @@ err_release_region: static int davinci_i2c_remove(struct platform_device *pdev) { struct davinci_i2c_dev *dev = platform_get_drvdata(pdev); - struct resource *mem; i2c_davinci_cpufreq_deregister(dev); @@ -774,16 +761,10 @@ static int davinci_i2c_remove(struct platform_device *pdev) put_device(&pdev->dev); clk_disable_unprepare(dev->clk); - clk_put(dev->clk); dev->clk = NULL; davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0); -
RE: [PATCH V3] i2c: davinci: update to devm_* API
Hi Wolfram On Sat, Feb 16, 2013 at 00:39:43, Wolfram Sang wrote: > On Thu, Feb 07, 2013 at 06:22:00PM +0530, Vishwanathrao Badarkhe, Manish > wrote: > > Update the code to use devm_* API so that driver core will manage > > resources. > > Also, if "devm_request_and_ioremap" fails return -EADDRNOTAVAIL > > instead of -EBUSY. > > > > Signed-off-by: Vishwanathrao Badarkhe, Manish > > Basically OK, please resend when devm_ioremap_resource hits mainline in 3.9. Thanks for pointing this out. Sure, I will resend this patch once devm_ioremap_resource hits mainline in 3.9. Regards, Manish -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH RFC] davinci: poll for sleep completion in resume routine.
Hi Sekhar, On Thu, Feb 14, 2013 at 12:29:11, Nori, Sekhar wrote: > On 2/14/2013 10:46 AM, Vishwanathrao Badarkhe, Manish wrote: > > Hi Sekhar, > > > > On Thu, Feb 14, 2013 at 09:48:59, Nori, Sekhar wrote: > >> Manish, > >> > >> On 1/31/2013 2:56 PM, Vishwanathrao Badarkhe, Manish wrote: > >>> As per OMAP-L138 TRM, Software must poll for SLEEPCOMPLETE bit until > >>> it is set to 1 before clearing SLEEPENABLE bit in DEEPSLEEP register > >>> in resume routine. > >>> Modifications are as per datasheet: > >>> http://www.ti.com/lit/ug/spruh77a/spruh77a.pdf > >>> See sections 10.10.2.2 and 11.5.21 for more detailed explanation. > >> > >> Polling for SLEEPCOMPLETE is not required in RTC controlled wake-up which > >> is the mode currently supported (see section 10.10.2.1 of the TRM). > >> Polling for SLEEPCOMPLETE is required for external controlled wake-up > >> which to my knowledge has never been tested. If you have tested this with > >> external controlled wakep-up, then I can consider this patch. > >> Else, I would like to take it only after externally controlled wake-up is > >> fully tested/supported instead of taking bits and pieces. > > > > Yes, for RTC controlled wakeup, this polling is not required as per section > > 10.10.2.1. > > But if we see in section 10.10.2.2 (Exiting Deep Sleep Mode) step 2, > > When sleep count completes SLEEPCOMPLETE bit gets sets in DEEPSLEEP > > register till that it's not safe to release clock to devices. So If we > > don’t poll for SLEEPCOMPLETE, this delay will not come into picture > > which we actually set while entering deep sleep in case of RTC controlled > > wakeup (Section 10.10.2.1 step 9). > > Please let me know, whether these understanding is correct? > > The delay is coming from hardware. Till SLEEPCOUNT completes, the clock to > device is not provided. There is no need to poll for SLEEPCOMPLETE and indeed > 10.10.2.2 does not ask for this bit to be polled. Thanks for your explanation. Ok, I will test this patch with external controlled wakeup and update you. Regards, Manish Badarkhe N�r��yb�X��ǧv�^�){.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a��� 0��h���i
RE: [PATCH RFC] davinci: poll for sleep completion in resume routine.
Hi Sekhar, On Thu, Feb 14, 2013 at 09:48:59, Nori, Sekhar wrote: > Manish, > > On 1/31/2013 2:56 PM, Vishwanathrao Badarkhe, Manish wrote: > > As per OMAP-L138 TRM, Software must poll for SLEEPCOMPLETE bit until > > it is set to 1 before clearing SLEEPENABLE bit in DEEPSLEEP register > > in resume routine. > > Modifications are as per datasheet: > > http://www.ti.com/lit/ug/spruh77a/spruh77a.pdf > > See sections 10.10.2.2 and 11.5.21 for more detailed explanation. > > Polling for SLEEPCOMPLETE is not required in RTC controlled wake-up which is > the mode currently supported (see section 10.10.2.1 of the TRM). Polling for > SLEEPCOMPLETE is required for external controlled wake-up which to my > knowledge has never been tested. If you have tested this with external > controlled wakep-up, then I can consider this patch. > Else, I would like to take it only after externally controlled wake-up is > fully tested/supported instead of taking bits and pieces. Yes, for RTC controlled wakeup, this polling is not required as per section 10.10.2.1. But if we see in section 10.10.2.2 (Exiting Deep Sleep Mode) step 2, When sleep count completes SLEEPCOMPLETE bit gets sets in DEEPSLEEP register till that it's not safe to release clock to devices. So If we don’t poll for SLEEPCOMPLETE, this delay will not come into picture which we actually set while entering deep sleep in case of RTC controlled wakeup (Section 10.10.2.1 step 9). Please let me know, whether these understanding is correct? For external controlled wakeup, we need to do hardware modifications and hence, Yet to be tested external controlled wakeup functionality. Thanks, Manish Badarkhe > > > > Tested on da850-evm. > > > > Signed-off-by: Vishwanathrao Badarkhe, Manish > > --- > > :100644 100644 d4e9316... 976f096... M arch/arm/mach-davinci/sleep.S > > arch/arm/mach-davinci/sleep.S |8 > > 1 files changed, 8 insertions(+), 0 deletions(-) > > > > diff --git a/arch/arm/mach-davinci/sleep.S > > b/arch/arm/mach-davinci/sleep.S index d4e9316..976f096 100644 > > --- a/arch/arm/mach-davinci/sleep.S > > +++ b/arch/arm/mach-davinci/sleep.S > > @@ -35,6 +35,7 @@ > > #define PLL_LOCK_CYCLES(PLL_LOCK_TIME * 25) > > > > #define DEEPSLEEP_SLEEPENABLE_BIT BIT(31) > > +#define DEEPSLEEP_SLEEPCOMPLETE_BITBIT(30) > > > > .text > > /* > > @@ -110,6 +111,13 @@ ENTRY(davinci_cpu_suspend) > > > > /* Wake up from sleep */ > > > > + /* wait for sleep complete */ > > +sleep_complete: > > + ldr ip, [r4] > > + and ip, ip, #DEEPSLEEP_SLEEPCOMPLETE_BIT > > + cmp ip, #DEEPSLEEP_SLEEPCOMPLETE_BIT > > + bne sleep_complete > > + > > /* Clear sleep enable */ > > ldr ip, [r4] > > bic ip, ip, #DEEPSLEEP_SLEEPENABLE_BIT > > >
[PATCH V3] i2c: davinci: update to devm_* API
Update the code to use devm_* API so that driver core will manage resources. Also, if "devm_request_and_ioremap" fails return -EADDRNOTAVAIL instead of -EBUSY. Signed-off-by: Vishwanathrao Badarkhe, Manish --- :100644 100644 6a0a553... 663ced8... M drivers/i2c/busses/i2c-davinci.c drivers/i2c/busses/i2c-davinci.c | 47 +++-- 1 files changed, 14 insertions(+), 33 deletions(-) Changes since V2: - if "devm_request_and_ioremap" fails return -EADDRNOTAVAIL instead of -EBUSY. Changes since V1: - Rebase on top of v3.8-rc6 of linus tree. - Apply devm operation on clk_get. diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 6a0a553..663ced8 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -643,7 +643,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) { struct davinci_i2c_dev *dev; struct i2c_adapter *adap; - struct resource *mem, *irq, *ioarea; + struct resource *mem, *irq; int r; /* NOTE: driver uses the static register mapping */ @@ -659,17 +659,11 @@ static int davinci_i2c_probe(struct platform_device *pdev) return -ENODEV; } - ioarea = request_mem_region(mem->start, resource_size(mem), - pdev->name); - if (!ioarea) { - dev_err(&pdev->dev, "I2C region already claimed\n"); - return -EBUSY; - } - - dev = kzalloc(sizeof(struct davinci_i2c_dev), GFP_KERNEL); + dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev), + GFP_KERNEL); if (!dev) { - r = -ENOMEM; - goto err_release_region; + dev_err(&pdev->dev, "Memory allocation failed\n"); + return -ENOMEM; } init_completion(&dev->cmd_complete); @@ -699,22 +693,24 @@ static int davinci_i2c_probe(struct platform_device *pdev) dev->pdata = &davinci_i2c_platform_data_default; } - dev->clk = clk_get(&pdev->dev, NULL); + dev->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(dev->clk)) { r = -ENODEV; goto err_free_mem; } clk_prepare_enable(dev->clk); - dev->base = ioremap(mem->start, resource_size(mem)); + dev->base = devm_request_and_ioremap(&pdev->dev, mem); if (!dev->base) { - r = -EBUSY; - goto err_mem_ioremap; + r = -EADDRNOTAVAIL; + dev_err(&pdev->dev, "I2C region already claimed\n"); + goto err_unuse_clocks; } i2c_davinci_init(dev); - r = request_irq(dev->irq, i2c_davinci_isr, 0, pdev->name, dev); + r = devm_request_irq(&pdev->dev, dev->irq, i2c_davinci_isr, 0, + pdev->name, dev); if (r) { dev_err(&pdev->dev, "failure requesting irq %i\n", dev->irq); goto err_unuse_clocks; @@ -723,7 +719,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) r = i2c_davinci_cpufreq_register(dev); if (r) { dev_err(&pdev->dev, "failed to register cpufreq\n"); - goto err_free_irq; + goto err_unuse_clocks; } adap = &dev->adapter; @@ -740,26 +736,18 @@ static int davinci_i2c_probe(struct platform_device *pdev) r = i2c_add_numbered_adapter(adap); if (r) { dev_err(&pdev->dev, "failure adding adapter\n"); - goto err_free_irq; + goto err_unuse_clocks; } of_i2c_register_devices(adap); return 0; -err_free_irq: - free_irq(dev->irq, dev); err_unuse_clocks: - iounmap(dev->base); -err_mem_ioremap: clk_disable_unprepare(dev->clk); - clk_put(dev->clk); dev->clk = NULL; err_free_mem: platform_set_drvdata(pdev, NULL); put_device(&pdev->dev); - kfree(dev); -err_release_region: - release_mem_region(mem->start, resource_size(mem)); return r; } @@ -767,7 +755,6 @@ err_release_region: static int davinci_i2c_remove(struct platform_device *pdev) { struct davinci_i2c_dev *dev = platform_get_drvdata(pdev); - struct resource *mem; i2c_davinci_cpufreq_deregister(dev); @@ -776,16 +763,10 @@ static int davinci_i2c_remove(struct platform_device *pdev) put_device(&pdev->dev); clk_disable_unprepare(dev->clk); - clk_put(dev->clk); dev->clk = NULL; davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0); - free_irq(dev->irq, dev); - iounmap(dev->base); -
RE: [PATCH V2 6/6] ARM: davinci: da850: add tps6507x regulator DT data
Hi Mark, On Tue, Jan 29, 2013 at 13:08:54, Vishwanathrao Badarkhe, Manish wrote: > Add tps6507x regulator device tree data to da850-evm by adding regulator > consumers with tightened constraints and regulator-name.TPS6507x regulator > handle can be obtained by using this regulator name. > Regulator constraints are added as per da850 board file. > > Regulator names are given as per maximum output voltage the regulator is > capable to provide. > for e.g. regulator name for dcdc1 is "VDCDC1_3.3V". > Also, add tps6507x PMIC I2C slave device under I2C0 node. > > Tested on da850-evm. > > Signed-off-by: Vishwanathrao Badarkhe, Manish > --- > Changes since V1: > - No change > > :100644 100644 c9ed683... 58e6961... March/arm/boot/dts/da850-evm.dts > arch/arm/boot/dts/da850-evm.dts | 63 > +++ > 1 files changed, 63 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/boot/dts/da850-evm.dts > b/arch/arm/boot/dts/da850-evm.dts index c9ed683..58e6961 100644 > --- a/arch/arm/boot/dts/da850-evm.dts > +++ b/arch/arm/boot/dts/da850-evm.dts > @@ -31,6 +31,10 @@ > status = "okay"; > pinctrl-names = "default"; > pinctrl-0 = <&i2c0_pins>; > + > + tps: tps@48 { > + reg = <0x48>; > + }; > }; > }; > nand_cs3@6200 { > @@ -38,4 +42,63 @@ > pinctrl-names = "default"; > pinctrl-0 = <&nand_cs3_pins>; > }; > + vbat: fixedregulator@0 { > + compatible = "regulator-fixed"; > + regulator-name = "vbat"; > + regulator-min-microvolt = <500>; > + regulator-max-microvolt = <500>; > + regulator-boot-on; > + }; > +}; > + > +/include/ "tps6507x.dtsi" > + > +&tps { > +vdcdc1_2-supply = <&vbat>; > +vdcdc3-supply = <&vbat>; > +vldo1_2-supply = <&vbat>; > + > +regulators { > +vdcdc1_reg: regulator@0 { > +regulator-name = "VDCDC1_3.3V"; > +regulator-min-microvolt = <315>; > +regulator-max-microvolt = <345>; > +regulator-always-on; > +regulator-boot-on; > +}; > + > +vdcdc2_reg: regulator@1 { > +regulator-name = "VDCDC2_3.3V"; > +regulator-min-microvolt = <171>; > +regulator-max-microvolt = <345>; > +regulator-always-on; > +regulator-boot-on; > +ti,defdcdc_default = <1>; > +}; > + > +vdcdc3_reg: regulator@2 { > +regulator-name = "VDCDC3_1.2V"; > +regulator-min-microvolt = <95>; > +regulator-max-microvolt = <135>; > +regulator-always-on; > +regulator-boot-on; > +ti,defdcdc_default = <1>; > +}; > + > +ldo1_reg: regulator@3 { > +regulator-name = "LDO1_1.8V"; > +regulator-min-microvolt = <171>; > +regulator-max-microvolt = <189>; > +regulator-always-on; > +regulator-boot-on; > +}; > + > +ldo2_reg: regulator@4 { > +regulator-name = "LDO2_1.2V"; > +regulator-min-microvolt = <114>; > +regulator-max-microvolt = <132>; > +regulator-always-on; > +regulator-boot-on; > +}; > +}; > }; > -- > 1.7.4.1 > > If there are not any comments on this patch, Could you please accept this patch? Regards, Manish -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH V2 5/6] ARM: regulator: add tps6507x device tree data
Hi Mark, On Tue, Jan 29, 2013 at 13:08:53, Vishwanathrao Badarkhe, Manish wrote: > Add device tree data for tps6507x regulator by adding all tps6507x regulator > nodes. Regulators are initialized based on compatible name provided in > tps6507x DT file. > > All tps6507x PMIC regulator device tree nodes are placed in a separate device > tree include file (tps6507x.dtsi). > tps6507x.dtsi file is created using datasheet > http://www.ti.com/lit/ds/symlink/tps65070.pdf > > Tested on da850-evm. > > Signed-off-by: Vishwanathrao Badarkhe, Manish > --- > Changes since V1: > - Updated Copyright information. > > :00 100644 000... 4c326e5... Aarch/arm/boot/dts/tps6507x.dtsi > arch/arm/boot/dts/tps6507x.dtsi | 47 > +++ > 1 files changed, 47 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/boot/dts/tps6507x.dtsi > b/arch/arm/boot/dts/tps6507x.dtsi new file mode 100644 index 000..4c326e5 > --- /dev/null > +++ b/arch/arm/boot/dts/tps6507x.dtsi > @@ -0,0 +1,47 @@ > +/* > + * Copyright (C) 2013 Texas Instruments Incorporated - > +http://www.ti.com/ > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + */ > + > +/* > + * Integrated Power Management Chip > + * http://www.ti.com/lit/ds/symlink/tps65070.pdf > + */ > + > +&tps { > + compatible = "ti,tps6507x"; > + > + regulators { > + #address-cells = <1>; > + #size-cells = <0>; > + > + vdcdc1_reg: regulator@0 { > + reg = <0>; > + regulator-compatible = "VDCDC1"; > + }; > + > + vdcdc2_reg: regulator@1 { > + reg = <1>; > + regulator-compatible = "VDCDC2"; > + }; > + > + vdcdc3_reg: regulator@2 { > + reg = <2>; > + regulator-compatible = "VDCDC3"; > + }; > + > + ldo1_reg: regulator@3 { > + reg = <3>; > + regulator-compatible = "LDO1"; > + }; > + > + ldo2_reg: regulator@4 { > + reg = <4>; > + regulator-compatible = "LDO2"; > + }; > + > + }; > +}; > -- > 1.7.4.1 > > If there are not any comments on this patch, Could you please accept this patch? Regards, Manish -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH V2] i2c: davinci: update to devm_* API
Hi Sergei, On Wed, Feb 06, 2013 at 17:21:36, Sergei Shtylyov wrote: > Hello. > > On 06-02-2013 15:22, Vishwanathrao Badarkhe, Manish wrote: > > > Update the code to use devm_* API so that driver core will manage > > resources. > > > Signed-off-by: Vishwanathrao Badarkhe, Manish > > --- > > Changes since V1: > >- Rebase on top of v3.8-rc6 of linus tree. > >- Apply devm operation on clk_get. > > > :100644 100644 6a0a553... da4e218... M drivers/i2c/busses/i2c-davinci.c > > drivers/i2c/busses/i2c-davinci.c | 45 > > +++--- > > 1 files changed, 13 insertions(+), 32 deletions(-) > > > diff --git a/drivers/i2c/busses/i2c-davinci.c > > b/drivers/i2c/busses/i2c-davinci.c > > index 6a0a553..da4e218 100644 > > --- a/drivers/i2c/busses/i2c-davinci.c > > +++ b/drivers/i2c/busses/i2c-davinci.c > [...] > > @@ -699,22 +693,24 @@ static int davinci_i2c_probe(struct platform_device > > *pdev) > > dev->pdata = &davinci_i2c_platform_data_default; > > } > > > > - dev->clk = clk_get(&pdev->dev, NULL); > > + dev->clk = devm_clk_get(&pdev->dev, NULL); > > if (IS_ERR(dev->clk)) { > > r = -ENODEV; > > goto err_free_mem; > > } > > clk_prepare_enable(dev->clk); > > > > - dev->base = ioremap(mem->start, resource_size(mem)); > > + dev->base = devm_request_and_ioremap(&pdev->dev, mem); > > if (!dev->base) { > > r = -EBUSY; > > Comment to devm_request_and_ioremap() suggests returning -EADDRNOTAVAIL > on failure. -EBUSY wasn't the right code even before this change, should have > been -ENOMEM. Oh, you are right. I will change this to -EADDRNOTAVAIL. Thanks for pointing this out. Thanks, Manish Badarkhe -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V2] i2c: davinci: update to devm_* API
Update the code to use devm_* API so that driver core will manage resources. Signed-off-by: Vishwanathrao Badarkhe, Manish --- Changes since V1: - Rebase on top of v3.8-rc6 of linus tree. - Apply devm operation on clk_get. :100644 100644 6a0a553... da4e218... M drivers/i2c/busses/i2c-davinci.c drivers/i2c/busses/i2c-davinci.c | 45 +++--- 1 files changed, 13 insertions(+), 32 deletions(-) diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 6a0a553..da4e218 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -643,7 +643,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) { struct davinci_i2c_dev *dev; struct i2c_adapter *adap; - struct resource *mem, *irq, *ioarea; + struct resource *mem, *irq; int r; /* NOTE: driver uses the static register mapping */ @@ -659,17 +659,11 @@ static int davinci_i2c_probe(struct platform_device *pdev) return -ENODEV; } - ioarea = request_mem_region(mem->start, resource_size(mem), - pdev->name); - if (!ioarea) { - dev_err(&pdev->dev, "I2C region already claimed\n"); - return -EBUSY; - } - - dev = kzalloc(sizeof(struct davinci_i2c_dev), GFP_KERNEL); + dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev), + GFP_KERNEL); if (!dev) { - r = -ENOMEM; - goto err_release_region; + dev_err(&pdev->dev, "Memory allocation failed\n"); + return -ENOMEM; } init_completion(&dev->cmd_complete); @@ -699,22 +693,24 @@ static int davinci_i2c_probe(struct platform_device *pdev) dev->pdata = &davinci_i2c_platform_data_default; } - dev->clk = clk_get(&pdev->dev, NULL); + dev->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(dev->clk)) { r = -ENODEV; goto err_free_mem; } clk_prepare_enable(dev->clk); - dev->base = ioremap(mem->start, resource_size(mem)); + dev->base = devm_request_and_ioremap(&pdev->dev, mem); if (!dev->base) { r = -EBUSY; - goto err_mem_ioremap; + dev_err(&pdev->dev, "I2C region already claimed\n"); + goto err_unuse_clocks; } i2c_davinci_init(dev); - r = request_irq(dev->irq, i2c_davinci_isr, 0, pdev->name, dev); + r = devm_request_irq(&pdev->dev, dev->irq, i2c_davinci_isr, 0, + pdev->name, dev); if (r) { dev_err(&pdev->dev, "failure requesting irq %i\n", dev->irq); goto err_unuse_clocks; @@ -723,7 +719,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) r = i2c_davinci_cpufreq_register(dev); if (r) { dev_err(&pdev->dev, "failed to register cpufreq\n"); - goto err_free_irq; + goto err_unuse_clocks; } adap = &dev->adapter; @@ -740,26 +736,18 @@ static int davinci_i2c_probe(struct platform_device *pdev) r = i2c_add_numbered_adapter(adap); if (r) { dev_err(&pdev->dev, "failure adding adapter\n"); - goto err_free_irq; + goto err_unuse_clocks; } of_i2c_register_devices(adap); return 0; -err_free_irq: - free_irq(dev->irq, dev); err_unuse_clocks: - iounmap(dev->base); -err_mem_ioremap: clk_disable_unprepare(dev->clk); - clk_put(dev->clk); dev->clk = NULL; err_free_mem: platform_set_drvdata(pdev, NULL); put_device(&pdev->dev); - kfree(dev); -err_release_region: - release_mem_region(mem->start, resource_size(mem)); return r; } @@ -767,7 +755,6 @@ err_release_region: static int davinci_i2c_remove(struct platform_device *pdev) { struct davinci_i2c_dev *dev = platform_get_drvdata(pdev); - struct resource *mem; i2c_davinci_cpufreq_deregister(dev); @@ -776,16 +763,10 @@ static int davinci_i2c_remove(struct platform_device *pdev) put_device(&pdev->dev); clk_disable_unprepare(dev->clk); - clk_put(dev->clk); dev->clk = NULL; davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0); - free_irq(dev->irq, dev); - iounmap(dev->base); - kfree(dev); - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(mem->start, resource_size(mem)); return 0; } -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: davinci: da850: add DT node for I2C0
Add I2C0 device tree and pin muxing information to da850-evm. Also, add OF_DEV_AUXDATA for I2C0 controller driver in da850 board dt file to use I2C0 clock. Verified i2c0 node gets created in sys class interface as "/sys/class/i2c-dev/i2c-0/subsystem/i2c-0". Signed-off-by: Vishwanathrao Badarkhe, Manish --- Applies on top of v3.8-rc6 of linus tree. Depends on - drivers/pinctrl: grab default handles from device core http://www.gossamer-threads.com/lists/linux/kernel/1665411 - ARM: davinci: da850: add interrupt-parent property in soc node https://patchwork.kernel.org/patch/2044101/ - ARM: davinci: da850: add pinctrl support http://comments.gmane.org/gmane.linux.davinci/25993 :100644 100644 433027f... 738d5d4... M arch/arm/boot/dts/da850-evm.dts :100644 100644 4b02167... a0072aa... M arch/arm/boot/dts/da850.dtsi :100644 100644 37c27af... 95ca4e9... M arch/arm/mach-davinci/da8xx-dt.c arch/arm/boot/dts/da850-evm.dts |6 ++ arch/arm/boot/dts/da850.dtsi | 14 ++ arch/arm/mach-davinci/da8xx-dt.c |8 +++- 3 files changed, 27 insertions(+), 1 deletions(-) diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts index 433027f..738d5d4 100644 --- a/arch/arm/boot/dts/da850-evm.dts +++ b/arch/arm/boot/dts/da850-evm.dts @@ -27,6 +27,12 @@ serial2: serial@1d0d000 { status = "okay"; }; + i2c0: i2c@1c22000 { + status = "okay"; + clock-frequency = <10>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + }; }; nand_cs3@6200 { status = "okay"; diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi index 4b02167..a0072aa 100644 --- a/arch/arm/boot/dts/da850.dtsi +++ b/arch/arm/boot/dts/da850.dtsi @@ -56,6 +56,12 @@ 0x30 0x0110 0x0ff0 >; }; + i2c0_pins: pinmux_i2c0_pins { + pinctrl-single,bits = < + /* I2C0_SDA,I2C0_SCL */ + 0x10 0x2200 0xff00 + >; + }; }; serial0: serial@1c42000 { compatible = "ns16550a"; @@ -81,6 +87,14 @@ interrupts = <61>; status = "disabled"; }; + i2c0: i2c@1c22000 { + compatible = "ti,davinci-i2c"; + reg = <0x22000 0x1000>; + interrupts = <15>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; }; nand_cs3@6200 { compatible = "ti,davinci-nand"; diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c index 37c27af..95ca4e9 100644 --- a/arch/arm/mach-davinci/da8xx-dt.c +++ b/arch/arm/mach-davinci/da8xx-dt.c @@ -37,11 +37,17 @@ static void __init da8xx_init_irq(void) of_irq_init(da8xx_irq_match); } +struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { + OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL), + {} +}; + #ifdef CONFIG_ARCH_DAVINCI_DA850 static void __init da850_init_machine(void) { - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + of_platform_populate(NULL, of_default_bus_match_table, + da850_auxdata_lookup, NULL); da8xx_uart_clk_enable(); } -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH V2 1/6] pinctrl: pinctrl-single: use arch_initcall and module_exit
Hi Russell, On Tue, Feb 05, 2013 at 16:57:31, Russell King - ARM Linux wrote: > On Tue, Feb 05, 2013 at 06:36:34AM +0000, Vishwanathrao Badarkhe, Manish > wrote: > > I made following changes, in order to update "dip->p" pointer with > > correct value: > > > > - if (!dpi->p) { > > + if (IS_ERR_OR_NULL(dpi->p)) { > > dpi->p = devm_pinctrl_get(dev); > > - if (IS_ERR_OR_NULL(dpi->p)) { > > - int ret = PTR_ERR(dpi->p); > > - > > - dev_dbg(dev, "no pinctrl handle\n"); > > - /* Only return deferrals */ > > - if (ret == -EPROBE_DEFER) > > - return ret; > > - return 0; > > - } > > + ret = PTR_ERR(dpi->p); > > + dev_dbg(dev, "no pinctrl handle\n"); > > + /* Only return deferrals */ > > + if (ret == -EPROBE_DEFER) > > + return ret; > > + return 0; > > > > Is this intended change? > > The above looks totally broken to me. > > Oh, it's using IS_ERR_OR_NULL(), so it's bound to be broken. > I went through discussion in community on usage of "IS_ERR_OR_NULL". https://patchwork.kernel.org/patch/1953271/ Will take care not use this in future. Thanks, Manish -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH V2 1/6] pinctrl: pinctrl-single: use arch_initcall and module_exit
Hi Linus On Tue, Feb 05, 2013 at 18:30:48, Linus Walleij wrote: > On Tue, Feb 5, 2013 at 7:36 AM, Vishwanathrao Badarkhe, Manish > wrote: > > > I made following changes, in order to update "dip->p" pointer with > > correct value: > > > > - if (!dpi->p) { > > + if (IS_ERR_OR_NULL(dpi->p)) { > > dpi->p = devm_pinctrl_get(dev); > > - if (IS_ERR_OR_NULL(dpi->p)) { > > - int ret = PTR_ERR(dpi->p); > > - > > - dev_dbg(dev, "no pinctrl handle\n"); > > - /* Only return deferrals */ > > - if (ret == -EPROBE_DEFER) > > - return ret; > > - return 0; > > - } > > + ret = PTR_ERR(dpi->p); > > + dev_dbg(dev, "no pinctrl handle\n"); > > + /* Only return deferrals */ > > + if (ret == -EPROBE_DEFER) > > + return ret; > > + return 0; > > This is based on some old code that I wrote ages ago. Check the pinctrl tree > or linux-next for the latest core pin grabbing code. > Use that instead. Thanks for your reply. I have checked with your latest changes regarding pinctrl in linux-next tree and these changes are working fine for me. Regards Manish Badarkhe -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH] i2c: davinci: update to devm_* API
Hi Sekhar On Tue, Feb 05, 2013 at 17:17:25, Nori, Sekhar wrote: > > > On 2/5/2013 1:54 PM, Vishwanathrao Badarkhe, Manish wrote: > > Update the code to use devm_* API so that driver core will manage > > resources. > > > > Signed-off-by: Vishwanathrao Badarkhe, Manish > > You can use devm_clk_get() as well. We should also move to runtime PM but that can be a different patch. Sure, I will apply devm operation for clk_get also in next version. Ok, will move to runtime PM in a different patch. Thanks, Manish Badarkhe > > --- > > :100644 100644 6a0a553... f3dfffb... M drivers/i2c/busses/i2c-davinci.c > > drivers/i2c/busses/i2c-davinci.c | 41 > > +++-- > > 1 files changed, 12 insertions(+), 29 deletions(-) > > > > diff --git a/drivers/i2c/busses/i2c-davinci.c > > b/drivers/i2c/busses/i2c-davinci.c > > index 6a0a553..f3dfffb 100644 > > --- a/drivers/i2c/busses/i2c-davinci.c > > +++ b/drivers/i2c/busses/i2c-davinci.c > > @@ -643,7 +643,7 @@ static int davinci_i2c_probe(struct > > platform_device *pdev) { > > struct davinci_i2c_dev *dev; > > struct i2c_adapter *adap; > > - struct resource *mem, *irq, *ioarea; > > + struct resource *mem, *irq; > > int r; > > > > /* NOTE: driver uses the static register mapping */ @@ -659,17 > > +659,11 @@ static int davinci_i2c_probe(struct platform_device *pdev) > > return -ENODEV; > > } > > > > - ioarea = request_mem_region(mem->start, resource_size(mem), > > - pdev->name); > > - if (!ioarea) { > > - dev_err(&pdev->dev, "I2C region already claimed\n"); > > - return -EBUSY; > > - } > > - > > - dev = kzalloc(sizeof(struct davinci_i2c_dev), GFP_KERNEL); > > + dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev), > > + GFP_KERNEL); > > if (!dev) { > > - r = -ENOMEM; > > - goto err_release_region; > > + dev_err(&pdev->dev, "Memory allocation failed\n"); > > + return -ENOMEM; > > } > > > > init_completion(&dev->cmd_complete); > > @@ -706,15 +700,17 @@ static int davinci_i2c_probe(struct platform_device > > *pdev) > > } > > clk_prepare_enable(dev->clk); > > > > - dev->base = ioremap(mem->start, resource_size(mem)); > > + dev->base = devm_request_and_ioremap(&pdev->dev, mem); > > if (!dev->base) { > > r = -EBUSY; > > - goto err_mem_ioremap; > > + dev_err(&pdev->dev, "I2C region already claimed\n"); > > + goto err_unuse_clocks; > > } > > > > i2c_davinci_init(dev); > > > > - r = request_irq(dev->irq, i2c_davinci_isr, 0, pdev->name, dev); > > + r = devm_request_irq(&pdev->dev, dev->irq, i2c_davinci_isr, 0, > > + pdev->name, dev); > > if (r) { > > dev_err(&pdev->dev, "failure requesting irq %i\n", dev->irq); > > goto err_unuse_clocks; > > @@ -723,7 +719,7 @@ static int davinci_i2c_probe(struct platform_device > > *pdev) > > r = i2c_davinci_cpufreq_register(dev); > > if (r) { > > dev_err(&pdev->dev, "failed to register cpufreq\n"); > > - goto err_free_irq; > > + goto err_unuse_clocks; > > } > > > > adap = &dev->adapter; > > @@ -740,26 +736,19 @@ static int davinci_i2c_probe(struct platform_device > > *pdev) > > r = i2c_add_numbered_adapter(adap); > > if (r) { > > dev_err(&pdev->dev, "failure adding adapter\n"); > > - goto err_free_irq; > > + goto err_unuse_clocks; > > } > > of_i2c_register_devices(adap); > > > > return 0; > > > > -err_free_irq: > > - free_irq(dev->irq, dev); > > err_unuse_clocks: > > - iounmap(dev->base); > > -err_mem_ioremap: > > clk_disable_unprepare(dev->clk); > > clk_put(dev->clk); > > dev->clk = NULL; > > err_free_mem: > > platform_set_drvdata(pdev, NULL); > > put_device(&pdev->dev); > > - kfree(dev); > > -err_release_region: > > - release_mem_region(mem->start, resource_size(mem)); > > > > return r; > > } > > @@ -767,7 +756,6 @@ err_release_region: > > static int davinci_i2c_remove(struct platform_device *pdev) { > > struct davinci_i2c_dev *dev = platform_get_drvdata(pdev); > > - struct resource *mem; > > > > i2c_davinci_cpufreq_deregister(dev); > > > > @@ -780,12 +768,7 @@ static int davinci_i2c_remove(struct platform_device > > *pdev) > > dev->clk = NULL; > > > > davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0); > > - free_irq(dev->irq, dev); > > - iounmap(dev->base); > > - kfree(dev); > > > > - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > - release_mem_region(mem->start, resource_size(mem)); > > return 0; > > } > > > > > N�r��yb�X��ǧv�^�){.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a��� 0��h���i
[PATCH] i2c: davinci: update to devm_* API
Update the code to use devm_* API so that driver core will manage resources. Signed-off-by: Vishwanathrao Badarkhe, Manish --- :100644 100644 6a0a553... f3dfffb... M drivers/i2c/busses/i2c-davinci.c drivers/i2c/busses/i2c-davinci.c | 41 +++-- 1 files changed, 12 insertions(+), 29 deletions(-) diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 6a0a553..f3dfffb 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -643,7 +643,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) { struct davinci_i2c_dev *dev; struct i2c_adapter *adap; - struct resource *mem, *irq, *ioarea; + struct resource *mem, *irq; int r; /* NOTE: driver uses the static register mapping */ @@ -659,17 +659,11 @@ static int davinci_i2c_probe(struct platform_device *pdev) return -ENODEV; } - ioarea = request_mem_region(mem->start, resource_size(mem), - pdev->name); - if (!ioarea) { - dev_err(&pdev->dev, "I2C region already claimed\n"); - return -EBUSY; - } - - dev = kzalloc(sizeof(struct davinci_i2c_dev), GFP_KERNEL); + dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev), + GFP_KERNEL); if (!dev) { - r = -ENOMEM; - goto err_release_region; + dev_err(&pdev->dev, "Memory allocation failed\n"); + return -ENOMEM; } init_completion(&dev->cmd_complete); @@ -706,15 +700,17 @@ static int davinci_i2c_probe(struct platform_device *pdev) } clk_prepare_enable(dev->clk); - dev->base = ioremap(mem->start, resource_size(mem)); + dev->base = devm_request_and_ioremap(&pdev->dev, mem); if (!dev->base) { r = -EBUSY; - goto err_mem_ioremap; + dev_err(&pdev->dev, "I2C region already claimed\n"); + goto err_unuse_clocks; } i2c_davinci_init(dev); - r = request_irq(dev->irq, i2c_davinci_isr, 0, pdev->name, dev); + r = devm_request_irq(&pdev->dev, dev->irq, i2c_davinci_isr, 0, + pdev->name, dev); if (r) { dev_err(&pdev->dev, "failure requesting irq %i\n", dev->irq); goto err_unuse_clocks; @@ -723,7 +719,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) r = i2c_davinci_cpufreq_register(dev); if (r) { dev_err(&pdev->dev, "failed to register cpufreq\n"); - goto err_free_irq; + goto err_unuse_clocks; } adap = &dev->adapter; @@ -740,26 +736,19 @@ static int davinci_i2c_probe(struct platform_device *pdev) r = i2c_add_numbered_adapter(adap); if (r) { dev_err(&pdev->dev, "failure adding adapter\n"); - goto err_free_irq; + goto err_unuse_clocks; } of_i2c_register_devices(adap); return 0; -err_free_irq: - free_irq(dev->irq, dev); err_unuse_clocks: - iounmap(dev->base); -err_mem_ioremap: clk_disable_unprepare(dev->clk); clk_put(dev->clk); dev->clk = NULL; err_free_mem: platform_set_drvdata(pdev, NULL); put_device(&pdev->dev); - kfree(dev); -err_release_region: - release_mem_region(mem->start, resource_size(mem)); return r; } @@ -767,7 +756,6 @@ err_release_region: static int davinci_i2c_remove(struct platform_device *pdev) { struct davinci_i2c_dev *dev = platform_get_drvdata(pdev); - struct resource *mem; i2c_davinci_cpufreq_deregister(dev); @@ -780,12 +768,7 @@ static int davinci_i2c_remove(struct platform_device *pdev) dev->clk = NULL; davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0); - free_irq(dev->irq, dev); - iounmap(dev->base); - kfree(dev); - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(mem->start, resource_size(mem)); return 0; } -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH V2 1/6] pinctrl: pinctrl-single: use arch_initcall and module_exit
On Fri, Feb 01, 2013 at 22:41:24, Tony Lindgren wrote: > * Tony Lindgren [130201 09:12]: > > * Linus Walleij [130129 03:03]: > > > On Tue, Jan 29, 2013 at 8:38 AM, Vishwanathrao Badarkhe, Manish > > > wrote: > > > > > > > Currently, I2C driver gets probed before pinctrl driver. > > > > To achieve I2C pin muxing via pinctrl driver before I2C probe get > > > > called, register pinctrl driver in arch_initcall. > > > > Also, add module_exit to unregister pinctrl driver. > > > > > > > > Signed-off-by: Vishwanathrao Badarkhe, Manish > > > > > > So your I2C driver is not returning -EPROBE_DEFER if it cannot find > > > its pins? > > > > > > Hm, well I can live with this, if Tony ACKs it. > > > > Hmm pinctrl is before i2c in drivers/Makefile. > > Making initcalls happen earlier and earlier is usually the wrong way > > to go. Sounds like there's some other issue here that needs to be > > fixed instead. > > Let me guess: The i2c driver is wrongly set to run with arch_initcall? > Hi Tony No, Currently i2c driver is set to subsys_initcall. I have seen some problem while using pin control grab functionality. Please see detailed explanation as below. Hi Linus I am using auto grab pin control facility to do pin muxing of I2C0 pins and seen problem as below: Currently, probe of I2C0 driver gets called before pin control driver. Hence, while calling I2C0 probe because of unavailability of pin control node information, its probe get deferred giving following messages: "i2c_davinci i2c_davinci.1: could not find pctldev for node /soc/pinmux@1c14120 /pinmux_i2c0_pins, deferring probe" As I2C0 is in deferred list (as auto grab patch handle this), its probe get called once again, During this second time probe of I2C0, I have observed following crash: "Unable to handle kernel paging request at virtual address fe07" As per code analysis of auto grab functionality, I have seen in "pinctrl_bind_pin" function, pin control handle (dpi->p) is returned by "devm_pinctrl_get" function. Pin control handle is assigned with error pointer during 1st time probing of I2C0 (as pin control information is not available at this time). During 2nd time probing (deferred probe) of I2C0, same pin control handle (which was get assigned during 1st probe) is getting used instead of getting updated to correct pin control handle which leads to system crash. I made following changes, in order to update "dip->p" pointer with correct value: - if (!dpi->p) { + if (IS_ERR_OR_NULL(dpi->p)) { dpi->p = devm_pinctrl_get(dev); - if (IS_ERR_OR_NULL(dpi->p)) { - int ret = PTR_ERR(dpi->p); - - dev_dbg(dev, "no pinctrl handle\n"); - /* Only return deferrals */ - if (ret == -EPROBE_DEFER) - return ret; - return 0; - } + ret = PTR_ERR(dpi->p); + dev_dbg(dev, "no pinctrl handle\n"); + /* Only return deferrals */ + if (ret == -EPROBE_DEFER) + return ret; + return 0; Is this intended change? or am I missing something in order to use this auto grab functionality? With the above change, now deferred probing is working fine and there is no need to register pin control driver in arch_initcall. Regards, Manish -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH V2 3/6] ARM: davinci: da850: add DT node for I2C0
On Sun, Feb 03, 2013 at 18:19:05, Nori, Sekhar wrote: > > > On 1/29/2013 1:08 PM, Vishwanathrao Badarkhe, Manish wrote: > > Add I2C0 device tree node information to da850-evm. > > Also, add I2C0 pin muxing information in da850-evm. > > > > Signed-off-by: Vishwanathrao Badarkhe, Manish > > --- > > Changes since V1: > > - Updated i2c0 node names in dts and dtsi file. > > - Removed interrupt parent from i2c0 node. > > - Handled i2c0 pin mux inside i2c0 node. > > > > :100644 100644 433027f... c9ed683... M arch/arm/boot/dts/da850-evm.dts > > :100644 100644 5e0eb5c... 245ab9a... M arch/arm/boot/dts/da850.dtsi > > arch/arm/boot/dts/da850-evm.dts |5 + > > arch/arm/boot/dts/da850.dtsi| 15 +++ > > 2 files changed, 20 insertions(+), 0 deletions(-) > > > > diff --git a/arch/arm/boot/dts/da850-evm.dts > > b/arch/arm/boot/dts/da850-evm.dts index 433027f..c9ed683 100644 > > --- a/arch/arm/boot/dts/da850-evm.dts > > +++ b/arch/arm/boot/dts/da850-evm.dts > > @@ -27,6 +27,11 @@ > > serial2: serial@1d0d000 { > > status = "okay"; > > }; > > + i2c0: i2c0@1c22000 { > > This should be: > > i2c0: i2c@1c22000 > > inline with what has been done in rest of this file. Ok, I will update this name everywhere. > > > + status = "okay"; > > + pinctrl-names = "default"; > > + pinctrl-0 = <&i2c0_pins>; > > + }; > > }; > > nand_cs3@6200 { > > status = "okay"; > > diff --git a/arch/arm/boot/dts/da850.dtsi > > b/arch/arm/boot/dts/da850.dtsi index 5e0eb5c..245ab9a 100644 > > --- a/arch/arm/boot/dts/da850.dtsi > > +++ b/arch/arm/boot/dts/da850.dtsi > > @@ -56,6 +56,12 @@ > > 0x30 0x0110 0x0ff0 > > >; > > }; > > + i2c0_pins: pinmux_i2c0_pins { > > + pinctrl-single,bits = < > > + /* I2C0_SDA,I2C0_SCL */ > > + 0x10 0x2200 0xff00 > > + >; > > + }; > > }; > > serial0: serial@1c42000 { > > compatible = "ns16550a"; > > @@ -81,6 +87,15 @@ > > interrupts = <61>; > > status = "disabled"; > > }; > > + i2c0: i2c0@1c22000 { > > + compatible = "ti,davinci-i2c"; > > + reg = <0x22000 0x1000>; > > + clock-frequency = <10>; > > The clock frequency is board specific. This should come from da850-evm.dts. Ok, I will add this board specific information in da850-evm.dts. > > Also, I think you can merge the auxdata addition with this patch. Can you > post the i2c0 support separate from this series, so it can be taken > independently? Looks like other patches have some dependencies/acks needed. Sure, I will merge auxdata addition with this patch and post this patch independently from this series. > > Thanks, > Sekhar > Regards, Manish N�r��yb�X��ǧv�^�){.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a��� 0��h���i
RE: [PATCH RFC] davinci: poll for sleep completion in resume routine.
Hi Sekhar On Thu, Jan 31, 2013 at 15:21:42, Nori, Sekhar wrote: > > > On 1/31/2013 2:56 PM, Vishwanathrao Badarkhe, Manish wrote: > > As per OMAP-L138 TRM, Software must poll for SLEEPCOMPLETE bit until > > it is set to 1 before clearing SLEEPENABLE bit in DEEPSLEEP register > > in resume routine. > > Modifications are as per datasheet: > > http://www.ti.com/lit/ug/spruh77a/spruh77a.pdf > > See sections 10.10.2.2 and 11.5.21 for more detailed explanation. > > > > Tested on da850-evm. > > > > Signed-off-by: Vishwanathrao Badarkhe, Manish > > Is this a bug fix? Do you see any issue without this patch? This is not a bug fix. I have not seen any issue without this patch. Only, modifications are done as per OMAP-L138 TRM. > > Thanks, > Sekhar > Regards, Manish N�r��yb�X��ǧv�^�){.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a��� 0��h���i
[PATCH RFC] davinci: poll for sleep completion in resume routine.
As per OMAP-L138 TRM, Software must poll for SLEEPCOMPLETE bit until it is set to 1 before clearing SLEEPENABLE bit in DEEPSLEEP register in resume routine. Modifications are as per datasheet: http://www.ti.com/lit/ug/spruh77a/spruh77a.pdf See sections 10.10.2.2 and 11.5.21 for more detailed explanation. Tested on da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- :100644 100644 d4e9316... 976f096... M arch/arm/mach-davinci/sleep.S arch/arm/mach-davinci/sleep.S |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-davinci/sleep.S b/arch/arm/mach-davinci/sleep.S index d4e9316..976f096 100644 --- a/arch/arm/mach-davinci/sleep.S +++ b/arch/arm/mach-davinci/sleep.S @@ -35,6 +35,7 @@ #define PLL_LOCK_CYCLES(PLL_LOCK_TIME * 25) #define DEEPSLEEP_SLEEPENABLE_BIT BIT(31) +#define DEEPSLEEP_SLEEPCOMPLETE_BITBIT(30) .text /* @@ -110,6 +111,13 @@ ENTRY(davinci_cpu_suspend) /* Wake up from sleep */ + /* wait for sleep complete */ +sleep_complete: + ldr ip, [r4] + and ip, ip, #DEEPSLEEP_SLEEPCOMPLETE_BIT + cmp ip, #DEEPSLEEP_SLEEPCOMPLETE_BIT + bne sleep_complete + /* Clear sleep enable */ ldr ip, [r4] bic ip, ip, #DEEPSLEEP_SLEEPENABLE_BIT -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC] davinci: poll for sleep completion in resume routine.
As per OMAP-L138 TRM, Software must poll for SLEEPCOMPLETE bit until it is set to 1 before clearing SLEEPENABLE bit in DEEPSLEEP register in resume routine. Modifications are as per datasheet: http://www.ti.com/lit/ug/spruh77a/spruh77a.pdf See sections 10.10.2.2 and 11.5.21 for more detailed explanation. Tested on da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- :100644 100644 d4e9316... 976f096... M arch/arm/mach-davinci/sleep.S arch/arm/mach-davinci/sleep.S |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-davinci/sleep.S b/arch/arm/mach-davinci/sleep.S index d4e9316..976f096 100644 --- a/arch/arm/mach-davinci/sleep.S +++ b/arch/arm/mach-davinci/sleep.S @@ -35,6 +35,7 @@ #define PLL_LOCK_CYCLES(PLL_LOCK_TIME * 25) #define DEEPSLEEP_SLEEPENABLE_BIT BIT(31) +#define DEEPSLEEP_SLEEPCOMPLETE_BITBIT(30) .text /* @@ -110,6 +111,13 @@ ENTRY(davinci_cpu_suspend) /* Wake up from sleep */ + /* wait for sleep complete */ +sleep_complete: + ldr ip, [r4] + and ip, ip, #DEEPSLEEP_SLEEPCOMPLETE_BIT + cmp ip, #DEEPSLEEP_SLEEPCOMPLETE_BIT + bne sleep_complete + /* Clear sleep enable */ ldr ip, [r4] bic ip, ip, #DEEPSLEEP_SLEEPENABLE_BIT -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH V2 1/6] pinctrl: pinctrl-single: use arch_initcall and module_exit
Hi Linus, On Tue, Jan 29, 2013 at 16:29:54, Linus Walleij wrote: > On Tue, Jan 29, 2013 at 8:38 AM, Vishwanathrao Badarkhe, Manish > wrote: > > > Currently, I2C driver gets probed before pinctrl driver. > > To achieve I2C pin muxing via pinctrl driver before I2C probe get > > called, register pinctrl driver in arch_initcall. > > Also, add module_exit to unregister pinctrl driver. > > > > Signed-off-by: Vishwanathrao Badarkhe, Manish > > So your I2C driver is not returning -EPROBE_DEFER if it cannot find its pins? Yes. In Davinci I2C driver, it's not implemented to return -EPROBE_DEFER if it can't find its pins. Please see below discussion for more details: https://patchwork2.kernel.org/patch/2031321/ > > Hm, well I can live with this, if Tony ACKs it. > > Yours, > Linus Walleij > Regards, Manish -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V2 2/6] ARM: davinci: da850: add OF_DEV_AUXDATA entry for I2C0
Add OF_DEV_AUXDATA for I2C0 controller driver in da850 board dt file to use I2C0 clock. Signed-off-by: Vishwanathrao Badarkhe, Manish --- Changes since V1: - updated name for auxdata lookup da850_evm_auxdata_lookup -> da850_auxdata_lookup :100644 100644 37c27af... 95ca4e9... M arch/arm/mach-davinci/da8xx-dt.c arch/arm/mach-davinci/da8xx-dt.c |8 +++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c index 37c27af..95ca4e9 100644 --- a/arch/arm/mach-davinci/da8xx-dt.c +++ b/arch/arm/mach-davinci/da8xx-dt.c @@ -37,11 +37,17 @@ static void __init da8xx_init_irq(void) of_irq_init(da8xx_irq_match); } +struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { + OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL), + {} +}; + #ifdef CONFIG_ARCH_DAVINCI_DA850 static void __init da850_init_machine(void) { - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + of_platform_populate(NULL, of_default_bus_match_table, + da850_auxdata_lookup, NULL); da8xx_uart_clk_enable(); } -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V2 6/6] ARM: davinci: da850: add tps6507x regulator DT data
Add tps6507x regulator device tree data to da850-evm by adding regulator consumers with tightened constraints and regulator-name.TPS6507x regulator handle can be obtained by using this regulator name. Regulator constraints are added as per da850 board file. Regulator names are given as per maximum output voltage the regulator is capable to provide. for e.g. regulator name for dcdc1 is "VDCDC1_3.3V". Also, add tps6507x PMIC I2C slave device under I2C0 node. Tested on da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- Changes since V1: - No change :100644 100644 c9ed683... 58e6961... M arch/arm/boot/dts/da850-evm.dts arch/arm/boot/dts/da850-evm.dts | 63 +++ 1 files changed, 63 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts index c9ed683..58e6961 100644 --- a/arch/arm/boot/dts/da850-evm.dts +++ b/arch/arm/boot/dts/da850-evm.dts @@ -31,6 +31,10 @@ status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins>; + + tps: tps@48 { + reg = <0x48>; + }; }; }; nand_cs3@6200 { @@ -38,4 +42,63 @@ pinctrl-names = "default"; pinctrl-0 = <&nand_cs3_pins>; }; + vbat: fixedregulator@0 { + compatible = "regulator-fixed"; + regulator-name = "vbat"; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + regulator-boot-on; + }; +}; + +/include/ "tps6507x.dtsi" + +&tps { +vdcdc1_2-supply = <&vbat>; +vdcdc3-supply = <&vbat>; +vldo1_2-supply = <&vbat>; + +regulators { +vdcdc1_reg: regulator@0 { +regulator-name = "VDCDC1_3.3V"; +regulator-min-microvolt = <315>; +regulator-max-microvolt = <345>; +regulator-always-on; +regulator-boot-on; +}; + +vdcdc2_reg: regulator@1 { +regulator-name = "VDCDC2_3.3V"; +regulator-min-microvolt = <171>; +regulator-max-microvolt = <345>; +regulator-always-on; +regulator-boot-on; +ti,defdcdc_default = <1>; +}; + +vdcdc3_reg: regulator@2 { +regulator-name = "VDCDC3_1.2V"; +regulator-min-microvolt = <95>; +regulator-max-microvolt = <135>; +regulator-always-on; +regulator-boot-on; +ti,defdcdc_default = <1>; +}; + +ldo1_reg: regulator@3 { +regulator-name = "LDO1_1.8V"; +regulator-min-microvolt = <171>; +regulator-max-microvolt = <189>; +regulator-always-on; +regulator-boot-on; +}; + +ldo2_reg: regulator@4 { +regulator-name = "LDO2_1.2V"; +regulator-min-microvolt = <114>; +regulator-max-microvolt = <132>; +regulator-always-on; +regulator-boot-on; +}; +}; }; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V2 3/6] ARM: davinci: da850: add DT node for I2C0
Add I2C0 device tree node information to da850-evm. Also, add I2C0 pin muxing information in da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- Changes since V1: - Updated i2c0 node names in dts and dtsi file. - Removed interrupt parent from i2c0 node. - Handled i2c0 pin mux inside i2c0 node. :100644 100644 433027f... c9ed683... M arch/arm/boot/dts/da850-evm.dts :100644 100644 5e0eb5c... 245ab9a... M arch/arm/boot/dts/da850.dtsi arch/arm/boot/dts/da850-evm.dts |5 + arch/arm/boot/dts/da850.dtsi| 15 +++ 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts index 433027f..c9ed683 100644 --- a/arch/arm/boot/dts/da850-evm.dts +++ b/arch/arm/boot/dts/da850-evm.dts @@ -27,6 +27,11 @@ serial2: serial@1d0d000 { status = "okay"; }; + i2c0: i2c0@1c22000 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + }; }; nand_cs3@6200 { status = "okay"; diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi index 5e0eb5c..245ab9a 100644 --- a/arch/arm/boot/dts/da850.dtsi +++ b/arch/arm/boot/dts/da850.dtsi @@ -56,6 +56,12 @@ 0x30 0x0110 0x0ff0 >; }; + i2c0_pins: pinmux_i2c0_pins { + pinctrl-single,bits = < + /* I2C0_SDA,I2C0_SCL */ + 0x10 0x2200 0xff00 + >; + }; }; serial0: serial@1c42000 { compatible = "ns16550a"; @@ -81,6 +87,15 @@ interrupts = <61>; status = "disabled"; }; + i2c0: i2c0@1c22000 { + compatible = "ti,davinci-i2c"; + reg = <0x22000 0x1000>; + clock-frequency = <10>; + interrupts = <15>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; }; nand_cs3@6200 { compatible = "ti,davinci-nand"; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V2 5/6] ARM: regulator: add tps6507x device tree data
Add device tree data for tps6507x regulator by adding all tps6507x regulator nodes. Regulators are initialized based on compatible name provided in tps6507x DT file. All tps6507x PMIC regulator device tree nodes are placed in a separate device tree include file (tps6507x.dtsi). tps6507x.dtsi file is created using datasheet http://www.ti.com/lit/ds/symlink/tps65070.pdf Tested on da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- Changes since V1: - Updated Copyright information. :00 100644 000... 4c326e5... A arch/arm/boot/dts/tps6507x.dtsi arch/arm/boot/dts/tps6507x.dtsi | 47 +++ 1 files changed, 47 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/tps6507x.dtsi b/arch/arm/boot/dts/tps6507x.dtsi new file mode 100644 index 000..4c326e5 --- /dev/null +++ b/arch/arm/boot/dts/tps6507x.dtsi @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/* + * Integrated Power Management Chip + * http://www.ti.com/lit/ds/symlink/tps65070.pdf + */ + +&tps { + compatible = "ti,tps6507x"; + + regulators { + #address-cells = <1>; + #size-cells = <0>; + + vdcdc1_reg: regulator@0 { + reg = <0>; + regulator-compatible = "VDCDC1"; + }; + + vdcdc2_reg: regulator@1 { + reg = <1>; + regulator-compatible = "VDCDC2"; + }; + + vdcdc3_reg: regulator@2 { + reg = <2>; + regulator-compatible = "VDCDC3"; + }; + + ldo1_reg: regulator@3 { + reg = <3>; + regulator-compatible = "LDO1"; + }; + + ldo2_reg: regulator@4 { + reg = <4>; + regulator-compatible = "LDO2"; + }; + + }; +}; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V2 4/6] mfd: tps6507x: add device-tree support.
Add device tree based initialization support for TI's tps6507x mfd device. Signed-off-by: Vishwanathrao Badarkhe, Manish --- Changes since V1: - updated subject line for commit. :100644 100644 409afa2... 5ad4b77... M drivers/mfd/tps6507x.c drivers/mfd/tps6507x.c |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/mfd/tps6507x.c b/drivers/mfd/tps6507x.c index 409afa2..5ad4b77 100644 --- a/drivers/mfd/tps6507x.c +++ b/drivers/mfd/tps6507x.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -116,11 +117,19 @@ static const struct i2c_device_id tps6507x_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, tps6507x_i2c_id); +#ifdef CONFIG_OF +static struct of_device_id tps6507x_of_match[] = { + {.compatible = "ti,tps6507x", }, + {}, +}; +MODULE_DEVICE_TABLE(of, tps6507x_of_match); +#endif static struct i2c_driver tps6507x_i2c_driver = { .driver = { .name = "tps6507x", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(tps6507x_of_match), }, .probe = tps6507x_i2c_probe, .remove = tps6507x_i2c_remove, -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V2 1/6] pinctrl: pinctrl-single: use arch_initcall and module_exit
Currently, I2C driver gets probed before pinctrl driver. To achieve I2C pin muxing via pinctrl driver before I2C probe get called, register pinctrl driver in arch_initcall. Also, add module_exit to unregister pinctrl driver. Signed-off-by: Vishwanathrao Badarkhe, Manish --- :100644 100644 f6a360b... 3a96390... M drivers/pinctrl/pinctrl-single.c drivers/pinctrl/pinctrl-single.c | 12 +++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index f6a360b..3a96390 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -1089,7 +1089,17 @@ static struct platform_driver pcs_driver = { }, }; -module_platform_driver(pcs_driver); +static int __init pcs_pinctrl_init(void) +{ + return platform_driver_register(&pcs_driver); +} +arch_initcall(pcs_pinctrl_init); + +static void __exit pcs_pinctrl_exit(void) +{ + platform_driver_unregister(&pcs_driver); +} +module_exit(pcs_pinctrl_exit); MODULE_AUTHOR("Tony Lindgren "); MODULE_DESCRIPTION("One-register-per-pin type device tree based pinctrl driver"); -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V2 0/6] davinci: DT support for i2c0 and tps6507x
This patch series enables device tree support for I2C0 and for regulator via tps6507x mfd device on da850-evm. Applies on top of v3.8-rc5 of linus tree. Tested on da850-evm device. Test procedure followed as below: Once device boots up, issue command as: $for reg in /sys/class/regulator/*; do echo $reg `cat $reg/name` `cat $reg/state` `cat $reg/microvolts`; done Depends on: - ARM: davinci: da850: add interrupt-parent property in soc node https://patchwork.kernel.org/patch/2044101/ - ARM: davinci: da850: add pinctrl support http://comments.gmane.org/gmane.linux.davinci/25993 Changes since V1: - Updated i2c0 node name in da850 dts and dtsi file. - Removed interrupt parent from i2c0 node. - Updated name for da850 auxdata lookup. - Added a patch in series to update pin control driver registration. Vishwanathrao Badarkhe, Manish (6): pinctrl: pinctrl-single: use arch_initcall and module_exit ARM: davinci: da850: add OF_DEV_AUXDATA entry for I2C0 ARM: davinci: da850: add DT node for I2C0 mfd: tps6507x: add device-tree support. ARM: regulator: add tps6507x device tree data ARM: davinci: da850: add tps6507x regulator DT data arch/arm/boot/dts/da850-evm.dts | 68 ++ arch/arm/boot/dts/da850.dtsi | 15 arch/arm/boot/dts/tps6507x.dtsi | 47 ++ arch/arm/mach-davinci/da8xx-dt.c |8 - drivers/mfd/tps6507x.c |9 + drivers/pinctrl/pinctrl-single.c | 12 ++- 6 files changed, 157 insertions(+), 2 deletions(-) create mode 100644 arch/arm/boot/dts/tps6507x.dtsi -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH 2/6] ARM: davinci: da850: add DT node for I2C0
On Fri, Jan 25, 2013 at 16:20:13, Nori, Sekhar wrote: > On 1/24/2013 5:05 PM, Vishwanathrao Badarkhe, Manish wrote: > > Add I2C0 device tree node information to da850-evm. > > Also, add I2C0 pin muxing information in da850-evm. > > > > Signed-off-by: Vishwanathrao Badarkhe, Manish > > --- > > Depends on patch > > http://comments.gmane.org/gmane.linux.davinci/25993 > > > > arch/arm/boot/dts/da850-evm.dts | 15 +++ > > arch/arm/boot/dts/da850.dtsi| 10 ++ > > 2 files changed, 25 insertions(+), 0 deletions(-) > > > > diff --git a/arch/arm/boot/dts/da850-evm.dts > > b/arch/arm/boot/dts/da850-evm.dts index 8cac9d2..3d8290a 100755 > > --- a/arch/arm/boot/dts/da850-evm.dts > > +++ b/arch/arm/boot/dts/da850-evm.dts > > @@ -27,5 +27,20 @@ > > serial2: serial@1d0d000 { > > status = "okay"; > > }; > > + i2c0@1c22000 { > > This should be > i2c0: i2c@1c22000 > > to follow the convention elsewhere in file. Ok, I will change this in next version. > > > + status = "okay"; > > + }; > > + }; > > +}; > > +&pmx_core { > > + pinctrl-names = "default"; > > + pinctrl-0 = < > > + &i2c0_pins > > + >; > > + > > + i2c0_pins: pinmux_i2c0_pins{ > > + pinctrl-single,bits = < > > + 0x10 0x2200 0xff00 /* I2C0_SDA,I2C0_SCL */ > > + >; > > This should go into the dtsi file. See the discussion on NAND DT support > submitted by Anil Kumar. I have seen Anil Kumar's discussion for pin-muxing which includes Linus patch of grab pin control handles from device core at following location: http://lkml.indiana.edu/hypermail/linux/kernel/1301.2/00094.html I have done changes accordingly for I2C0 pin muxing and seen kernel crashes giving message like "i2c_davinci i2c_davinci.1: could not find pctldev for node /soc/ pinmux@1c14120/pinmux_i2c0_pins, deferring probe". This is happened because I2C0 driver gets probed before pin mux driver. To resolve this issue, I made changes in code to ensure pin control driver gets probed before I2C0 driver by registering pin control driver during arch_init call. Hence, in order to move I2C0 pin muxing in dtsi file above fix is required. > > Thanks, > Sekhar > > PS: You are using an old address for Kevin Hilman. The MAINTAINERS file has > been updated for a long time now. Liam's address is also wrong but I don't > have his updated e-mail. > Regards, Manish N�r��yb�X��ǧv�^�){.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a��� 0��h���i
RE: [PATCH 5/6] ARM: regulator: add tps6507x device tree data
On Sat, Jan 26, 2013 at 10:42:08, Mark Brown wrote: > On Fri, Jan 25, 2013 at 06:29:49AM +0000, Vishwanathrao Badarkhe, Manish > wrote: > > On Thu, Jan 24, 2013 at 17:30:51, Mark Brown wrote: > > > I too doubt that whether it should be in architecture specific folder, > > > My code is in reference to below patch: > > arm/dts: regulator: Add tps65910 device tree > > data(d5d08e2e1672da627d7c9d34a9dc1089c653e23a) > > > Could you please suggest me if it can be moved somewhere else? > > We should have somewhere to put this sort of generic stuff, yes. Not sure > where, possibly under drivers/of or some non-drivers part of the tree. > Right now, nobody has put this kind of generic stuff other than architecture folder. Later on We can move these kind of generic stuff somewhere else in one shot. Regards, Manish -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH 5/6] ARM: regulator: add tps6507x device tree data
Hi Mark, On Thu, Jan 24, 2013 at 17:30:51, Mark Brown wrote: > On Thu, Jan 24, 2013 at 04:25:19PM +0530, Vishwanathrao Badarkhe, Manish > wrote: > > > --- > > arch/arm/boot/dts/tps6507x.dtsi | 47 > > +++ > > Why are you putting this in arch/arm? > I too doubt that whether it should be in architecture specific folder, My code is in reference to below patch: arm/dts: regulator: Add tps65910 device tree data(d5d08e2e1672da627d7c9d34a9dc1089c653e23a) Could you please suggest me if it can be moved somewhere else? Regards, Manish -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/6] ARM: davinci: da850: add DT node for I2C0
Add I2C0 device tree node information to da850-evm. Also, add I2C0 pin muxing information in da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- Depends on patch http://comments.gmane.org/gmane.linux.davinci/25993 arch/arm/boot/dts/da850-evm.dts | 15 +++ arch/arm/boot/dts/da850.dtsi| 10 ++ 2 files changed, 25 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts index 8cac9d2..3d8290a 100755 --- a/arch/arm/boot/dts/da850-evm.dts +++ b/arch/arm/boot/dts/da850-evm.dts @@ -27,5 +27,20 @@ serial2: serial@1d0d000 { status = "okay"; }; + i2c0@1c22000 { + status = "okay"; + }; + }; +}; +&pmx_core { + pinctrl-names = "default"; + pinctrl-0 = < + &i2c0_pins + >; + + i2c0_pins: pinmux_i2c0_pins{ + pinctrl-single,bits = < + 0x10 0x2200 0xff00 /* I2C0_SDA,I2C0_SCL */ + >; }; }; diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi index 1e6d090..f5ee811 100755 --- a/arch/arm/boot/dts/da850.dtsi +++ b/arch/arm/boot/dts/da850.dtsi @@ -66,5 +66,15 @@ interrupt-parent = <&intc>; status = "disabled"; }; + i2c0@1c22000 { + compatible = "ti,davinci-i2c"; + reg = <0x22000 0x1000>; + clock-frequency = <10>; + interrupts = <15>; + interrupt-parent = <&intc>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; }; }; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/6] davinci: mfd: tps6507x: add device-tree support.
Add device tree based initialization support for TI's tps6507x mfd device. Signed-off-by: Vishwanathrao Badarkhe, Manish --- drivers/mfd/tps6507x.c |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/mfd/tps6507x.c b/drivers/mfd/tps6507x.c index 409afa2..5ad4b77 100644 --- a/drivers/mfd/tps6507x.c +++ b/drivers/mfd/tps6507x.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -116,11 +117,19 @@ static const struct i2c_device_id tps6507x_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, tps6507x_i2c_id); +#ifdef CONFIG_OF +static struct of_device_id tps6507x_of_match[] = { + {.compatible = "ti,tps6507x", }, + {}, +}; +MODULE_DEVICE_TABLE(of, tps6507x_of_match); +#endif static struct i2c_driver tps6507x_i2c_driver = { .driver = { .name = "tps6507x", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(tps6507x_of_match), }, .probe = tps6507x_i2c_probe, .remove = tps6507x_i2c_remove, -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/6] ARM: davinci: da850: add tps6507x regulator DT data
Add tps6507x regulator device tree data to da850-evm by adding regulator consumers with tightened constraints and regulator-name.TPS6507x regulator handle can be obtained by using this regulator name. Regulator constraints are added as per da850 board file. Regulator names are given as per maximum output voltage the regulator is capable to provide. for e.g. regulator name for dcdc1 is "VDCDC1_3.3V". Also, add tps6507x PMIC I2C slave device under I2C0 node. Tested on da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- arch/arm/boot/dts/da850-evm.dts | 64 +++ 1 files changed, 64 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts index 3d8290a..605a13e 100755 --- a/arch/arm/boot/dts/da850-evm.dts +++ b/arch/arm/boot/dts/da850-evm.dts @@ -29,8 +29,72 @@ }; i2c0@1c22000 { status = "okay"; + + tps: tps@48 { + reg = <0x48>; + }; }; }; + + vbat: fixedregulator@0 { + compatible = "regulator-fixed"; + regulator-name = "vbat"; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + regulator-boot-on; + }; +}; + +/include/ "tps6507x.dtsi" + +&tps { +vdcdc1_2-supply = <&vbat>; +vdcdc3-supply = <&vbat>; +vldo1_2-supply = <&vbat>; + +regulators { +vdcdc1_reg: regulator@0 { +regulator-name = "VDCDC1_3.3V"; +regulator-min-microvolt = <315>; +regulator-max-microvolt = <345>; +regulator-always-on; +regulator-boot-on; +}; + +vdcdc2_reg: regulator@1 { +regulator-name = "VDCDC2_3.3V"; +regulator-min-microvolt = <171>; +regulator-max-microvolt = <345>; +regulator-always-on; +regulator-boot-on; +ti,defdcdc_default = <1>; +}; + +vdcdc3_reg: regulator@2 { +regulator-name = "VDCDC3_1.2V"; +regulator-min-microvolt = <95>; +regulator-max-microvolt = <135>; +regulator-always-on; +regulator-boot-on; +ti,defdcdc_default = <1>; +}; + +ldo1_reg: regulator@3 { +regulator-name = "LDO1_1.8V"; +regulator-min-microvolt = <171>; +regulator-max-microvolt = <189>; +regulator-always-on; +regulator-boot-on; +}; + +ldo2_reg: regulator@4 { +regulator-name = "LDO2_1.2V"; +regulator-min-microvolt = <114>; +regulator-max-microvolt = <132>; +regulator-always-on; +regulator-boot-on; +}; +}; }; &pmx_core { pinctrl-names = "default"; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/6] davinci: regulator: tps6507x: add device tree support.
Add device tree based initialization support for TI's tps6507x regulators. Add device tree binding document for TI's tps6507x using datasheet: http://www.ti.com/lit/ds/symlink/tps65070.pdf Signed-off-by: Vishwanathrao Badarkhe, Manish --- Documentation/devicetree/bindings/mfd/tps6507x.txt | 91 +++ drivers/regulator/tps6507x-regulator.c | 92 2 files changed, 183 insertions(+), 0 deletions(-) create mode 100755 Documentation/devicetree/bindings/mfd/tps6507x.txt diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt b/Documentation/devicetree/bindings/mfd/tps6507x.txt new file mode 100755 index 000..8fffa3c --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt @@ -0,0 +1,91 @@ +TPS6507x Power Management Integrated Circuit + +Required properties: +- compatible: "ti,tps6507x" +- reg: I2C slave address +- regulators: This is the list of child nodes that specify the regulator + initialization data for defined regulators. Not all regulators for the + given device need to be present. The definition for each of these nodes + is defined using the standard binding for regulators found at + Documentation/devicetree/bindings/regulator/regulator.txt. + The regulator is matched with the regulator-compatible. + + The valid regulator-compatible values are: + tps6507x: vdcdc1, vdcdc2, vdcdc3, vldo1, vldo2 +- xxx-supply: Input voltage supply regulator. + These entries are required if regulators are enabled for a device. + Missing of these properties can cause the regulator registration + fails. + If some of input supply is powered through battery or always-on + supply then also it is require to have these parameters with proper + node handle of always on power supply. + tps6507x: + vindcdc1_2-supply: VDCDC1 and VDCDC2 input. + vindcdc3-supply : VDCDC3 input. + vldo1_2-supply : VLDO1 and VLDO2 input. + +Regulator Optional properties: +- defdcdc_default: It's property of DCDC2 and DCDC3 regulators. + 0: If defdcdc pin of DCDC2/DCDC3 is pulled to GND. + 1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH. + If this property is not defined, it defaults to 0 (not enabled). + +Example: + + pmu: tps6507x@48 { + compatible = "ti,tps6507x"; + reg = <0x48>; + + vindcdc1_2-supply = <&vbat>; + vindcdc3-supply = <...>; + vinldo1_2-supply = <...>; + + regulators { + #address-cells = <1>; + #size-cells = <0>; + + vdcdc1_reg: regulator@0 { + regulator-compatible = "VDCDC1"; + reg = <0>; + regulator-min-microvolt = <315>; + regulator-max-microvolt = <345>; + regulator-always-on; + regulator-boot-on; + }; + vdcdc2_reg: regulator@1 { + regulator-compatible = "VDCDC2"; + reg = <1>; + regulator-min-microvolt = <171>; + regulator-max-microvolt = <345>; + regulator-always-on; + regulator-boot-on; + defdcdc_default = <1>; + }; + vdcdc3_reg: regulator@2 { + regulator-compatible = "VDCDC3"; + reg = <2>; + regulator-min-microvolt = <95> + regulator-max-microvolt = <135>; + regulator-always-on; + regulator-boot-on; + defdcdc_default = <1>; + }; + ldo1_reg: regulator@3 { + regulator-compatible = "LDO1"; + reg = <3>; + regulator-min-microvolt = <171>; + regulator-max-microvolt = <189>; + regulator-always-on; + regulator-boot-on; + }; + ldo2_reg: regulator@4 { + regulator-compatible = "LDO2"; + reg = <4>; + regulator-min-microvolt = <114>; + regulator-max-microvolt = <132>; + regulator-a
[PATCH 0/6] davinci: support for i2c0 and tps6507x
This patch series enables device tree support for I2C0 and for regulator via tps6507x mfd device on da850-evm. Applies on top of v3.8-rc4 of linus tree. Tested on da850-evm device. Test procedure followed as below: Once device boots up, issue command as: $for reg in /sys/class/regulator/*; do echo $reg `cat $reg/name` `cat $reg/state` `cat $reg/microvolts`; done This command will print all available regulators with its name, status (enabled/disabled) and voltages(in microvolts) like as below: /sys/class/regulator/regulator.1 VDCDC1_3.3V enabled 330 /sys/class/regulator/regulator.2 VDCDC2_3.3V enabled 330 /sys/class/regulator/regulator.3 VDCDC3_1.2V enabled 120 /sys/class/regulator/regulator.4 LDO1_1.8V enabled 180 /sys/class/regulator/regulator.5 LDO2_1.2V enabled 120 Vishwanathrao Badarkhe, Manish (6): ARM: davinci: da850: add OF_DEV_AUXDATA entry for I2C0 ARM: davinci: da850: add DT node for I2C0 davinci: mfd: tps6507x: add device-tree support. davinci: regulator: tps6507x: add device tree support. ARM: regulator: add tps6507x device tree data ARM: davinci: da850: add tps6507x regulator DT data Documentation/devicetree/bindings/mfd/tps6507x.txt | 91 +++ arch/arm/boot/dts/da850-evm.dts| 79 + arch/arm/boot/dts/da850.dtsi | 10 ++ arch/arm/boot/dts/tps6507x.dtsi| 47 ++ arch/arm/mach-davinci/da8xx-dt.c |8 ++- drivers/mfd/tps6507x.c |9 ++ drivers/regulator/tps6507x-regulator.c | 92 7 files changed, 335 insertions(+), 1 deletions(-) create mode 100755 Documentation/devicetree/bindings/mfd/tps6507x.txt create mode 100644 arch/arm/boot/dts/tps6507x.dtsi -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/6] ARM: davinci: da850: add OF_DEV_AUXDATA entry for I2C0
Add OF_DEV_AUXDATA for I2C0 controller driver in da850 board dt file to use I2C0 clock. Signed-off-by: Vishwanathrao Badarkhe, Manish --- arch/arm/mach-davinci/da8xx-dt.c |8 +++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c index 37c27af..100d644 100644 --- a/arch/arm/mach-davinci/da8xx-dt.c +++ b/arch/arm/mach-davinci/da8xx-dt.c @@ -37,11 +37,17 @@ static void __init da8xx_init_irq(void) of_irq_init(da8xx_irq_match); } +struct of_dev_auxdata da850_evm_auxdata_lookup[] __initdata = { + OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL), + {} +}; + #ifdef CONFIG_ARCH_DAVINCI_DA850 static void __init da850_init_machine(void) { - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + of_platform_populate(NULL, of_default_bus_match_table, + da850_evm_auxdata_lookup, NULL); da8xx_uart_clk_enable(); } -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/6] ARM: regulator: add tps6507x device tree data
Add device tree data for tps6507x regulator by adding all tps6507x regulator nodes. Regulators are initialized based on compatible name provided in tps6507x DT file. All tps6507x PMIC regulator device tree nodes are placed in a separate device tree include file (tps6507x.dtsi). tps6507x.dtsi file is created using datasheet http://www.ti.com/lit/ds/symlink/tps65070.pdf Tested on da850-evm. Signed-off-by: Vishwanathrao Badarkhe, Manish --- arch/arm/boot/dts/tps6507x.dtsi | 47 +++ 1 files changed, 47 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/dts/tps6507x.dtsi diff --git a/arch/arm/boot/dts/tps6507x.dtsi b/arch/arm/boot/dts/tps6507x.dtsi new file mode 100644 index 000..4ae483e --- /dev/null +++ b/arch/arm/boot/dts/tps6507x.dtsi @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/* + * Integrated Power Management Chip + * http://www.ti.com/lit/ds/symlink/tps65070.pdf + */ + +&tps { + compatible = "ti,tps6507x"; + + regulators { + #address-cells = <1>; + #size-cells = <0>; + + vdcdc1_reg: regulator@0 { + reg = <0>; + regulator-compatible = "VDCDC1"; + }; + + vdcdc2_reg: regulator@1 { + reg = <1>; + regulator-compatible = "VDCDC2"; + }; + + vdcdc3_reg: regulator@2 { + reg = <2>; + regulator-compatible = "VDCDC3"; + }; + + ldo1_reg: regulator@3 { + reg = <3>; + regulator-compatible = "LDO1"; + }; + + ldo2_reg: regulator@4 { + reg = <4>; + regulator-compatible = "LDO2"; + }; + + }; +}; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/