Lines Matching refs:pdata

219 	struct ntc_thermistor_platform_data *pdata;  member
228 static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata) in ntc_adc_iio_read() argument
230 struct iio_channel *channel = pdata->chan; in ntc_adc_iio_read()
242 uv = (pdata->pullup_uv * (s64)raw) >> 12; in ntc_adc_iio_read()
285 struct ntc_thermistor_platform_data *pdata; in ntc_thermistor_parse_dt() local
291 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); in ntc_thermistor_parse_dt()
292 if (!pdata) in ntc_thermistor_parse_dt()
306 if (of_property_read_u32(np, "pullup-uv", &pdata->pullup_uv)) in ntc_thermistor_parse_dt()
308 if (of_property_read_u32(np, "pullup-ohm", &pdata->pullup_ohm)) in ntc_thermistor_parse_dt()
310 if (of_property_read_u32(np, "pulldown-ohm", &pdata->pulldown_ohm)) in ntc_thermistor_parse_dt()
314 pdata->connect = NTC_CONNECTED_POSITIVE; in ntc_thermistor_parse_dt()
316 pdata->connect = NTC_CONNECTED_GROUND; in ntc_thermistor_parse_dt()
318 pdata->chan = chan; in ntc_thermistor_parse_dt()
319 pdata->read_uv = ntc_adc_iio_read; in ntc_thermistor_parse_dt()
321 return pdata; in ntc_thermistor_parse_dt()
323 static void ntc_iio_channel_release(struct ntc_thermistor_platform_data *pdata) in ntc_iio_channel_release() argument
325 if (pdata->chan) in ntc_iio_channel_release()
326 iio_channel_release(pdata->chan); in ntc_iio_channel_release()
337 static void ntc_iio_channel_release(struct ntc_thermistor_platform_data *pdata) in ntc_iio_channel_release() argument
352 struct ntc_thermistor_platform_data *pdata = data->pdata; in get_ohm_of_thermistor() local
353 u32 puv = pdata->pullup_uv; in get_ohm_of_thermistor()
355 puo = pdata->pullup_ohm; in get_ohm_of_thermistor()
356 pdo = pdata->pulldown_ohm; in get_ohm_of_thermistor()
359 return (pdata->connect == NTC_CONNECTED_POSITIVE) ? in get_ohm_of_thermistor()
362 return (pdata->connect == NTC_CONNECTED_POSITIVE) ? in get_ohm_of_thermistor()
365 if (pdata->connect == NTC_CONNECTED_POSITIVE && puo == 0) in get_ohm_of_thermistor()
367 else if (pdata->connect == NTC_CONNECTED_GROUND && pdo == 0) in get_ohm_of_thermistor()
369 else if (pdata->connect == NTC_CONNECTED_POSITIVE) in get_ohm_of_thermistor()
468 if (data->pdata->read_ohm) in ntc_thermistor_get_ohm()
469 return data->pdata->read_ohm(); in ntc_thermistor_get_ohm()
471 if (data->pdata->read_uv) { in ntc_thermistor_get_ohm()
472 read_uv = data->pdata->read_uv(data->pdata); in ntc_thermistor_get_ohm()
545 struct ntc_thermistor_platform_data *pdata; in ntc_thermistor_probe() local
549 pdata = ntc_thermistor_parse_dt(pdev); in ntc_thermistor_probe()
550 if (IS_ERR(pdata)) in ntc_thermistor_probe()
551 return PTR_ERR(pdata); in ntc_thermistor_probe()
552 else if (pdata == NULL) in ntc_thermistor_probe()
553 pdata = dev_get_platdata(&pdev->dev); in ntc_thermistor_probe()
555 if (!pdata) { in ntc_thermistor_probe()
561 if (!pdata->read_uv && !pdata->read_ohm) { in ntc_thermistor_probe()
567 if (pdata->read_uv && pdata->read_ohm) { in ntc_thermistor_probe()
570 pdata->read_uv = NULL; in ntc_thermistor_probe()
573 if (pdata->read_uv && (pdata->pullup_uv == 0 || in ntc_thermistor_probe()
574 (pdata->pullup_ohm == 0 && pdata->connect == in ntc_thermistor_probe()
576 (pdata->pulldown_ohm == 0 && pdata->connect == in ntc_thermistor_probe()
578 (pdata->connect != NTC_CONNECTED_POSITIVE && in ntc_thermistor_probe()
579 pdata->connect != NTC_CONNECTED_GROUND))) { in ntc_thermistor_probe()
592 data->pdata = pdata; in ntc_thermistor_probe()
646 ntc_iio_channel_release(pdata); in ntc_thermistor_probe()
653 struct ntc_thermistor_platform_data *pdata = data->pdata; in ntc_thermistor_remove() local
657 ntc_iio_channel_release(pdata); in ntc_thermistor_remove()