Lines Matching refs:adc

52 	struct adcxx *adc = spi_get_drvdata(spi);  in adcxx_show()  local
58 if (mutex_lock_interruptible(&adc->lock)) in adcxx_show()
61 if (adc->channels == 1) { in adcxx_show()
77 value = value * adc->reference >> 12; in adcxx_show()
80 mutex_unlock(&adc->lock); in adcxx_show()
95 struct adcxx *adc = spi_get_drvdata(spi); in adcxx_max_show() local
98 if (mutex_lock_interruptible(&adc->lock)) in adcxx_max_show()
101 reference = adc->reference; in adcxx_max_show()
103 mutex_unlock(&adc->lock); in adcxx_max_show()
113 struct adcxx *adc = spi_get_drvdata(spi); in adcxx_max_store() local
119 if (mutex_lock_interruptible(&adc->lock)) in adcxx_max_store()
122 adc->reference = value; in adcxx_max_store()
124 mutex_unlock(&adc->lock); in adcxx_max_store()
154 struct adcxx *adc; in adcxx_probe() local
158 adc = devm_kzalloc(&spi->dev, sizeof(*adc), GFP_KERNEL); in adcxx_probe()
159 if (!adc) in adcxx_probe()
163 adc->reference = 3300; in adcxx_probe()
164 adc->channels = channels; in adcxx_probe()
165 mutex_init(&adc->lock); in adcxx_probe()
167 mutex_lock(&adc->lock); in adcxx_probe()
169 spi_set_drvdata(spi, adc); in adcxx_probe()
171 for (i = 0; i < 3 + adc->channels; i++) { in adcxx_probe()
179 adc->hwmon_dev = hwmon_device_register(&spi->dev); in adcxx_probe()
180 if (IS_ERR(adc->hwmon_dev)) { in adcxx_probe()
182 status = PTR_ERR(adc->hwmon_dev); in adcxx_probe()
186 mutex_unlock(&adc->lock); in adcxx_probe()
193 mutex_unlock(&adc->lock); in adcxx_probe()
199 struct adcxx *adc = spi_get_drvdata(spi); in adcxx_remove() local
202 mutex_lock(&adc->lock); in adcxx_remove()
203 hwmon_device_unregister(adc->hwmon_dev); in adcxx_remove()
204 for (i = 0; i < 3 + adc->channels; i++) in adcxx_remove()
207 mutex_unlock(&adc->lock); in adcxx_remove()