Lines Matching refs:pdata

181 	struct ntc_thermistor_platform_data *pdata;  member
190 static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata) in ntc_adc_iio_read() argument
192 struct iio_channel *channel = pdata->chan; in ntc_adc_iio_read()
203 result = pdata->pullup_uv * (s64) val; in ntc_adc_iio_read()
244 struct ntc_thermistor_platform_data *pdata; in ntc_thermistor_parse_dt() local
250 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); in ntc_thermistor_parse_dt()
251 if (!pdata) in ntc_thermistor_parse_dt()
265 if (of_property_read_u32(np, "pullup-uv", &pdata->pullup_uv)) in ntc_thermistor_parse_dt()
267 if (of_property_read_u32(np, "pullup-ohm", &pdata->pullup_ohm)) in ntc_thermistor_parse_dt()
269 if (of_property_read_u32(np, "pulldown-ohm", &pdata->pulldown_ohm)) in ntc_thermistor_parse_dt()
273 pdata->connect = NTC_CONNECTED_POSITIVE; in ntc_thermistor_parse_dt()
275 pdata->connect = NTC_CONNECTED_GROUND; in ntc_thermistor_parse_dt()
277 pdata->chan = chan; in ntc_thermistor_parse_dt()
278 pdata->read_uv = ntc_adc_iio_read; in ntc_thermistor_parse_dt()
280 return pdata; in ntc_thermistor_parse_dt()
282 static void ntc_iio_channel_release(struct ntc_thermistor_platform_data *pdata) in ntc_iio_channel_release() argument
284 if (pdata->chan) in ntc_iio_channel_release()
285 iio_channel_release(pdata->chan); in ntc_iio_channel_release()
296 static void ntc_iio_channel_release(struct ntc_thermistor_platform_data *pdata) in ntc_iio_channel_release() argument
311 struct ntc_thermistor_platform_data *pdata = data->pdata; in get_ohm_of_thermistor() local
313 u64 pmv = pdata->pullup_uv / 1000; in get_ohm_of_thermistor()
315 puo = pdata->pullup_ohm; in get_ohm_of_thermistor()
316 pdo = pdata->pulldown_ohm; in get_ohm_of_thermistor()
319 if (pdata->connect == NTC_CONNECTED_POSITIVE) in get_ohm_of_thermistor()
324 return (pdata->connect == NTC_CONNECTED_POSITIVE) ? in get_ohm_of_thermistor()
327 if (pdata->connect == NTC_CONNECTED_POSITIVE && puo == 0) in get_ohm_of_thermistor()
329 else if (pdata->connect == NTC_CONNECTED_GROUND && pdo == 0) in get_ohm_of_thermistor()
331 else if (pdata->connect == NTC_CONNECTED_POSITIVE) in get_ohm_of_thermistor()
430 if (data->pdata->read_ohm) in ntc_thermistor_get_ohm()
431 return data->pdata->read_ohm(); in ntc_thermistor_get_ohm()
433 if (data->pdata->read_uv) { in ntc_thermistor_get_ohm()
434 read_uv = data->pdata->read_uv(data->pdata); in ntc_thermistor_get_ohm()
507 struct ntc_thermistor_platform_data *pdata; in ntc_thermistor_probe() local
511 pdata = ntc_thermistor_parse_dt(pdev); in ntc_thermistor_probe()
512 if (IS_ERR(pdata)) in ntc_thermistor_probe()
513 return PTR_ERR(pdata); in ntc_thermistor_probe()
514 else if (pdata == NULL) in ntc_thermistor_probe()
515 pdata = dev_get_platdata(&pdev->dev); in ntc_thermistor_probe()
517 if (!pdata) { in ntc_thermistor_probe()
523 if (!pdata->read_uv && !pdata->read_ohm) { in ntc_thermistor_probe()
529 if (pdata->read_uv && pdata->read_ohm) { in ntc_thermistor_probe()
532 pdata->read_uv = NULL; in ntc_thermistor_probe()
535 if (pdata->read_uv && (pdata->pullup_uv == 0 || in ntc_thermistor_probe()
536 (pdata->pullup_ohm == 0 && pdata->connect == in ntc_thermistor_probe()
538 (pdata->pulldown_ohm == 0 && pdata->connect == in ntc_thermistor_probe()
540 (pdata->connect != NTC_CONNECTED_POSITIVE && in ntc_thermistor_probe()
541 pdata->connect != NTC_CONNECTED_GROUND))) { in ntc_thermistor_probe()
554 data->pdata = pdata; in ntc_thermistor_probe()
604 ntc_iio_channel_release(pdata); in ntc_thermistor_probe()
611 struct ntc_thermistor_platform_data *pdata = data->pdata; in ntc_thermistor_remove() local
615 ntc_iio_channel_release(pdata); in ntc_thermistor_remove()