This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMP105 - Input device or thermal device ot booth

Other Parts Discussed in Thread: TMP105

Hi all,
I have a generic question about using the TMP105 driver.
Currently I use the driver lm75.c, located in drivers/hwmon, to get the board temperature. Like the name of the directory suggests this one is used for hardware monitoring. The device is registered using thermal_sensor_dev_register. The function lm75_get_temp is periodically called from thermal framework (I assume this).
The Android sources of the blaze board use the BMP085 for getting the temperature, implemented as input device. This kind of devices uses other register functions and report functions as hwmon-devices.

What is the right way to implement the driver for using it with Android?
  1. Using the thermal interface OR the input interface.
  2. Using the thermal interface AND the input interface.
  3. Using only the thermal interface
  4. Using only the input interface

If I need to adapt the input interface for lm75.c where is the best place for doing this?
  - copy the sources of lm75.c from driver/hwmon to driver/misc/input and modify it to act as a input device
  - make the modification/ add on in /driver/hwmon?

I saw that some devices are double in the Linux source tree. For instance the driver for BH1780 is located in driver/misc and driver/input/misc. But I think this is not the best way.

Many thanks in advance,
Roman

  • Hello,
    You should reuse the implementation of your current temperature sensor (BMP085) That is use the TMP105 as input device.
    Also it is better to add the modifications directly in your current driver (drivervs/hwmod/lm75.c), because if you create a modified version of your driver you will need to port it throughout your kernel (that is modify every other file that uses some function/data from lm75.c).
    Best Regards,
    Yordan

  • Just a clarification which android are you using?
    I am using 4AJ.2.5P1 (see omappedia) with the kernel downloaded from git.omapzoom.org/kernel/omap.git, and in my lm75.c driver  TMP105 is listed as possible sensor:
    /*
     * This driver handles the LM75 and compatible digital temperature sensors.
     */

    enum lm75_type {        /* keep sorted in alphabetical order */
        adt75,
        ds1775,
        ds75,
        lm75,
        lm75a,
        max6625,
        max6626,
        mcp980x,
        stds75,
        tcn75,
        tmp100,
        tmp101,
        tmp105,
        tmp175,
        tmp275,
        tmp75,
    };
    Best Regards,
    Yordan

  • Hi all,

    many thanks for your answers.

    I decided to use a new source file and put it into driver/input/misc. The existing lm75 source located in drivers/hwmon uses thermal_sensor_dev_register which leads to periodic calling of lm75_get_temp. Because of the physical location of the sensor this is not very useful in my case.
    In my opinion the best thing would be: enable thermal and/ or input device for this driver during configuration. Perhaps I will do this later.

    Thanks, Roman