Re: [PATCH v2 4/4] Exynos4 NURI: support for NTC thermistor

From: MyungJoo Ham
Date: Wed Jun 22 2011 - 01:00:47 EST


On Tue, Jun 21, 2011 at 7:50 PM, Mark Brown
<broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, Jun 21, 2011 at 11:07:13AM +0900, MyungJoo Ham wrote:
>
>> +#include <linux/platform_data/ntc_thermistor.h>
>
> This doesn't appear to be in mainline.

Right, not just yet. I should've added comment about the patch just
being applied to "next".

I've added it as it was told to be applied to "next" in lm-sensors by
Guenter Roeck yesterday.
http://comments.gmane.org/gmane.linux.drivers.sensors/26475

Should I surround them with "#ifdef CONFIG_NTC_THERMISTOR"?

>
>> +/* NTC Thermistor */
>> +static struct platform_device nuri_ncp15wb473_thermistor;
>> +static int read_thermistor_uV(void)
>
> Blank line between these two.
>

got it.

>> +{
>> + Â Â static struct s3c_adc_client *adc;
>> + Â Â int val;
>> + Â Â s64 converted;
>> +
>> + Â Â if (!adc) {
>> + Â Â Â Â Â Â adc = s3c_adc_register(&nuri_ncp15wb473_thermistor,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â NULL, NULL, 0);
>> + Â Â Â Â Â Â if (IS_ERR_OR_NULL(adc)) {
>> + Â Â Â Â Â Â Â Â Â Â pr_err("%s: Cannot get adc.\n", __func__);
>> + Â Â Â Â Â Â Â Â Â Â return adc ? PTR_ERR(adc) : -ENODEV;
>> + Â Â Â Â Â Â }
>> + Â Â }
>
> Why not do this in an initcall or in the device registration? ÂThis
> looks like working around a limitation of the ntc_thermistor driver
> which should be fixed as part of a mainline merge for that.

Um... I think I can put this away to a common plat-samsung/dev-ntc.c
as I've seen many S5PC110/S5PV210/Exynos4 devices using NTC attached
to the CPU's ADC ports.

However, I won't be able to put that part into the NTC driver because
using S3C-ADC is plat-samsung specific method and NTC thermistor
itself is a general thermistor device not specific to S3C. Maybe, I
can do so after we've got a common ADC framework.

>
>> +
>> + Â Â if (IS_ERR_OR_NULL(adc))
>> + Â Â Â Â Â Â return adc ? PTR_ERR(adc) : -ENODEV;
>> +
>> + Â Â val = s3c_adc_read(adc, 6);
>> +
>> + Â Â converted = 3300000LL * (s64) val;
>> + Â Â converted >>= 12;
>> +
>> + Â Â pr_emerg("%s: %d -> %llduV\n", __func__, val, converted);
>
> This looks like debug that was left in by mistake.
>

Oh.. yes.. thanks. I need to remove that.


--
MyungJoo Ham (íëì), Ph.D.
Mobile Software Platform Lab,
Digital Media and Communications (DMC) Business
Samsung Electronics
cell: 82-10-6714-2858
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/