All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fixes to twl4030-madc and add BeagleBoard support
@ 2011-08-11  3:27 Kyle Manna
  2011-08-11  3:27 ` [PATCH 1/3] twl4030-madc: copy the device pointer Kyle Manna
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Kyle Manna @ 2011-08-11  3:27 UTC (permalink / raw)
  To: linux-omap; +Cc: Kyle Manna

These patches add basic functionality to the twl4030-madc driver to make
it work on the BeagleBoard xM.  These patches were also tested on a OMAP3EVM.

Kyle Manna (3):
  twl4030-madc: copy the device pointer
  twl4030-madc: turn on the MADC clock
  BeagleBoard: add support for the twl4030-madc

 arch/arm/mach-omap2/board-omap3beagle.c |   11 +++++++++++
 drivers/mfd/twl4030-madc.c              |   27 ++++++++++++++++++++++++++-
 include/linux/i2c/twl4030-madc.h        |    4 ++++
 3 files changed, 41 insertions(+), 1 deletions(-)

-- 
1.7.4.1


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

* [PATCH 1/3] twl4030-madc: copy the device pointer
  2011-08-11  3:27 [PATCH 0/3] Fixes to twl4030-madc and add BeagleBoard support Kyle Manna
@ 2011-08-11  3:27 ` Kyle Manna
  2011-08-11  9:50   ` Grazvydas Ignotas
  2011-08-11  3:27 ` [PATCH 2/3] twl4030-madc: turn on the MADC clock Kyle Manna
  2011-08-11  3:27 ` [PATCH 3/3] BeagleBoard: add support for the twl4030-madc Kyle Manna
  2 siblings, 1 reply; 22+ messages in thread
From: Kyle Manna @ 2011-08-11  3:27 UTC (permalink / raw)
  To: linux-omap; +Cc: Kyle Manna

Worst case this fixes the following error:
[   72.086212] (NULL device *): conversion timeout!

Best case it prevents a crash

Signed-off-by: Kyle Manna <kyle@kylemanna.com>
---
 drivers/mfd/twl4030-madc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
index b5d598c..8ef7801 100644
--- a/drivers/mfd/twl4030-madc.c
+++ b/drivers/mfd/twl4030-madc.c
@@ -706,6 +706,9 @@ static int __devinit twl4030_madc_probe(struct platform_device *pdev)
 	if (!madc)
 		return -ENOMEM;
 
+	/* Copy the pointer to device struct */
+	madc->dev = &pdev->dev;
+
 	/*
 	 * Phoenix provides 2 interrupt lines. The first one is connected to
 	 * the OMAP. The other one can be connected to the other processor such
@@ -733,7 +736,7 @@ static int __devinit twl4030_madc_probe(struct platform_device *pdev)
 	ret = twl_i2c_write_u8(TWL4030_MODULE_MAIN_CHARGE,
 			       regval, TWL4030_BCI_BCICTL1);
 	if (ret) {
-		dev_err(&pdev->dev, "unable to write reg BCI Ctl1 0x%X\n",
+		dev_err(&pdev->dev, "unable to write reg BCI CTL1 0x%X\n",
 			TWL4030_BCI_BCICTL1);
 		goto err_i2c;
 	}
-- 
1.7.4.1


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

* [PATCH 2/3] twl4030-madc: turn on the MADC clock
  2011-08-11  3:27 [PATCH 0/3] Fixes to twl4030-madc and add BeagleBoard support Kyle Manna
  2011-08-11  3:27 ` [PATCH 1/3] twl4030-madc: copy the device pointer Kyle Manna
@ 2011-08-11  3:27 ` Kyle Manna
  2011-08-11  9:55   ` Grazvydas Ignotas
  2011-08-11  3:27 ` [PATCH 3/3] BeagleBoard: add support for the twl4030-madc Kyle Manna
  2 siblings, 1 reply; 22+ messages in thread
From: Kyle Manna @ 2011-08-11  3:27 UTC (permalink / raw)
  To: linux-omap; +Cc: Kyle Manna

Without turning the MADC clock on, no MADC conversions occur.

$ cat /sys/class/hwmon/hwmon0/device/in8_input
[   53.428436] twl4030_madc twl4030_madc: conversion timeout!
cat: read error: Resource temporarily unavailable

Signed-off-by: Kyle Manna <kyle@kylemanna.com>
---
 drivers/mfd/twl4030-madc.c       |   22 ++++++++++++++++++++++
 include/linux/i2c/twl4030-madc.h |    4 ++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
index 8ef7801..75040b4 100644
--- a/drivers/mfd/twl4030-madc.c
+++ b/drivers/mfd/twl4030-madc.c
@@ -740,6 +740,28 @@ static int __devinit twl4030_madc_probe(struct platform_device *pdev)
 			TWL4030_BCI_BCICTL1);
 		goto err_i2c;
 	}
+
+	/* Check that MADC clock is on */
+	ret = twl_i2c_read_u8(TWL4030_MODULE_INTBR, &regval, TWL4030_REG_GPBR1);
+	if (ret) {
+		dev_err(&pdev->dev, "unable to read reg GPBR1 0x%X\n",
+				TWL4030_REG_GPBR1);
+	}
+
+	/* If MADC clk is not on, turn it on */
+	if (!(regval & TWL4030_GPBR1_MADC_HFCLK_EN)) {
+		dev_info(&pdev->dev, "clk disabled, enabling\n");
+		regval |= TWL4030_GPBR1_MADC_HFCLK_EN;
+		ret = twl_i2c_write_u8(TWL4030_MODULE_INTBR, regval,
+				       TWL4030_REG_GPBR1);
+		if (ret) {
+			dev_err(&pdev->dev, "unable to write reg GPBR1 0x%X\n",
+					TWL4030_REG_GPBR1);
+			goto err_i2c;
+		}
+	}
+
+
 	platform_set_drvdata(pdev, madc);
 	mutex_init(&madc->lock);
 	ret = request_threaded_irq(platform_get_irq(pdev, 0), NULL,
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
index 6427d29..530e11b 100644
--- a/include/linux/i2c/twl4030-madc.h
+++ b/include/linux/i2c/twl4030-madc.h
@@ -129,6 +129,10 @@ enum sample_type {
 #define REG_BCICTL2             0x024
 #define TWL4030_BCI_ITHSENS	0x007
 
+/* Register and bits for GPBR1 register */
+#define TWL4030_REG_GPBR1		0x0c
+#define TWL4030_GPBR1_MADC_HFCLK_EN	(1 << 7)
+
 struct twl4030_madc_user_parms {
 	int channel;
 	int average;
-- 
1.7.4.1


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

* [PATCH 3/3] BeagleBoard: add support for the twl4030-madc
  2011-08-11  3:27 [PATCH 0/3] Fixes to twl4030-madc and add BeagleBoard support Kyle Manna
  2011-08-11  3:27 ` [PATCH 1/3] twl4030-madc: copy the device pointer Kyle Manna
  2011-08-11  3:27 ` [PATCH 2/3] twl4030-madc: turn on the MADC clock Kyle Manna
@ 2011-08-11  3:27 ` Kyle Manna
  2011-08-11  9:44   ` Grazvydas Ignotas
  2 siblings, 1 reply; 22+ messages in thread
From: Kyle Manna @ 2011-08-11  3:27 UTC (permalink / raw)
  To: linux-omap; +Cc: Kyle Manna

Signed-off-by: Kyle Manna <kyle@kylemanna.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 3ae16b4..a82d53b 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -362,11 +362,16 @@ static struct regulator_init_data beagle_vsim = {
 	.consumer_supplies	= beagle_vsim_supply,
 };
 
+static struct twl4030_madc_platform_data beagle_madc = {
+	.irq_line       = 1,
+};
+
 static struct twl4030_platform_data beagle_twldata = {
 	/* platform_data for children goes here */
 	.gpio		= &beagle_gpio_data,
 	.vmmc1		= &beagle_vmmc1,
 	.vsim		= &beagle_vsim,
+	.madc		= &beagle_madc,
 };
 
 static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
@@ -456,9 +461,15 @@ static void __init omap3_beagle_init_irq(void)
 	omap3_init_irq();
 }
 
+static struct platform_device madc_hwmon = {
+	.name		= "twl4030_madc_hwmon",
+	.id		= -1,
+};
+
 static struct platform_device *omap3_beagle_devices[] __initdata = {
 	&leds_gpio,
 	&keys_gpio,
+	&madc_hwmon,
 };
 
 static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
-- 
1.7.4.1


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

* Re: [PATCH 3/3] BeagleBoard: add support for the twl4030-madc
  2011-08-11  3:27 ` [PATCH 3/3] BeagleBoard: add support for the twl4030-madc Kyle Manna
@ 2011-08-11  9:44   ` Grazvydas Ignotas
  2011-08-12  3:33     ` [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support Kyle Manna
  0 siblings, 1 reply; 22+ messages in thread
From: Grazvydas Ignotas @ 2011-08-11  9:44 UTC (permalink / raw)
  To: Kyle Manna; +Cc: linux-omap

You need to CC linux-arm-kernel too.

On Thu, Aug 11, 2011 at 6:27 AM, Kyle Manna <kyle@kylemanna.com> wrote:
> Signed-off-by: Kyle Manna <kyle@kylemanna.com>
> ---
>  arch/arm/mach-omap2/board-omap3beagle.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
> index 3ae16b4..a82d53b 100644
> --- a/arch/arm/mach-omap2/board-omap3beagle.c
> +++ b/arch/arm/mach-omap2/board-omap3beagle.c
> @@ -362,11 +362,16 @@ static struct regulator_init_data beagle_vsim = {
>        .consumer_supplies      = beagle_vsim_supply,
>  };
>
> +static struct twl4030_madc_platform_data beagle_madc = {
> +       .irq_line       = 1,
> +};
> +
>  static struct twl4030_platform_data beagle_twldata = {
>        /* platform_data for children goes here */
>        .gpio           = &beagle_gpio_data,
>        .vmmc1          = &beagle_vmmc1,
>        .vsim           = &beagle_vsim,
> +       .madc           = &beagle_madc,
>  };

Basically all boards with twl4030 might want to have this, maybe add
this to twl-common.c instead to avoid code duplication?



-- 
Gražvydas
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/3] twl4030-madc: copy the device pointer
  2011-08-11  3:27 ` [PATCH 1/3] twl4030-madc: copy the device pointer Kyle Manna
@ 2011-08-11  9:50   ` Grazvydas Ignotas
  0 siblings, 0 replies; 22+ messages in thread
From: Grazvydas Ignotas @ 2011-08-11  9:50 UTC (permalink / raw)
  To: Kyle Manna; +Cc: linux-omap

You need to send this one to mfd maintainer, separate from this series
perhaps (see MAINTAINERS or just use ./scripts/get_maintainer.pl).

On Thu, Aug 11, 2011 at 6:27 AM, Kyle Manna <kyle@kylemanna.com> wrote:
> Worst case this fixes the following error:
> [   72.086212] (NULL device *): conversion timeout!
>
> Best case it prevents a crash
>
> Signed-off-by: Kyle Manna <kyle@kylemanna.com>
> ---
>  drivers/mfd/twl4030-madc.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
> index b5d598c..8ef7801 100644
> --- a/drivers/mfd/twl4030-madc.c
> +++ b/drivers/mfd/twl4030-madc.c
> @@ -706,6 +706,9 @@ static int __devinit twl4030_madc_probe(struct platform_device *pdev)
>        if (!madc)
>                return -ENOMEM;
>
> +       /* Copy the pointer to device struct */
> +       madc->dev = &pdev->dev;
> +

This comment is not useful, it's already clear you are copying a pointer.

>        /*
>         * Phoenix provides 2 interrupt lines. The first one is connected to
>         * the OMAP. The other one can be connected to the other processor such
> @@ -733,7 +736,7 @@ static int __devinit twl4030_madc_probe(struct platform_device *pdev)
>        ret = twl_i2c_write_u8(TWL4030_MODULE_MAIN_CHARGE,
>                               regval, TWL4030_BCI_BCICTL1);
>        if (ret) {
> -               dev_err(&pdev->dev, "unable to write reg BCI Ctl1 0x%X\n",
> +               dev_err(&pdev->dev, "unable to write reg BCI CTL1 0x%X\n",
>                        TWL4030_BCI_BCICTL1);

Stray change (no mention in commit message), should not be part of this patch.

>                goto err_i2c;
>        }
> --
> 1.7.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

-- 
Gražvydas
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/3] twl4030-madc: turn on the MADC clock
  2011-08-11  3:27 ` [PATCH 2/3] twl4030-madc: turn on the MADC clock Kyle Manna
@ 2011-08-11  9:55   ` Grazvydas Ignotas
  0 siblings, 0 replies; 22+ messages in thread
From: Grazvydas Ignotas @ 2011-08-11  9:55 UTC (permalink / raw)
  To: Kyle Manna; +Cc: linux-omap

This one needs to go to mfd maintainer too.

On Thu, Aug 11, 2011 at 6:27 AM, Kyle Manna <kyle@kylemanna.com> wrote:
> Without turning the MADC clock on, no MADC conversions occur.
>
> $ cat /sys/class/hwmon/hwmon0/device/in8_input
> [   53.428436] twl4030_madc twl4030_madc: conversion timeout!
> cat: read error: Resource temporarily unavailable
>
> Signed-off-by: Kyle Manna <kyle@kylemanna.com>
> ---
>  drivers/mfd/twl4030-madc.c       |   22 ++++++++++++++++++++++
>  include/linux/i2c/twl4030-madc.h |    4 ++++
>  2 files changed, 26 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
> index 8ef7801..75040b4 100644
> --- a/drivers/mfd/twl4030-madc.c
> +++ b/drivers/mfd/twl4030-madc.c
> @@ -740,6 +740,28 @@ static int __devinit twl4030_madc_probe(struct platform_device *pdev)
>                        TWL4030_BCI_BCICTL1);
>                goto err_i2c;
>        }
> +
> +       /* Check that MADC clock is on */
> +       ret = twl_i2c_read_u8(TWL4030_MODULE_INTBR, &regval, TWL4030_REG_GPBR1);
> +       if (ret) {
> +               dev_err(&pdev->dev, "unable to read reg GPBR1 0x%X\n",
> +                               TWL4030_REG_GPBR1);
> +       }
> +
> +       /* If MADC clk is not on, turn it on */
> +       if (!(regval & TWL4030_GPBR1_MADC_HFCLK_EN)) {

You should check if above read failed before using regval - you might
end up writing trash to GPBR1..

> +               dev_info(&pdev->dev, "clk disabled, enabling\n");
> +               regval |= TWL4030_GPBR1_MADC_HFCLK_EN;
> +               ret = twl_i2c_write_u8(TWL4030_MODULE_INTBR, regval,
> +                                      TWL4030_REG_GPBR1);
> +               if (ret) {
> +                       dev_err(&pdev->dev, "unable to write reg GPBR1 0x%X\n",
> +                                       TWL4030_REG_GPBR1);
> +                       goto err_i2c;
> +               }
> +       }
> +
> +

Single newline is enough.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support
  2011-08-11  9:44   ` Grazvydas Ignotas
@ 2011-08-12  3:33     ` Kyle Manna
  2011-08-12  3:33       ` [PATCH v2 1/4] mfd: twl4030-madc: copy the device pointer Kyle Manna
                         ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Kyle Manna @ 2011-08-12  3:33 UTC (permalink / raw)
  To: Tony Lindgren, Russell King, Samuel Ortiz
  Cc: Keerthy, linux-omap, linux-arm-kernel, linux-kernel, Kyle Manna

These patches add basic functionality to the twl4030-madc driver to make
it work on the BeagleBoard xM.

Version 2 adds fixes per Grazvydas Ignotas and the check for NULL pointer patch.

Kyle Manna (4):
  mfd: twl4030-madc: copy the device pointer
  mfd: twl4030-madc: turn on the MADC clock
  mfd: twl4030-madc: check for NULL pointer
  arm: BeagleBoard: add support for the twl4030-madc

 arch/arm/mach-omap2/board-omap3beagle.c |    9 ++++++++-
 drivers/mfd/twl4030-madc.c              |   27 ++++++++++++++++++++++++++-
 include/linux/i2c/twl4030-madc.h        |    4 ++++
 3 files changed, 38 insertions(+), 2 deletions(-)

-- 
1.7.4.1


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

* [PATCH v2 1/4] mfd: twl4030-madc: copy the device pointer
  2011-08-12  3:33     ` [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support Kyle Manna
@ 2011-08-12  3:33       ` Kyle Manna
  2011-08-12  3:33       ` [PATCH v2 2/4] mfd: twl4030-madc: turn on the MADC clock Kyle Manna
                         ` (3 subsequent siblings)
  4 siblings, 0 replies; 22+ messages in thread
From: Kyle Manna @ 2011-08-12  3:33 UTC (permalink / raw)
  To: Tony Lindgren, Russell King, Samuel Ortiz
  Cc: Keerthy, linux-omap, linux-arm-kernel, linux-kernel, Kyle Manna

Worst case this fixes the following error:
[   72.086212] (NULL device *): conversion timeout!

Best case it prevents a crash

Signed-off-by: Kyle Manna <kyle@kylemanna.com>
---
 drivers/mfd/twl4030-madc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
index b5d598c..cb44b53 100644
--- a/drivers/mfd/twl4030-madc.c
+++ b/drivers/mfd/twl4030-madc.c
@@ -706,6 +706,8 @@ static int __devinit twl4030_madc_probe(struct platform_device *pdev)
 	if (!madc)
 		return -ENOMEM;
 
+	madc->dev = &pdev->dev;
+
 	/*
 	 * Phoenix provides 2 interrupt lines. The first one is connected to
 	 * the OMAP. The other one can be connected to the other processor such
-- 
1.7.4.1


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

* [PATCH v2 2/4] mfd: twl4030-madc: turn on the MADC clock
  2011-08-12  3:33     ` [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support Kyle Manna
  2011-08-12  3:33       ` [PATCH v2 1/4] mfd: twl4030-madc: copy the device pointer Kyle Manna
@ 2011-08-12  3:33       ` Kyle Manna
  2011-08-12  3:33       ` [PATCH v2 3/4] mfd: twl4030-madc: check for NULL pointer Kyle Manna
                         ` (2 subsequent siblings)
  4 siblings, 0 replies; 22+ messages in thread
From: Kyle Manna @ 2011-08-12  3:33 UTC (permalink / raw)
  To: Tony Lindgren, Russell King, Samuel Ortiz
  Cc: Keerthy, linux-omap, linux-arm-kernel, linux-kernel, Kyle Manna

Without turning the MADC clock on, no MADC conversions occur.

$ cat /sys/class/hwmon/hwmon0/device/in8_input
[   53.428436] twl4030_madc twl4030_madc: conversion timeout!
cat: read error: Resource temporarily unavailable

Signed-off-by: Kyle Manna <kyle@kylemanna.com>
---
 drivers/mfd/twl4030-madc.c       |   22 ++++++++++++++++++++++
 include/linux/i2c/twl4030-madc.h |    4 ++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
index cb44b53..99dd611 100644
--- a/drivers/mfd/twl4030-madc.c
+++ b/drivers/mfd/twl4030-madc.c
@@ -739,6 +739,28 @@ static int __devinit twl4030_madc_probe(struct platform_device *pdev)
 			TWL4030_BCI_BCICTL1);
 		goto err_i2c;
 	}
+
+	/* Check that MADC clock is on */
+	ret = twl_i2c_read_u8(TWL4030_MODULE_INTBR, &regval, TWL4030_REG_GPBR1);
+	if (ret) {
+		dev_err(&pdev->dev, "unable to read reg GPBR1 0x%X\n",
+				TWL4030_REG_GPBR1);
+		goto err_i2c;
+	}
+
+	/* If MADC clk is not on, turn it on */
+	if (!(regval & TWL4030_GPBR1_MADC_HFCLK_EN)) {
+		dev_info(&pdev->dev, "clk disabled, enabling\n");
+		regval |= TWL4030_GPBR1_MADC_HFCLK_EN;
+		ret = twl_i2c_write_u8(TWL4030_MODULE_INTBR, regval,
+				       TWL4030_REG_GPBR1);
+		if (ret) {
+			dev_err(&pdev->dev, "unable to write reg GPBR1 0x%X\n",
+					TWL4030_REG_GPBR1);
+			goto err_i2c;
+		}
+	}
+
 	platform_set_drvdata(pdev, madc);
 	mutex_init(&madc->lock);
 	ret = request_threaded_irq(platform_get_irq(pdev, 0), NULL,
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
index 6427d29..530e11b 100644
--- a/include/linux/i2c/twl4030-madc.h
+++ b/include/linux/i2c/twl4030-madc.h
@@ -129,6 +129,10 @@ enum sample_type {
 #define REG_BCICTL2             0x024
 #define TWL4030_BCI_ITHSENS	0x007
 
+/* Register and bits for GPBR1 register */
+#define TWL4030_REG_GPBR1		0x0c
+#define TWL4030_GPBR1_MADC_HFCLK_EN	(1 << 7)
+
 struct twl4030_madc_user_parms {
 	int channel;
 	int average;
-- 
1.7.4.1


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

* [PATCH v2 3/4] mfd: twl4030-madc: check for NULL pointer
  2011-08-12  3:33     ` [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support Kyle Manna
  2011-08-12  3:33       ` [PATCH v2 1/4] mfd: twl4030-madc: copy the device pointer Kyle Manna
  2011-08-12  3:33       ` [PATCH v2 2/4] mfd: twl4030-madc: turn on the MADC clock Kyle Manna
@ 2011-08-12  3:33       ` Kyle Manna
  2011-08-12  3:33       ` [PATCH v2 4/4] arm: BeagleBoard: add support for the twl4030-madc Kyle Manna
  2011-08-22 13:55         ` Samuel Ortiz
  4 siblings, 0 replies; 22+ messages in thread
From: Kyle Manna @ 2011-08-12  3:33 UTC (permalink / raw)
  To: Tony Lindgren, Russell King, Samuel Ortiz
  Cc: Keerthy, linux-omap, linux-arm-kernel, linux-kernel, Kyle Manna

If the twl4030-madc device wasn't registered, and another device, such
as twl4030-madc-hwmon, calls twl4030_madc_conversion() a NULL pointer is
dereferenced.

Signed-off-by: Kyle Manna <kyle@kylemanna.com>
---
 drivers/mfd/twl4030-madc.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
index 99dd611..834f824 100644
--- a/drivers/mfd/twl4030-madc.c
+++ b/drivers/mfd/twl4030-madc.c
@@ -510,8 +510,9 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req)
 	u8 ch_msb, ch_lsb;
 	int ret;
 
-	if (!req)
+	if (!req || !twl4030_madc)
 		return -EINVAL;
+
 	mutex_lock(&twl4030_madc->lock);
 	if (req->method < TWL4030_MADC_RT || req->method > TWL4030_MADC_SW2) {
 		ret = -EINVAL;
-- 
1.7.4.1


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

* [PATCH v2 4/4] arm: BeagleBoard: add support for the twl4030-madc
  2011-08-12  3:33     ` [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support Kyle Manna
                         ` (2 preceding siblings ...)
  2011-08-12  3:33       ` [PATCH v2 3/4] mfd: twl4030-madc: check for NULL pointer Kyle Manna
@ 2011-08-12  3:33       ` Kyle Manna
  2011-09-28 18:31           ` Tony Lindgren
  2011-08-22 13:55         ` Samuel Ortiz
  4 siblings, 1 reply; 22+ messages in thread
From: Kyle Manna @ 2011-08-12  3:33 UTC (permalink / raw)
  To: Tony Lindgren, Russell King, Samuel Ortiz
  Cc: Keerthy, linux-omap, linux-arm-kernel, linux-kernel, Kyle Manna

Signed-off-by: Kyle Manna <kyle@kylemanna.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 3ae16b4..9cc9fa9 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -378,7 +378,8 @@ static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
 static int __init omap3_beagle_i2c_init(void)
 {
 	omap3_pmic_get_config(&beagle_twldata,
-			TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_AUDIO,
+			TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC |
+			TWL_COMMON_PDATA_AUDIO,
 			TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
 
 	beagle_twldata.vpll2->constraints.name = "VDVI";
@@ -456,9 +457,15 @@ static void __init omap3_beagle_init_irq(void)
 	omap3_init_irq();
 }
 
+static struct platform_device madc_hwmon = {
+	.name	= "twl4030_madc_hwmon",
+	.id	= -1,
+};
+
 static struct platform_device *omap3_beagle_devices[] __initdata = {
 	&leds_gpio,
 	&keys_gpio,
+	&madc_hwmon,
 };
 
 static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
-- 
1.7.4.1


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

* Re: [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support
  2011-08-12  3:33     ` [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support Kyle Manna
  2011-08-12  3:33       ` [PATCH v2 1/4] mfd: twl4030-madc: copy the device pointer Kyle Manna
@ 2011-08-22 13:55         ` Samuel Ortiz
  2011-08-12  3:33       ` [PATCH v2 3/4] mfd: twl4030-madc: check for NULL pointer Kyle Manna
                           ` (2 subsequent siblings)
  4 siblings, 0 replies; 22+ messages in thread
From: Samuel Ortiz @ 2011-08-22 13:55 UTC (permalink / raw)
  To: Kyle Manna
  Cc: Tony Lindgren, Russell King, Keerthy, linux-omap,
	linux-arm-kernel, linux-kernel

Hi Kyle,

On Thu, Aug 11, 2011 at 10:33:11PM -0500, Kyle Manna wrote:
> These patches add basic functionality to the twl4030-madc driver to make
> it work on the BeagleBoard xM.
> 
> Version 2 adds fixes per Grazvydas Ignotas and the check for NULL pointer patch.
> 
> Kyle Manna (4):
>   mfd: twl4030-madc: copy the device pointer
>   mfd: twl4030-madc: turn on the MADC clock
>   mfd: twl4030-madc: check for NULL pointer
>   arm: BeagleBoard: add support for the twl4030-madc
Tony, are you ok with the BeagleBoard changes ?
The MFD ones look fine to me, I'd like to apply them.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

* Re: [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support
@ 2011-08-22 13:55         ` Samuel Ortiz
  0 siblings, 0 replies; 22+ messages in thread
From: Samuel Ortiz @ 2011-08-22 13:55 UTC (permalink / raw)
  To: Kyle Manna
  Cc: Russell King, Tony Lindgren, Keerthy, linux-kernel, linux-omap,
	linux-arm-kernel

Hi Kyle,

On Thu, Aug 11, 2011 at 10:33:11PM -0500, Kyle Manna wrote:
> These patches add basic functionality to the twl4030-madc driver to make
> it work on the BeagleBoard xM.
> 
> Version 2 adds fixes per Grazvydas Ignotas and the check for NULL pointer patch.
> 
> Kyle Manna (4):
>   mfd: twl4030-madc: copy the device pointer
>   mfd: twl4030-madc: turn on the MADC clock
>   mfd: twl4030-madc: check for NULL pointer
>   arm: BeagleBoard: add support for the twl4030-madc
Tony, are you ok with the BeagleBoard changes ?
The MFD ones look fine to me, I'd like to apply them.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

* [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support
@ 2011-08-22 13:55         ` Samuel Ortiz
  0 siblings, 0 replies; 22+ messages in thread
From: Samuel Ortiz @ 2011-08-22 13:55 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kyle,

On Thu, Aug 11, 2011 at 10:33:11PM -0500, Kyle Manna wrote:
> These patches add basic functionality to the twl4030-madc driver to make
> it work on the BeagleBoard xM.
> 
> Version 2 adds fixes per Grazvydas Ignotas and the check for NULL pointer patch.
> 
> Kyle Manna (4):
>   mfd: twl4030-madc: copy the device pointer
>   mfd: twl4030-madc: turn on the MADC clock
>   mfd: twl4030-madc: check for NULL pointer
>   arm: BeagleBoard: add support for the twl4030-madc
Tony, are you ok with the BeagleBoard changes ?
The MFD ones look fine to me, I'd like to apply them.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

* Re: [PATCH v2 4/4] arm: BeagleBoard: add support for the twl4030-madc
  2011-08-12  3:33       ` [PATCH v2 4/4] arm: BeagleBoard: add support for the twl4030-madc Kyle Manna
@ 2011-09-28 18:31           ` Tony Lindgren
  0 siblings, 0 replies; 22+ messages in thread
From: Tony Lindgren @ 2011-09-28 18:31 UTC (permalink / raw)
  To: Kyle Manna
  Cc: Russell King, Samuel Ortiz, Keerthy, linux-omap,
	linux-arm-kernel, linux-kernel

* Kyle Manna <kyle@kylemanna.com> [110811 20:01]:
> Signed-off-by: Kyle Manna <kyle@kylemanna.com>

Missing description, but with that corrected:

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
>  arch/arm/mach-omap2/board-omap3beagle.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
> index 3ae16b4..9cc9fa9 100644
> --- a/arch/arm/mach-omap2/board-omap3beagle.c
> +++ b/arch/arm/mach-omap2/board-omap3beagle.c
> @@ -378,7 +378,8 @@ static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
>  static int __init omap3_beagle_i2c_init(void)
>  {
>  	omap3_pmic_get_config(&beagle_twldata,
> -			TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_AUDIO,
> +			TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC |
> +			TWL_COMMON_PDATA_AUDIO,
>  			TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
>  
>  	beagle_twldata.vpll2->constraints.name = "VDVI";
> @@ -456,9 +457,15 @@ static void __init omap3_beagle_init_irq(void)
>  	omap3_init_irq();
>  }
>  
> +static struct platform_device madc_hwmon = {
> +	.name	= "twl4030_madc_hwmon",
> +	.id	= -1,
> +};
> +
>  static struct platform_device *omap3_beagle_devices[] __initdata = {
>  	&leds_gpio,
>  	&keys_gpio,
> +	&madc_hwmon,
>  };
>  
>  static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
> -- 
> 1.7.4.1
> 

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

* [PATCH v2 4/4] arm: BeagleBoard: add support for the twl4030-madc
@ 2011-09-28 18:31           ` Tony Lindgren
  0 siblings, 0 replies; 22+ messages in thread
From: Tony Lindgren @ 2011-09-28 18:31 UTC (permalink / raw)
  To: linux-arm-kernel

* Kyle Manna <kyle@kylemanna.com> [110811 20:01]:
> Signed-off-by: Kyle Manna <kyle@kylemanna.com>

Missing description, but with that corrected:

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
>  arch/arm/mach-omap2/board-omap3beagle.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
> index 3ae16b4..9cc9fa9 100644
> --- a/arch/arm/mach-omap2/board-omap3beagle.c
> +++ b/arch/arm/mach-omap2/board-omap3beagle.c
> @@ -378,7 +378,8 @@ static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
>  static int __init omap3_beagle_i2c_init(void)
>  {
>  	omap3_pmic_get_config(&beagle_twldata,
> -			TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_AUDIO,
> +			TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC |
> +			TWL_COMMON_PDATA_AUDIO,
>  			TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
>  
>  	beagle_twldata.vpll2->constraints.name = "VDVI";
> @@ -456,9 +457,15 @@ static void __init omap3_beagle_init_irq(void)
>  	omap3_init_irq();
>  }
>  
> +static struct platform_device madc_hwmon = {
> +	.name	= "twl4030_madc_hwmon",
> +	.id	= -1,
> +};
> +
>  static struct platform_device *omap3_beagle_devices[] __initdata = {
>  	&leds_gpio,
>  	&keys_gpio,
> +	&madc_hwmon,
>  };
>  
>  static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
> -- 
> 1.7.4.1
> 

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

* Re: [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support
  2011-08-22 13:55         ` Samuel Ortiz
@ 2011-09-28 18:32           ` Tony Lindgren
  -1 siblings, 0 replies; 22+ messages in thread
From: Tony Lindgren @ 2011-09-28 18:32 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: Kyle Manna, Russell King, Keerthy, linux-omap, linux-arm-kernel,
	linux-kernel

* Samuel Ortiz <sameo@linux.intel.com> [110822 06:20]:
> Hi Kyle,
> 
> On Thu, Aug 11, 2011 at 10:33:11PM -0500, Kyle Manna wrote:
> > These patches add basic functionality to the twl4030-madc driver to make
> > it work on the BeagleBoard xM.
> > 
> > Version 2 adds fixes per Grazvydas Ignotas and the check for NULL pointer patch.
> > 
> > Kyle Manna (4):
> >   mfd: twl4030-madc: copy the device pointer
> >   mfd: twl4030-madc: turn on the MADC clock
> >   mfd: twl4030-madc: check for NULL pointer
> >   arm: BeagleBoard: add support for the twl4030-madc
> Tony, are you ok with the BeagleBoard changes ?
> The MFD ones look fine to me, I'd like to apply them.

Yes sorry for the delay in replying. I acked it, maybe
you can just copy the subject to have a proper description
for the patch.

Tony

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

* [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support
@ 2011-09-28 18:32           ` Tony Lindgren
  0 siblings, 0 replies; 22+ messages in thread
From: Tony Lindgren @ 2011-09-28 18:32 UTC (permalink / raw)
  To: linux-arm-kernel

* Samuel Ortiz <sameo@linux.intel.com> [110822 06:20]:
> Hi Kyle,
> 
> On Thu, Aug 11, 2011 at 10:33:11PM -0500, Kyle Manna wrote:
> > These patches add basic functionality to the twl4030-madc driver to make
> > it work on the BeagleBoard xM.
> > 
> > Version 2 adds fixes per Grazvydas Ignotas and the check for NULL pointer patch.
> > 
> > Kyle Manna (4):
> >   mfd: twl4030-madc: copy the device pointer
> >   mfd: twl4030-madc: turn on the MADC clock
> >   mfd: twl4030-madc: check for NULL pointer
> >   arm: BeagleBoard: add support for the twl4030-madc
> Tony, are you ok with the BeagleBoard changes ?
> The MFD ones look fine to me, I'd like to apply them.

Yes sorry for the delay in replying. I acked it, maybe
you can just copy the subject to have a proper description
for the patch.

Tony

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

* Re: [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support
  2011-09-28 18:32           ` Tony Lindgren
  (?)
@ 2011-10-04 10:28             ` Samuel Ortiz
  -1 siblings, 0 replies; 22+ messages in thread
From: Samuel Ortiz @ 2011-10-04 10:28 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Kyle Manna, Russell King, Keerthy, linux-omap, linux-arm-kernel,
	linux-kernel

Hi Tony,

On Wed, Sep 28, 2011 at 11:32:31AM -0700, Tony Lindgren wrote:
> * Samuel Ortiz <sameo@linux.intel.com> [110822 06:20]:
> > Hi Kyle,
> > 
> > On Thu, Aug 11, 2011 at 10:33:11PM -0500, Kyle Manna wrote:
> > > These patches add basic functionality to the twl4030-madc driver to make
> > > it work on the BeagleBoard xM.
> > > 
> > > Version 2 adds fixes per Grazvydas Ignotas and the check for NULL pointer patch.
> > > 
> > > Kyle Manna (4):
> > >   mfd: twl4030-madc: copy the device pointer
> > >   mfd: twl4030-madc: turn on the MADC clock
> > >   mfd: twl4030-madc: check for NULL pointer
> > >   arm: BeagleBoard: add support for the twl4030-madc
> > Tony, are you ok with the BeagleBoard changes ?
> > The MFD ones look fine to me, I'd like to apply them.
> 
> Yes sorry for the delay in replying. I acked it, maybe
> you can just copy the subject to have a proper description
> for the patch.
I actually pushed the 3 MFD patches already.
I think you can safely take the beagle one through your tree.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

* Re: [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support
@ 2011-10-04 10:28             ` Samuel Ortiz
  0 siblings, 0 replies; 22+ messages in thread
From: Samuel Ortiz @ 2011-10-04 10:28 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Russell King, Keerthy, linux-kernel, Kyle Manna, linux-omap,
	linux-arm-kernel

Hi Tony,

On Wed, Sep 28, 2011 at 11:32:31AM -0700, Tony Lindgren wrote:
> * Samuel Ortiz <sameo@linux.intel.com> [110822 06:20]:
> > Hi Kyle,
> > 
> > On Thu, Aug 11, 2011 at 10:33:11PM -0500, Kyle Manna wrote:
> > > These patches add basic functionality to the twl4030-madc driver to make
> > > it work on the BeagleBoard xM.
> > > 
> > > Version 2 adds fixes per Grazvydas Ignotas and the check for NULL pointer patch.
> > > 
> > > Kyle Manna (4):
> > >   mfd: twl4030-madc: copy the device pointer
> > >   mfd: twl4030-madc: turn on the MADC clock
> > >   mfd: twl4030-madc: check for NULL pointer
> > >   arm: BeagleBoard: add support for the twl4030-madc
> > Tony, are you ok with the BeagleBoard changes ?
> > The MFD ones look fine to me, I'd like to apply them.
> 
> Yes sorry for the delay in replying. I acked it, maybe
> you can just copy the subject to have a proper description
> for the patch.
I actually pushed the 3 MFD patches already.
I think you can safely take the beagle one through your tree.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

* [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support
@ 2011-10-04 10:28             ` Samuel Ortiz
  0 siblings, 0 replies; 22+ messages in thread
From: Samuel Ortiz @ 2011-10-04 10:28 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Tony,

On Wed, Sep 28, 2011 at 11:32:31AM -0700, Tony Lindgren wrote:
> * Samuel Ortiz <sameo@linux.intel.com> [110822 06:20]:
> > Hi Kyle,
> > 
> > On Thu, Aug 11, 2011 at 10:33:11PM -0500, Kyle Manna wrote:
> > > These patches add basic functionality to the twl4030-madc driver to make
> > > it work on the BeagleBoard xM.
> > > 
> > > Version 2 adds fixes per Grazvydas Ignotas and the check for NULL pointer patch.
> > > 
> > > Kyle Manna (4):
> > >   mfd: twl4030-madc: copy the device pointer
> > >   mfd: twl4030-madc: turn on the MADC clock
> > >   mfd: twl4030-madc: check for NULL pointer
> > >   arm: BeagleBoard: add support for the twl4030-madc
> > Tony, are you ok with the BeagleBoard changes ?
> > The MFD ones look fine to me, I'd like to apply them.
> 
> Yes sorry for the delay in replying. I acked it, maybe
> you can just copy the subject to have a proper description
> for the patch.
I actually pushed the 3 MFD patches already.
I think you can safely take the beagle one through your tree.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2011-10-04 10:28 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-11  3:27 [PATCH 0/3] Fixes to twl4030-madc and add BeagleBoard support Kyle Manna
2011-08-11  3:27 ` [PATCH 1/3] twl4030-madc: copy the device pointer Kyle Manna
2011-08-11  9:50   ` Grazvydas Ignotas
2011-08-11  3:27 ` [PATCH 2/3] twl4030-madc: turn on the MADC clock Kyle Manna
2011-08-11  9:55   ` Grazvydas Ignotas
2011-08-11  3:27 ` [PATCH 3/3] BeagleBoard: add support for the twl4030-madc Kyle Manna
2011-08-11  9:44   ` Grazvydas Ignotas
2011-08-12  3:33     ` [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support Kyle Manna
2011-08-12  3:33       ` [PATCH v2 1/4] mfd: twl4030-madc: copy the device pointer Kyle Manna
2011-08-12  3:33       ` [PATCH v2 2/4] mfd: twl4030-madc: turn on the MADC clock Kyle Manna
2011-08-12  3:33       ` [PATCH v2 3/4] mfd: twl4030-madc: check for NULL pointer Kyle Manna
2011-08-12  3:33       ` [PATCH v2 4/4] arm: BeagleBoard: add support for the twl4030-madc Kyle Manna
2011-09-28 18:31         ` Tony Lindgren
2011-09-28 18:31           ` Tony Lindgren
2011-08-22 13:55       ` [PATCH v2 0/4] Fixes to twl4030-madc and add BeagleBoard support Samuel Ortiz
2011-08-22 13:55         ` Samuel Ortiz
2011-08-22 13:55         ` Samuel Ortiz
2011-09-28 18:32         ` Tony Lindgren
2011-09-28 18:32           ` Tony Lindgren
2011-10-04 10:28           ` Samuel Ortiz
2011-10-04 10:28             ` Samuel Ortiz
2011-10-04 10:28             ` Samuel Ortiz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.