Re: [PATCH 2/3] twl4030-madc: turn on the MADC clock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This one needs to go to mfd maintainer too.

On Thu, Aug 11, 2011 at 6:27 AM, Kyle Manna <kyle@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux