hwmon fixes for 3.13-rc4
Fix HIH-6130 driver to work with BeagleBone -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJSqd02AAoJEMsfJm/On5mBrwoP/05UBS1HCf/yyX3FbnIOsjA6 oMOH3SkuzVWFQmndqANZS/oxwwnO3WZ4ML25b0GEYjJeCqf/JpVLyalRMjWV1Xxz DqVRmd9yO9rrOuQ9CuSJqAqXzGnXNip16VIetArarcMtZrEUkkMqpY7ax8tGKr24 Q0zIWpG8XO7hykeOetUuwOk9bKD+iFX04ttQFWmv8Mlv/FR//khMRMnMyP0kOP3D ZLtMoMi1vdsxMP5PZzgoijH5CgAgb2Eh+jilP2rLOh5R/IrZOyheGBtOYay5Rmg/ e7JL3ODHNPnBsIAT27Fk98PLHBAIrCELg0N5k1OvvrmjhSL4GZCVlwyOUn0AngIG GQUWwvI7tdQgV3mftuIz3ueoHTEL+0Y9BISF9FX6DrXgq94Xrl3YnNzsTAvHQtun yoB8W780j7cRIvEpi5jNjhESR9J13fSDbawAMFTUWsbZLN7lwp1KlUV5OryysizR KIkoC9RGWbfl4tk5neD0bM9O3gpE7sctbRLPZkVahr1cslaXr0oP3zOQ1kAByWaI 4Li/JklmanERz+meP1DDdJ1VOlfM/GpiGNx0j0RNX4MlDWaX8s24fYEIs//R0j0H QQ38YoO7OwVyscCn5HkAMTU3gn3evA4YAOgwAyyXUFMIwAQiMNTOJmsd6EAsKWpJ jKnT7vIlfELjop48xwXu =B6Bw -----END PGP SIGNATURE----- Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon fix from Guenter Roeck: "Fix HIH-6130 driver to work with BeagleBone" * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: HIH-6130: Support I2C bus drivers without I2C_FUNC_SMBUS_QUICK
This commit is contained in:
commit
86b581f6f1
|
@ -43,6 +43,7 @@
|
|||
* @last_update: time of last update (jiffies)
|
||||
* @temperature: cached temperature measurement value
|
||||
* @humidity: cached humidity measurement value
|
||||
* @write_length: length for I2C measurement request
|
||||
*/
|
||||
struct hih6130 {
|
||||
struct device *hwmon_dev;
|
||||
|
@ -51,6 +52,7 @@ struct hih6130 {
|
|||
unsigned long last_update;
|
||||
int temperature;
|
||||
int humidity;
|
||||
size_t write_length;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -121,8 +123,15 @@ static int hih6130_update_measurements(struct i2c_client *client)
|
|||
*/
|
||||
if (time_after(jiffies, hih6130->last_update + HZ) || !hih6130->valid) {
|
||||
|
||||
/* write to slave address, no data, to request a measurement */
|
||||
ret = i2c_master_send(client, tmp, 0);
|
||||
/*
|
||||
* Write to slave address to request a measurement.
|
||||
* According with the datasheet it should be with no data, but
|
||||
* for systems with I2C bus drivers that do not allow zero
|
||||
* length packets we write one dummy byte to allow sensor
|
||||
* measurements on them.
|
||||
*/
|
||||
tmp[0] = 0;
|
||||
ret = i2c_master_send(client, tmp, hih6130->write_length);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
|
@ -252,6 +261,9 @@ static int hih6130_probe(struct i2c_client *client,
|
|||
goto fail_remove_sysfs;
|
||||
}
|
||||
|
||||
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_QUICK))
|
||||
hih6130->write_length = 1;
|
||||
|
||||
return 0;
|
||||
|
||||
fail_remove_sysfs:
|
||||
|
|
Loading…
Reference in New Issue