Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: magnetometer: yas530: Apply documentation and style fixes

This commit gathers several minor changes.

In the device examples, "Xiaomi" is too generic, specific devices should be
listed here. E.g. Xiaomi Redmi 2 seems to have YAS537 but it's not fully clear
if this applies to all its variants. Samsung Galaxy S7 is often quoted in
conjunction with YAS537.

Removed defines for device IDs of YAS537 and YAS539, they are not needed so far.

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/300e394a76eb30fa031ecb69b594e9f9a70dac42.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Jakob Hauser and committed by
Jonathan Cameron
92d9c05c bdef8dcf

+11 -10
+11 -10
drivers/iio/magnetometer/yamaha-yas530.c
··· 10 10 * (YAS534 is a magnetic switch, not handled) 11 11 * YAS535 MS-6C 12 12 * YAS536 MS-3W 13 - * YAS537 MS-3T (2015 Samsung Galaxy S6, Note 5, Xiaomi) 13 + * YAS537 MS-3T (2015 Samsung Galaxy S6, Note 5, Galaxy S7) 14 14 * YAS539 MS-3S (2018 Samsung Galaxy A7 SM-A750FN) 15 15 * 16 16 * Code functions found in the MPU3050 YAS530 and YAS532 drivers ··· 92 92 #define YAS532_DATA_CENTER BIT(YAS532_DATA_BITS - 1) 93 93 #define YAS532_DATA_OVERFLOW (BIT(YAS532_DATA_BITS) - 1) 94 94 #define YAS532_20DEGREES 390 /* Counts starting at -50 °C */ 95 - 96 - /* These variant IDs are known from code dumps */ 97 - #define YAS537_DEVICE_ID 0x07 /* YAS537 (MS-3T) */ 98 - #define YAS539_DEVICE_ID 0x08 /* YAS539 (MS-3S) */ 99 95 100 96 /* Turn off device regulators etc after 5 seconds of inactivity */ 101 97 #define YAS5XX_AUTOSUSPEND_DELAY_MS 5000 ··· 321 325 { 322 326 struct yas5xx_calibration *c = &yas5xx->calibration; 323 327 u16 t_ref, t, x, y1, y2; 324 - /* These are "signed x, signed y1 etc */ 328 + /* These are signed x, signed y1 etc */ 325 329 s32 sx, sy1, sy2, sy, sz; 326 330 int ret; 327 331 ··· 662 666 return ret; 663 667 dev_dbg(yas5xx->dev, "calibration data: %16ph\n", data); 664 668 669 + /* Contribute calibration data to the input pool for kernel entropy */ 665 670 add_device_randomness(data, sizeof(data)); 671 + 672 + /* Extract version */ 666 673 yas5xx->version = data[15] & GENMASK(1, 0); 667 674 668 675 /* Extract the calibration from the bitfield */ ··· 692 693 c->r[0] = sign_extend32(FIELD_GET(GENMASK(28, 23), val), 5); 693 694 c->r[1] = sign_extend32(FIELD_GET(GENMASK(20, 15), val), 5); 694 695 c->r[2] = sign_extend32(FIELD_GET(GENMASK(12, 7), val), 5); 696 + 695 697 return 0; 696 698 } 697 699 ··· 714 714 dev_dbg(yas5xx->dev, "calibration data: %14ph\n", data); 715 715 716 716 /* Sanity check, is this all zeroes? */ 717 - if (memchr_inv(data, 0x00, 13) == NULL) { 718 - if (!(data[13] & BIT(7))) 719 - dev_warn(yas5xx->dev, "calibration is blank!\n"); 720 - } 717 + if (!memchr_inv(data, 0x00, 13) && !(data[13] & BIT(7))) 718 + dev_warn(yas5xx->dev, "calibration is blank!\n"); 721 719 720 + /* Contribute calibration data to the input pool for kernel entropy */ 722 721 add_device_randomness(data, sizeof(data)); 722 + 723 723 /* Only one bit of version info reserved here as far as we know */ 724 724 yas5xx->version = data[13] & BIT(0); 725 725 ··· 728 728 c->Cy1 = data[1] * 10 - 1280; 729 729 c->Cy2 = data[2] * 10 - 1280; 730 730 yas530_extract_calibration(&data[3], c); 731 + 731 732 /* 732 733 * Extract linearization: 733 734 * Linearization layout in the 32 bits at byte 10: