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>
40 "MICVDD",
59 * float_to_long - Convert ieee754 reading from hardware to an integer
68 * will convert that into an integer in a smaller unit such as micro-amps
69 * or milli-celsius. The hardware does not return NaN, so consideration of
75 int exp = ((data & 0x7F800000) >> 23) - 127 - 23; in float_to_long()
81 if (fls64(man) + exp > (int)sizeof(long) * 8 - 1) in float_to_long()
84 result = (man + (1ull << (-exp - 1))) >> -exp; in float_to_long()
88 return negative ? -result : result; in float_to_long()
179 struct regmap *regmap = priv->regmap; in read_sensor()
183 mutex_lock(&priv->sensor_lock); in read_sensor()
200 mutex_unlock(&priv->sensor_lock); in read_sensor()
208 int nsamples = priv->power_nsamples[chan]; in read_power()
275 interval = priv->power_nsamples[chan] * LN2_SAMPLE_US; in lochnagar_read()
279 return -EOPNOTSUPP; in lochnagar_read()
282 return -EOPNOTSUPP; in lochnagar_read()
297 return -EOPNOTSUPP; in lochnagar_read_string()
307 return -EOPNOTSUPP; in lochnagar_write()
312 priv->power_nsamples[chan] = val; in lochnagar_write()
367 { .compatible = "cirrus,lochnagar2-hwmon" },
374 struct device *dev = &pdev->dev; in lochnagar_hwmon_probe()
381 return -ENOMEM; in lochnagar_hwmon_probe()
383 mutex_init(&priv->sensor_lock); in lochnagar_hwmon_probe()
385 priv->regmap = dev_get_regmap(dev->parent, NULL); in lochnagar_hwmon_probe()
386 if (!priv->regmap) { in lochnagar_hwmon_probe()
388 return -EINVAL; in lochnagar_hwmon_probe()
391 for (i = 0; i < ARRAY_SIZE(priv->power_nsamples); i++) in lochnagar_hwmon_probe()
392 priv->power_nsamples[i] = 96; in lochnagar_hwmon_probe()
403 .name = "lochnagar-hwmon",