Lines Matching +full:lochnagar2 +full:- +full:micvdd

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (c) 2016-2019 Cirrus Logic, Inc. and
13 #include <linux/hwmon-sysfs.h>
38 "MICVDD",
57 * float_to_long - Convert ieee754 reading from hardware to an integer
66 * will convert that into an integer in a smaller unit such as micro-amps
67 * or milli-celsius. The hardware does not return NaN, so consideration of
73 int exp = ((data & 0x7F800000) >> 23) - 127 - 23; in float_to_long()
79 if (fls64(man) + exp > (int)sizeof(long) * 8 - 1) in float_to_long()
82 result = (man + (1ull << (-exp - 1))) >> -exp; in float_to_long()
86 return negative ? -result : result; in float_to_long()
177 struct regmap *regmap = priv->regmap; in read_sensor()
181 mutex_lock(&priv->sensor_lock); in read_sensor()
198 mutex_unlock(&priv->sensor_lock); in read_sensor()
206 int nsamples = priv->power_nsamples[chan]; in read_power()
273 interval = priv->power_nsamples[chan] * LN2_SAMPLE_US; in lochnagar_read()
277 return -EOPNOTSUPP; in lochnagar_read()
280 return -EOPNOTSUPP; in lochnagar_read()
295 return -EOPNOTSUPP; in lochnagar_read_string()
305 return -EOPNOTSUPP; in lochnagar_write()
310 priv->power_nsamples[chan] = val; in lochnagar_write()
365 { .compatible = "cirrus,lochnagar2-hwmon" },
372 struct device *dev = &pdev->dev; in lochnagar_hwmon_probe()
379 return -ENOMEM; in lochnagar_hwmon_probe()
381 mutex_init(&priv->sensor_lock); in lochnagar_hwmon_probe()
383 priv->regmap = dev_get_regmap(dev->parent, NULL); in lochnagar_hwmon_probe()
384 if (!priv->regmap) { in lochnagar_hwmon_probe()
386 return -EINVAL; in lochnagar_hwmon_probe()
389 for (i = 0; i < ARRAY_SIZE(priv->power_nsamples); i++) in lochnagar_hwmon_probe()
390 priv->power_nsamples[i] = 96; in lochnagar_hwmon_probe()
401 .name = "lochnagar-hwmon",