hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/iio/adc/twl6030-gpadc.c
....@@ -57,6 +57,18 @@
5757 #define TWL6030_GPADCS BIT(1)
5858 #define TWL6030_GPADCR BIT(0)
5959
60
+#define USB_VBUS_CTRL_SET 0x04
61
+#define USB_ID_CTRL_SET 0x06
62
+
63
+#define TWL6030_MISC1 0xE4
64
+#define VBUS_MEAS 0x01
65
+#define ID_MEAS 0x01
66
+
67
+#define VAC_MEAS 0x04
68
+#define VBAT_MEAS 0x02
69
+#define BB_MEAS 0x01
70
+
71
+
6072 /**
6173 * struct twl6030_chnl_calib - channel calibration
6274 * @gain: slope coefficient for ideal curve
....@@ -927,6 +939,26 @@
927939 return ret;
928940 }
929941
942
+ ret = twl_i2c_write_u8(TWL_MODULE_USB, VBUS_MEAS, USB_VBUS_CTRL_SET);
943
+ if (ret < 0) {
944
+ dev_err(dev, "failed to wire up inputs\n");
945
+ return ret;
946
+ }
947
+
948
+ ret = twl_i2c_write_u8(TWL_MODULE_USB, ID_MEAS, USB_ID_CTRL_SET);
949
+ if (ret < 0) {
950
+ dev_err(dev, "failed to wire up inputs\n");
951
+ return ret;
952
+ }
953
+
954
+ ret = twl_i2c_write_u8(TWL6030_MODULE_ID0,
955
+ VBAT_MEAS | BB_MEAS | VAC_MEAS,
956
+ TWL6030_MISC1);
957
+ if (ret < 0) {
958
+ dev_err(dev, "failed to wire up inputs\n");
959
+ return ret;
960
+ }
961
+
930962 indio_dev->name = DRIVER_NAME;
931963 indio_dev->info = &twl6030_gpadc_iio_info;
932964 indio_dev->modes = INDIO_DIRECT_MODE;