~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to drivers/regulator/tps6586x-regulator.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 */
15
15
 
16
16
#include <linux/kernel.h>
 
17
#include <linux/module.h>
17
18
#include <linux/init.h>
18
19
#include <linux/err.h>
19
20
#include <linux/slab.h>
332
333
                                 1 << ri->enable_bit[1]);
333
334
}
334
335
 
 
336
static int tps6586x_regulator_set_slew_rate(struct platform_device *pdev)
 
337
{
 
338
        struct device *parent = pdev->dev.parent;
 
339
        struct regulator_init_data *p = pdev->dev.platform_data;
 
340
        struct tps6586x_settings *setting = p->driver_data;
 
341
        uint8_t reg;
 
342
 
 
343
        if (setting == NULL)
 
344
                return 0;
 
345
 
 
346
        if (!(setting->slew_rate & TPS6586X_SLEW_RATE_SET))
 
347
                return 0;
 
348
 
 
349
        /* only SM0 and SM1 can have the slew rate settings */
 
350
        switch (pdev->id) {
 
351
        case TPS6586X_ID_SM_0:
 
352
                reg = TPS6586X_SM0SL;
 
353
                break;
 
354
        case TPS6586X_ID_SM_1:
 
355
                reg = TPS6586X_SM1SL;
 
356
                break;
 
357
        default:
 
358
                dev_warn(&pdev->dev, "Only SM0/SM1 can set slew rate\n");
 
359
                return -EINVAL;
 
360
        }
 
361
 
 
362
        return tps6586x_write(parent, reg,
 
363
                        setting->slew_rate & TPS6586X_SLEW_RATE_MASK);
 
364
}
 
365
 
335
366
static inline struct tps6586x_regulator *find_regulator_info(int id)
336
367
{
337
368
        struct tps6586x_regulator *ri;
374
405
 
375
406
        platform_set_drvdata(pdev, rdev);
376
407
 
377
 
        return 0;
 
408
        return tps6586x_regulator_set_slew_rate(pdev);
378
409
}
379
410
 
380
411
static int __devexit tps6586x_regulator_remove(struct platform_device *pdev)