diff options
Diffstat (limited to 'drivers/mfd/tps65911-comparator.c')
| -rw-r--r-- | drivers/mfd/tps65911-comparator.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/drivers/mfd/tps65911-comparator.c b/drivers/mfd/tps65911-comparator.c index c0816ebd9d7e..7098712ea008 100644 --- a/drivers/mfd/tps65911-comparator.c +++ b/drivers/mfd/tps65911-comparator.c @@ -1,15 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * tps65910.c -- TI TPS6591x * * Copyright 2010 Texas Instruments Inc. * * Author: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk> - * - * 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 the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * */ #include <linux/kernel.h> @@ -22,9 +17,8 @@ #include <linux/gpio.h> #include <linux/mfd/tps65910.h> -#define COMP 0 -#define COMP1 1 -#define COMP2 2 +#define COMP1 0 +#define COMP2 1 /* Comparator 1 voltage selection table in millivolts */ static const u16 COMP_VSEL_TABLE[] = { @@ -63,9 +57,6 @@ static int comp_threshold_set(struct tps65910 *tps65910, int id, int voltage) int ret; u8 index = 0, val; - if (id == COMP) - return 0; - while (curr_voltage < tps_comp.uV_max) { curr_voltage = tps_comp.vsel_table[index]; if (curr_voltage >= voltage) @@ -78,7 +69,7 @@ static int comp_threshold_set(struct tps65910 *tps65910, int id, int voltage) return -EINVAL; val = index << 1; - ret = tps65910->write(tps65910, tps_comp.reg, 1, &val); + ret = regmap_write(tps65910->regmap, tps_comp.reg, val); return ret; } @@ -86,13 +77,10 @@ static int comp_threshold_set(struct tps65910 *tps65910, int id, int voltage) static int comp_threshold_get(struct tps65910 *tps65910, int id) { struct comparator tps_comp = tps_comparators[id]; + unsigned int val; int ret; - u8 val; - if (id == COMP) - return 0; - - ret = tps65910->read(tps65910, tps_comp.reg, 1, &val); + ret = regmap_read(tps65910->regmap, tps_comp.reg, &val); if (ret < 0) return ret; @@ -152,21 +140,18 @@ static int tps65911_comparator_probe(struct platform_device *pdev) return ret; } -static int tps65911_comparator_remove(struct platform_device *pdev) +static void tps65911_comparator_remove(struct platform_device *pdev) { struct tps65910 *tps65910; tps65910 = dev_get_drvdata(pdev->dev.parent); device_remove_file(&pdev->dev, &dev_attr_comp2_threshold); device_remove_file(&pdev->dev, &dev_attr_comp1_threshold); - - return 0; } static struct platform_driver tps65911_comparator_driver = { .driver = { .name = "tps65911-comparator", - .owner = THIS_MODULE, }, .probe = tps65911_comparator_probe, .remove = tps65911_comparator_remove, |
