Lines Matching +full:3 +full:c
7 * YAS530 MS-3E (2011 Samsung Galaxy S Advance)
8 * YAS532 MS-3R (2011 Samsung Galaxy S4)
9 * YAS533 MS-3F (Vivo 1633, 1707, V3, Y21L)
11 * YAS535 MS-6C
12 * YAS536 MS-3W
13 * YAS537 MS-3T (2015 Samsung Galaxy S6, Note 5, Galaxy S7)
14 * YAS539 MS-3S (2018 Samsung Galaxy A7 SM-A750FN)
18 * Copyright (C) 2012 InvenSense Corporation
21 * Copyright (c) 2014 Yamaha Corporation
97 #define YAS530_DEVICE_ID 0x01 /* YAS530 (MS-3E) */
98 #define YAS530_VERSION_A 0 /* YAS530 (MS-3E A) */
99 #define YAS530_VERSION_B 1 /* YAS530B (MS-3E B) */
106 #define YAS532_DEVICE_ID 0x02 /* YAS532/YAS533 (MS-3R/F) */
107 #define YAS532_VERSION_AB 0 /* YAS532/533 AB (MS-3R/F AB) */
108 #define YAS532_VERSION_AC 1 /* YAS532/533 AC (MS-3R/F AC) */
117 #define YAS537_DEVICE_ID 0x07 /* YAS537 (MS-3T) */
130 #define YAS537_LCK_MASK_GET GENMASK(3, 0)
154 s32 r[3];
155 u32 f[3];
176 * @t_ref: number of counts at reference temperature 20 °C
227 s8 hard_offsets[3];
250 * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 in yas530_extract_axis()
254 val = FIELD_GET(GENMASK(14, 3), val); in yas530_extract_axis()
265 * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 in yas532_extract_axis()
322 * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 in yas530_measure()
336 * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 in yas530_measure()
370 struct yas5xx_calibration *c = &yas5xx->calibration; in yas537_measure() local
373 u16 xy1y2[3]; in yas537_measure()
374 s32 h[3], s[3]; in yas537_measure()
409 for (i = 0; i < 3; i++) in yas537_measure()
411 h[0] = (c->k * (128 * s[0] + c->a2 * s[1] + c->a3 * s[2])) / half_range; in yas537_measure()
412 h[1] = (c->k * (c->a4 * s[0] + c->a5 * s[1] + c->a6 * s[2])) / half_range; in yas537_measure()
413 h[2] = (c->k * (c->a7 * s[0] + c->a8 * s[1] + c->a9 * s[2])) / half_range; in yas537_measure()
414 for (i = 0; i < 3; i++) { in yas537_measure()
435 struct yas5xx_calibration *c = &yas5xx->calibration; in yas530_linearize() local
465 * x' = x - (3721 + 50 * f) + (xoffset - r) * c in yas530_linearize()
467 * Where f and r are calibration values, c is a per-device in yas530_linearize()
470 return val - (3721 + 50 * c->f[axis]) + in yas530_linearize()
471 (yas5xx->hard_offsets[axis] - c->r[axis]) * coef; in yas530_linearize()
504 struct yas5xx_calibration *c = &yas5xx->calibration; in yas530_get_measure() local
540 sx = sx - (c->Cx * t_comp) / 100; in yas530_get_measure()
541 sy1 = sy1 - (c->Cy1 * t_comp) / 100; in yas530_get_measure()
542 sy2 = sy2 - (c->Cy2 * t_comp) / 100; in yas530_get_measure()
569 *xo = c->k * ((100 * sx + c->a2 * sy + c->a3 * sz) / 10); in yas530_get_measure()
570 *yo = c->k * ((c->a4 * sx + c->a5 * sy + c->a6 * sz) / 10); in yas530_get_measure()
571 *zo = c->k * ((c->a7 * sx + c->a8 * sy + c->a9 * sz) / 10); in yas530_get_measure()
640 case 3: in yas5xx_read_raw()
676 yas5xx->scan.channels[3] = z; in yas5xx_fill_buffer()
740 YAS5XX_AXIS_CHANNEL(Z, 3),
744 static const unsigned long yas5xx_scan_masks[] = { GENMASK(3, 0), 0 };
785 * @c: the calibration to populate
789 static void yas530_extract_calibration(u8 *data, struct yas5xx_calibration *c) in yas530_extract_calibration() argument
795 * a2 = 2 etc, k = k, c = clock divider in yas530_extract_calibration()
797 * n 7 6 5 4 3 2 1 0 in yas530_extract_calibration()
798 * 0 [ 2 2 2 2 2 2 3 3 ] bits 63 .. 56 in yas530_extract_calibration()
799 * 1 [ 3 3 4 4 4 4 4 4 ] bits 55 .. 48 in yas530_extract_calibration()
801 * 3 [ 6 6 6 6 7 7 7 7 ] bits 39 .. 32 in yas530_extract_calibration()
804 * 6 [ 9 k k k k k c c ] bits 15 .. 8 in yas530_extract_calibration()
805 * 7 [ c x x x x x x x ] bits 7 .. 0 in yas530_extract_calibration()
807 c->a2 = FIELD_GET(GENMASK_ULL(63, 58), val) - 32; in yas530_extract_calibration()
808 c->a3 = FIELD_GET(GENMASK_ULL(57, 54), val) - 8; in yas530_extract_calibration()
809 c->a4 = FIELD_GET(GENMASK_ULL(53, 48), val) - 32; in yas530_extract_calibration()
810 c->a5 = FIELD_GET(GENMASK_ULL(47, 42), val) + 38; in yas530_extract_calibration()
811 c->a6 = FIELD_GET(GENMASK_ULL(41, 36), val) - 32; in yas530_extract_calibration()
812 c->a7 = FIELD_GET(GENMASK_ULL(35, 29), val) - 64; in yas530_extract_calibration()
813 c->a8 = FIELD_GET(GENMASK_ULL(28, 23), val) - 32; in yas530_extract_calibration()
814 c->a9 = FIELD_GET(GENMASK_ULL(22, 15), val); in yas530_extract_calibration()
815 c->k = FIELD_GET(GENMASK_ULL(14, 10), val) + 10; in yas530_extract_calibration()
816 c->dck = FIELD_GET(GENMASK_ULL(9, 7), val); in yas530_extract_calibration()
821 struct yas5xx_calibration *c = &yas5xx->calibration; in yas530_get_calibration_data() local
844 c->Cx = data[0] * 6 - 768; in yas530_get_calibration_data()
845 c->Cy1 = data[1] * 6 - 768; in yas530_get_calibration_data()
846 c->Cy2 = data[2] * 6 - 768; in yas530_get_calibration_data()
847 yas530_extract_calibration(&data[3], c); in yas530_get_calibration_data()
854 * n 7 6 5 4 3 2 1 0 in yas530_get_calibration_data()
858 * 3 [ r2 f2 f2 xx xx xx xx xx ] bits 7 .. 0 in yas530_get_calibration_data()
861 c->f[0] = FIELD_GET(GENMASK(22, 21), val); in yas530_get_calibration_data()
862 c->f[1] = FIELD_GET(GENMASK(14, 13), val); in yas530_get_calibration_data()
863 c->f[2] = FIELD_GET(GENMASK(6, 5), val); in yas530_get_calibration_data()
864 c->r[0] = sign_extend32(FIELD_GET(GENMASK(28, 23), val), 5); in yas530_get_calibration_data()
865 c->r[1] = sign_extend32(FIELD_GET(GENMASK(20, 15), val), 5); in yas530_get_calibration_data()
866 c->r[2] = sign_extend32(FIELD_GET(GENMASK(12, 7), val), 5); in yas530_get_calibration_data()
873 struct yas5xx_calibration *c = &yas5xx->calibration; in yas532_get_calibration_data() local
899 c->Cx = data[0] * 10 - 1280; in yas532_get_calibration_data()
900 c->Cy1 = data[1] * 10 - 1280; in yas532_get_calibration_data()
901 c->Cy2 = data[2] * 10 - 1280; in yas532_get_calibration_data()
902 yas530_extract_calibration(&data[3], c); in yas532_get_calibration_data()
909 * n 7 6 5 4 3 2 1 0 in yas532_get_calibration_data()
913 * 3 [ f2 xx xx xx xx xx xx xx ] bits 7 .. 0 in yas532_get_calibration_data()
916 c->f[0] = FIELD_GET(GENMASK(24, 23), val); in yas532_get_calibration_data()
917 c->f[1] = FIELD_GET(GENMASK(16, 15), val); in yas532_get_calibration_data()
918 c->f[2] = FIELD_GET(GENMASK(8, 7), val); in yas532_get_calibration_data()
919 c->r[0] = sign_extend32(FIELD_GET(GENMASK(30, 25), val), 5); in yas532_get_calibration_data()
920 c->r[1] = sign_extend32(FIELD_GET(GENMASK(22, 17), val), 5); in yas532_get_calibration_data()
921 c->r[2] = sign_extend32(FIELD_GET(GENMASK(14, 7), val), 5); in yas532_get_calibration_data()
928 struct yas5xx_calibration *c = &yas5xx->calibration; in yas537_get_calibration_data() local
963 * data[3] 0x96 in yas537_get_calibration_data()
986 for (i = 0; i < 3; i++) { in yas537_get_calibration_data()
1010 * data[3] YAS537_MTC+3 (partially) 0x96 in yas537_get_calibration_data()
1020 for (i = 0; i < 3; i++) { in yas537_get_calibration_data()
1026 for (i = 0; i < 3; i++) { in yas537_get_calibration_data()
1036 * data[3] n 7 6 5 4 3 2 1 0 in yas537_get_calibration_data()
1037 * YAS537_MTC+3 x x x 1 0 0 0 0 in yas537_get_calibration_data()
1039 * data[15] n 7 6 5 4 3 2 1 0 in yas537_get_calibration_data()
1042 * data[15] n 7 6 5 4 3 2 1 0 in yas537_get_calibration_data()
1045 * data[16] n 7 6 5 4 3 2 1 0 in yas537_get_calibration_data()
1048 ret = regmap_write(yas5xx->map, YAS537_MTC + 3, in yas537_get_calibration_data()
1050 FIELD_GET(YAS537_MTC3_MASK_GET, data[3])) | in yas537_get_calibration_data()
1072 * n 7 6 5 4 3 2 1 0 in yas537_get_calibration_data()
1076 * data[3] 3 [ C2 C2 C2 ] bits 7 .. 0 in yas537_get_calibration_data()
1078 * n 7 6 5 4 3 2 1 0 in yas537_get_calibration_data()
1079 * data[3] 0 [ a2 a2 a2 a2 a2 ] bits 31 .. 24 in yas537_get_calibration_data()
1082 * data[6] 3 [ a4 ] bits 7 .. 0 in yas537_get_calibration_data()
1084 * n 7 6 5 4 3 2 1 0 in yas537_get_calibration_data()
1088 * data[9] 3 [ a7 ] bits 7 .. 0 in yas537_get_calibration_data()
1090 * n 7 6 5 4 3 2 1 0 in yas537_get_calibration_data()
1094 * data[12] 3 [ ] bits 7 .. 0 in yas537_get_calibration_data()
1097 val2 = get_unaligned_be32(&data[3]); in yas537_get_calibration_data()
1101 c->Cx = FIELD_GET(GENMASK(31, 23), val1) - 256; in yas537_get_calibration_data()
1102 c->Cy1 = FIELD_GET(GENMASK(22, 14), val1) - 256; in yas537_get_calibration_data()
1103 c->Cy2 = FIELD_GET(GENMASK(13, 5), val1) - 256; in yas537_get_calibration_data()
1104 c->a2 = FIELD_GET(GENMASK(28, 22), val2) - 64; in yas537_get_calibration_data()
1105 c->a3 = FIELD_GET(GENMASK(21, 15), val2) - 64; in yas537_get_calibration_data()
1106 c->a4 = FIELD_GET(GENMASK(14, 7), val2) - 128; in yas537_get_calibration_data()
1107 c->a5 = FIELD_GET(GENMASK(30, 22), val3) - 112; in yas537_get_calibration_data()
1108 c->a6 = FIELD_GET(GENMASK(21, 15), val3) - 64; in yas537_get_calibration_data()
1109 c->a7 = FIELD_GET(GENMASK(14, 7), val3) - 128; in yas537_get_calibration_data()
1110 c->a8 = FIELD_GET(GENMASK(30, 24), val4) - 64; in yas537_get_calibration_data()
1111 c->a9 = FIELD_GET(GENMASK(23, 15), val4) - 112; in yas537_get_calibration_data()
1112 c->k = FIELD_GET(GENMASK(14, 8), val4); in yas537_get_calibration_data()
1125 struct yas5xx_calibration *c = &yas5xx->calibration; in yas530_dump_calibration() local
1128 c->f[0], c->f[1], c->f[2]); in yas530_dump_calibration()
1130 c->r[0], c->r[1], c->r[2]); in yas530_dump_calibration()
1131 dev_dbg(yas5xx->dev, "Cx = %d\n", c->Cx); in yas530_dump_calibration()
1132 dev_dbg(yas5xx->dev, "Cy1 = %d\n", c->Cy1); in yas530_dump_calibration()
1133 dev_dbg(yas5xx->dev, "Cy2 = %d\n", c->Cy2); in yas530_dump_calibration()
1134 dev_dbg(yas5xx->dev, "a2 = %d\n", c->a2); in yas530_dump_calibration()
1135 dev_dbg(yas5xx->dev, "a3 = %d\n", c->a3); in yas530_dump_calibration()
1136 dev_dbg(yas5xx->dev, "a4 = %d\n", c->a4); in yas530_dump_calibration()
1137 dev_dbg(yas5xx->dev, "a5 = %d\n", c->a5); in yas530_dump_calibration()
1138 dev_dbg(yas5xx->dev, "a6 = %d\n", c->a6); in yas530_dump_calibration()
1139 dev_dbg(yas5xx->dev, "a7 = %d\n", c->a7); in yas530_dump_calibration()
1140 dev_dbg(yas5xx->dev, "a8 = %d\n", c->a8); in yas530_dump_calibration()
1141 dev_dbg(yas5xx->dev, "a9 = %d\n", c->a9); in yas530_dump_calibration()
1142 dev_dbg(yas5xx->dev, "k = %d\n", c->k); in yas530_dump_calibration()
1143 dev_dbg(yas5xx->dev, "dck = %d\n", c->dck); in yas530_dump_calibration()
1148 struct yas5xx_calibration *c = &yas5xx->calibration; in yas537_dump_calibration() local
1151 dev_dbg(yas5xx->dev, "Cx = %d\n", c->Cx); in yas537_dump_calibration()
1152 dev_dbg(yas5xx->dev, "Cy1 = %d\n", c->Cy1); in yas537_dump_calibration()
1153 dev_dbg(yas5xx->dev, "Cy2 = %d\n", c->Cy2); in yas537_dump_calibration()
1154 dev_dbg(yas5xx->dev, "a2 = %d\n", c->a2); in yas537_dump_calibration()
1155 dev_dbg(yas5xx->dev, "a3 = %d\n", c->a3); in yas537_dump_calibration()
1156 dev_dbg(yas5xx->dev, "a4 = %d\n", c->a4); in yas537_dump_calibration()
1157 dev_dbg(yas5xx->dev, "a5 = %d\n", c->a5); in yas537_dump_calibration()
1158 dev_dbg(yas5xx->dev, "a6 = %d\n", c->a6); in yas537_dump_calibration()
1159 dev_dbg(yas5xx->dev, "a7 = %d\n", c->a7); in yas537_dump_calibration()
1160 dev_dbg(yas5xx->dev, "a8 = %d\n", c->a8); in yas537_dump_calibration()
1161 dev_dbg(yas5xx->dev, "a9 = %d\n", c->a9); in yas537_dump_calibration()
1162 dev_dbg(yas5xx->dev, "k = %d\n", c->k); in yas537_dump_calibration()
1294 buf = cpu_to_be16(GENMASK(9, 3)); in yas537_power_on()
1315 ret = regmap_write(yas5xx->map, YAS537_CONFIG, BIT(3)); in yas537_power_on()
1328 .product_name = "YAS530 MS-3E",
1343 .product_name = "YAS532 MS-3R",
1358 .product_name = "YAS533 MS-3F",
1373 .product_name = "YAS537 MS-3T",
1613 MODULE_DESCRIPTION("Yamaha YAS53x 3-axis magnetometer driver");