#include <linux/of_device.h>
 #include <linux/spi/spi.h>
 #include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
 #include <linux/iio/trigger.h>
 #include <linux/iio/buffer.h>
 #include <linux/iio/triggered_buffer.h>
 enum {
        MAX6675,
        MAX31855,
+       MAX31855K,
+       MAX31855J,
+       MAX31855N,
+       MAX31855S,
+       MAX31855T,
+       MAX31855E,
+       MAX31855R,
+};
+
+static const char maxim_tc_types[] = {
+       'K', '?', 'K', 'J', 'N', 'S', 'T', 'E', 'R'
 };
 
 static const struct iio_chan_spec max6675_channels[] = {
        {       /* thermocouple temperature */
                .type = IIO_TEMP,
                .info_mask_separate =
-                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) |
+                       BIT(IIO_CHAN_INFO_THERMOCOUPLE_TYPE),
                .scan_index = 0,
                .scan_type = {
                        .sign = 's',
                .type = IIO_TEMP,
                .address = 2,
                .info_mask_separate =
-                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+                       BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) |
+                       BIT(IIO_CHAN_INFO_THERMOCOUPLE_TYPE),
                .scan_index = 0,
                .scan_type = {
                        .sign = 's',
        const struct maxim_thermocouple_chip *chip;
 
        u8 buffer[16] ____cacheline_aligned;
+       char tc_type;
 };
 
 static int maxim_thermocouple_read(struct maxim_thermocouple_data *data,
                        ret = IIO_VAL_INT;
                }
                break;
+       case IIO_CHAN_INFO_THERMOCOUPLE_TYPE:
+               *val = data->tc_type;
+               ret = IIO_VAL_CHAR;
+               break;
        }
 
        return ret;
        const struct spi_device_id *id = spi_get_device_id(spi);
        struct iio_dev *indio_dev;
        struct maxim_thermocouple_data *data;
+       const int chip_type = (id->driver_data == MAX6675) ? MAX6675 : MAX31855;
        const struct maxim_thermocouple_chip *chip =
-                       &maxim_thermocouple_chips[id->driver_data];
+               &maxim_thermocouple_chips[chip_type];
        int ret;
 
        indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*data));
        data = iio_priv(indio_dev);
        data->spi = spi;
        data->chip = chip;
+       data->tc_type = maxim_tc_types[id->driver_data];
 
        ret = devm_iio_triggered_buffer_setup(&spi->dev,
                                indio_dev, NULL,
        if (ret)
                return ret;
 
+       if (id->driver_data == MAX31855)
+               dev_warn(&spi->dev, "generic max31855 ID is deprecated\nplease use more specific part type");
+
        return devm_iio_device_register(&spi->dev, indio_dev);
 }
 
 static const struct spi_device_id maxim_thermocouple_id[] = {
        {"max6675", MAX6675},
        {"max31855", MAX31855},
+       {"max31855k", MAX31855K},
+       {"max31855j", MAX31855J},
+       {"max31855n", MAX31855N},
+       {"max31855s", MAX31855S},
+       {"max31855t", MAX31855T},
+       {"max31855e", MAX31855E},
+       {"max31855r", MAX31855R},
        {},
 };
 MODULE_DEVICE_TABLE(spi, maxim_thermocouple_id);
 static const struct of_device_id maxim_thermocouple_of_match[] = {
         { .compatible = "maxim,max6675" },
         { .compatible = "maxim,max31855" },
+       { .compatible = "maxim,max31855k" },
+       { .compatible = "maxim,max31855j" },
+       { .compatible = "maxim,max31855n" },
+       { .compatible = "maxim,max31855s" },
+       { .compatible = "maxim,max31855t" },
+       { .compatible = "maxim,max31855e" },
+       { .compatible = "maxim,max31855r" },
         { },
 };
 MODULE_DEVICE_TABLE(of, maxim_thermocouple_of_match);