| .. | .. |
|---|
| 57 | 57 | #define TWL6030_GPADCS BIT(1) |
|---|
| 58 | 58 | #define TWL6030_GPADCR BIT(0) |
|---|
| 59 | 59 | |
|---|
| 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 | + |
|---|
| 60 | 72 | /** |
|---|
| 61 | 73 | * struct twl6030_chnl_calib - channel calibration |
|---|
| 62 | 74 | * @gain: slope coefficient for ideal curve |
|---|
| .. | .. |
|---|
| 927 | 939 | return ret; |
|---|
| 928 | 940 | } |
|---|
| 929 | 941 | |
|---|
| 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 | + |
|---|
| 930 | 962 | indio_dev->name = DRIVER_NAME; |
|---|
| 931 | 963 | indio_dev->info = &twl6030_gpadc_iio_info; |
|---|
| 932 | 964 | indio_dev->modes = INDIO_DIRECT_MODE; |
|---|