iio:dac:m62332: shutdown on remove
[platform/kernel/linux-starfive.git] / drivers / iio / dac / m62332.c
index c23d7fa..c61720d 100644 (file)
@@ -173,15 +173,15 @@ static const struct iio_info m62332_info = {
        .driver_module = THIS_MODULE,
 };
 
-#define M62332_CHANNEL(chan) {                         \
-       .type = IIO_VOLTAGE,                            \
-       .indexed = 1,                                   \
-       .output = 1,                                    \
-       .channel = (chan),                              \
-       .datasheet_name = "CH" #chan,                   \
-       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |  \
-               BIT(IIO_CHAN_INFO_SCALE) |              \
-               BIT(IIO_CHAN_INFO_OFFSET),              \
+#define M62332_CHANNEL(chan) {                                 \
+       .type = IIO_VOLTAGE,                                    \
+       .indexed = 1,                                           \
+       .output = 1,                                            \
+       .channel = (chan),                                      \
+       .datasheet_name = "CH" #chan,                           \
+       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),           \
+       .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |  \
+                                   BIT(IIO_CHAN_INFO_OFFSET),  \
 }
 
 static const struct iio_chan_spec m62332_channels[M62332_CHANNELS] = {
@@ -243,6 +243,8 @@ static int m62332_remove(struct i2c_client *client)
 
        iio_device_unregister(indio_dev);
        iio_map_array_unregister(indio_dev);
+       m62332_set_value(indio_dev, 0, 0);
+       m62332_set_value(indio_dev, 0, 1);
 
        return 0;
 }