Lines Matching +full:vcca +full:- +full:supply
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * powr1220.c - Driver for the Lattice POWR1220 programmable power supply
17 #include <linux/hwmon-sysfs.h>
69 VCCA, enumerator
99 [VCCA] = "vcca",
111 mutex_lock(&data->update_lock); in powr1220_read_adc()
113 if (time_after(jiffies, data->adc_last_updated[ch_num] + HZ) || in powr1220_read_adc()
114 !data->adc_valid[ch_num]) { in powr1220_read_adc()
121 if (data->adc_maxes[ch_num] > ADC_MAX_LOW_MEASUREMENT_MV || in powr1220_read_adc()
122 data->adc_maxes[ch_num] == 0) in powr1220_read_adc()
126 result = i2c_smbus_write_byte_data(data->client, ADC_MUX, in powr1220_read_adc()
138 result = i2c_smbus_read_byte_data(data->client, ADC_VALUE_LOW); in powr1220_read_adc()
145 result = i2c_smbus_read_byte_data(data->client, ADC_VALUE_HIGH); in powr1220_read_adc()
153 data->adc_values[ch_num] = reading; in powr1220_read_adc()
154 data->adc_valid[ch_num] = true; in powr1220_read_adc()
155 data->adc_last_updated[ch_num] = jiffies; in powr1220_read_adc()
158 if (reading > data->adc_maxes[ch_num]) in powr1220_read_adc()
159 data->adc_maxes[ch_num] = reading; in powr1220_read_adc()
161 result = data->adc_values[ch_num]; in powr1220_read_adc()
165 mutex_unlock(&data->update_lock); in powr1220_read_adc()
176 int adc_val = powr1220_read_adc(dev, attr->index); in powr1220_voltage_show()
191 return sprintf(buf, "%d\n", data->adc_maxes[attr->index]); in powr1220_max_show()
201 return sprintf(buf, "%s\n", input_names[attr->index]); in powr1220_label_show()
216 static SENSOR_DEVICE_ATTR_RO(in12_input, powr1220_voltage, VCCA);
231 static SENSOR_DEVICE_ATTR_RO(in12_highest, powr1220_max, VCCA);
246 static SENSOR_DEVICE_ATTR_RO(in12_label, powr1220_label, VCCA);
305 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) in powr1220_probe()
306 return -ENODEV; in powr1220_probe()
308 data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); in powr1220_probe()
310 return -ENOMEM; in powr1220_probe()
312 mutex_init(&data->update_lock); in powr1220_probe()
313 data->client = client; in powr1220_probe()
315 hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev, in powr1220_probe()
316 client->name, data, powr1220_groups); in powr1220_probe()