forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/iio/light/stk3310.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /**
23 * Sensortek STK3310/STK3311 Ambient Light and Proximity Sensor
34 *
45 * Copyright (c) 2015, Intel Corporation.
5
- *
6
- * This file is subject to the terms and conditions of version 2 of
7
- * the GNU General Public License. See the file COPYING in the main
8
- * directory of this archive for more details.
96 *
107 * IIO driver for STK3310/STK3311. 7-bit I2C address: 0x48.
118 */
....@@ -40,6 +37,8 @@
4037
4138 #define STK3310_CHIP_ID_VAL 0x13
4239 #define STK3311_CHIP_ID_VAL 0x1D
40
+#define STK3311X_CHIP_ID_VAL 0x12
41
+#define STK3335_CHIP_ID_VAL 0x51
4342 #define STK3310_PSINT_EN 0x01
4443 #define STK3310_PS_MAX_VAL 0xFFFF
4544
....@@ -454,7 +453,9 @@
454453 return ret;
455454
456455 if (chipid != STK3310_CHIP_ID_VAL &&
457
- chipid != STK3311_CHIP_ID_VAL) {
456
+ chipid != STK3311_CHIP_ID_VAL &&
457
+ chipid != STK3311X_CHIP_ID_VAL &&
458
+ chipid != STK3335_CHIP_ID_VAL) {
458459 dev_err(&client->dev, "invalid chip id: 0x%x\n", chipid);
459460 return -ENODEV;
460461 }
....@@ -488,7 +489,7 @@
488489 }
489490 }
490491
491
-static struct regmap_config stk3310_regmap_config = {
492
+static const struct regmap_config stk3310_regmap_config = {
492493 .name = STK3310_REGMAP_NAME,
493494 .reg_bits = 8,
494495 .val_bits = 8,
....@@ -586,7 +587,6 @@
586587 if (ret < 0)
587588 return ret;
588589
589
- indio_dev->dev.parent = &client->dev;
590590 indio_dev->info = &stk3310_info;
591591 indio_dev->name = STK3310_DRIVER_NAME;
592592 indio_dev->modes = INDIO_DIRECT_MODE;
....@@ -666,6 +666,7 @@
666666 static const struct i2c_device_id stk3310_i2c_id[] = {
667667 {"STK3310", 0},
668668 {"STK3311", 0},
669
+ {"STK3335", 0},
669670 {}
670671 };
671672 MODULE_DEVICE_TABLE(i2c, stk3310_i2c_id);
....@@ -673,14 +674,24 @@
673674 static const struct acpi_device_id stk3310_acpi_id[] = {
674675 {"STK3310", 0},
675676 {"STK3311", 0},
677
+ {"STK3335", 0},
676678 {}
677679 };
678680
679681 MODULE_DEVICE_TABLE(acpi, stk3310_acpi_id);
680682
683
+static const struct of_device_id stk3310_of_match[] = {
684
+ { .compatible = "sensortek,stk3310", },
685
+ { .compatible = "sensortek,stk3311", },
686
+ { .compatible = "sensortek,stk3335", },
687
+ {}
688
+};
689
+MODULE_DEVICE_TABLE(of, stk3310_of_match);
690
+
681691 static struct i2c_driver stk3310_driver = {
682692 .driver = {
683693 .name = "stk3310",
694
+ .of_match_table = stk3310_of_match,
684695 .pm = STK3310_PM_OPS,
685696 .acpi_match_table = ACPI_PTR(stk3310_acpi_id),
686697 },