[PATCH 4/4] This patch adds platform_data and callback of suspend/resume
andrzej zaborowski
balrogg at gmail.com
Fri Jan 9 08:38:08 CET 2009
2009/1/8 Matt Hsu <matt_hsu at openmoko.org>:
>
> Signed-off-by: Matt Hsu <matt_hsu at openmoko.org>
> ---
> drivers/i2c/chips/lp5521.c | 33 +++++++++++++++++++++++++++++++++
> include/linux/lp5521.h | 10 ++++++++++
> 2 files changed, 43 insertions(+), 0 deletions(-)
> create mode 100644 include/linux/lp5521.h
>
> diff --git a/drivers/i2c/chips/lp5521.c b/drivers/i2c/chips/lp5521.c
> index 83f6626..cc407b7 100644
> --- a/drivers/i2c/chips/lp5521.c
> +++ b/drivers/i2c/chips/lp5521.c
> @@ -4,6 +4,7 @@
> * Copyright (C) 2007 Nokia Corporation
> *
> * Written by Mathias Nyman <mathias.nyman at nokia.com>
> + * Matt Hsu <matt_hsu at openmoko.org>
> *
> * This program is free software; you can redistribute it and/or modify
> * it under the terms of the GNU General Public License as published by
> @@ -25,6 +26,8 @@
> #include <linux/i2c.h>
> #include <linux/mutex.h>
>
> +#include <linux/lp5521.h>
> +
> #define LP5521_DRIVER_NAME "lp5521"
>
> #ifdef LED_CONNECTED_WRONG
> @@ -502,10 +505,31 @@ static int lp5521_set_mode(struct lp5521_chip *chip, char *mode)
> /*--------------------------------------------------------------*/
> static struct i2c_driver lp5521_driver;
>
> +#ifdef CONFIG_PM
> +static int lp5521_suspend(struct device *dev, pm_message_t state)
> +{
> + /* FIXME: Not implemented
> + * Here we could upload firmware to perform
> + * any scenarios we want and save registers.
> + */
> + return 0;
> +}
> +
> +static int lp5521_resume(struct device *dev)
> +{
> + /* FIXME: Not implemented */
> + return 0;
> +}
> +#else
> +#define lp5521_suspend NULL
> +#define lp5521_resume NULL
> +#endif
> +
> static int lp5521_probe(struct i2c_client *client)
> {
> struct lp5521_chip *chip;
> int ret = 0;
> + struct lp5521_platform_data *pdata = client->dev.platform_data;
>
> chip = kzalloc(sizeof(*chip), GFP_KERNEL);
> if (!chip)
> @@ -517,6 +541,9 @@ static int lp5521_probe(struct i2c_client *client)
>
> mutex_init(&chip->lock);
>
> + /* enter start-up mode */
> + (pdata->ext_enable)(1);
Might be good to make it conditional so as not to break n810 support.
Is the lp5521_id_table used anywhere?
Cheers
More information about the openmoko-kernel
mailing list