Touchscreen controller temperature patch

Stefan Sperling stsp at
Thu Nov 15 10:54:51 CET 2007

On Thu, Nov 15, 2007 at 12:24:22AM +0100, John S. Skogtvedt wrote:
> A forum user requested[1] the feature to get the DS temperature.
> I haven't done any "kernel hacking" before but I gave it a shot.
> The patch isn't 100% clean. I'm not sure about overloading the
> FIFO_POWER case and and 3 bits of the temperature (20.12 fixed point) is
> lost. But that probably shouldn't matter, the temperature isn't that
> accurate anyway.

Mmmh. The fifo bit space is surely getting cramped :(

> The temperature returned is that on the touchscreen controller chip, not
> external/ambient temperature.

> Usage:
>  apply patch, boot, cat /proc/tsc_temp
> Is the patch clean enough to be committed?

> And is this a feature we want?

I wonder why people want this.

We have to make a decision between losing the last few unused
bits in the fifo bit space and providing some rather
questionable feature...

Is there any other piece of hardware we haven't covered yet
that might need a few bits of FIFO bit space reserved for it?
That is the only question I have really. I don't think there
is any, space for mic input is already reserved afaik.

I'd say go on and commit. I don't want to see you waste your time
on a feature that isn't used, and if it really makes people happy
to read the touchscreen chip temperature from /proc, I don't have
a problem with that.

One nit:

> Index: include/asm-arm/arch-nds/fifo.h
> ===================================================================
> --- include/asm-arm/arch-nds/fifo.h	(revisjon 2036)
> +++ include/asm-arm/arch-nds/fifo.h	(arbeidskopi)
> @@ -35,6 +35,7 @@
>  #define FIFO_WIFI     (4 << 29)
>  #define FIFO_SOUND    (5 << 29)
>  #define FIFO_POWER    (6 << 29)
> +#define FIFO_TSC_TEMP (6 << 29)

>  		case FIFO_POWER:
> +		/* case FIFO_TSC_TEMP:  Equal to FIFO_POWER. */ 
> +			if (!data) { /* POWER */
> +			} else { /* TSC_TEMP */
> +				nds_fifo_send(FIFO_TSC_TEMP + temperature);
> +			}
>  			break;

What about merging FIFO_POWER and FIFO_TSC_TEMP into FIFO_POWER_OR_TEMP?

This way the code makes it more obvious that two different commands
are encoded. A comment that explains that FIFO_POWER_OR_TEMP
means FIFO_POWER with no argument and FIFO_TSC_TEMP with argument
would be a nice finishing touch.

stefan                                         PGP Key: 0xF59D25F0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : 

More information about the dslinux-devel mailing list