* [PATCH v7 4/9] dt-bindings: input: touchscreen: resistive-adc-touch: create bindings
From: Jonathan Cameron @ 2018-06-10 12:32 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1526975559-18966-5-git-send-email-eugen.hristev@microchip.com>
On Tue, 22 May 2018 10:52:34 +0300
Eugen Hristev <eugen.hristev@microchip.com> wrote:
> Added bindings for generic resistive touchscreen ADC.
>
> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> Reviewed-by: Rob Herring <robh@kernel.org>
Applied, thanks
Jonathan
> ---
> Changes in v5:
> - changed property name touchscreen-threshold-pressure to
> touchscreen-min-pressure
>
> Changes in v3:
> - renamed file and compatible to exclude "generic" keyword
> - removed the pressure threshold property, added it as a common
> touchscreen property in the touchscreen common bindings in a separate
> commit.
>
> Changes in v2:
> - modified bindings to have a generic resistive touchscreen adc driver
> instead of specific architecture one.
>
> .../input/touchscreen/resistive-adc-touch.txt | 30 ++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt
>
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt b/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt
> new file mode 100644
> index 0000000..51456c0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt
> @@ -0,0 +1,30 @@
> +Generic resistive touchscreen ADC
> +
> +Required properties:
> +
> + - compatible: must be "resistive-adc-touch"
> +The device must be connected to an ADC device that provides channels for
> +position measurement and optional pressure.
> +Refer to ../iio/iio-bindings.txt for details
> + - iio-channels: must have at least two channels connected to an ADC device.
> +These should correspond to the channels exposed by the ADC device and should
> +have the right index as the ADC device registers them. These channels
> +represent the relative position on the "x" and "y" axes.
> + - iio-channel-names: must have all the channels' names. Mandatory channels
> +are "x" and "y".
> +
> +Optional properties:
> + - iio-channels: The third channel named "pressure" is optional and can be
> +used if the ADC device also measures pressure besides position.
> +If this channel is missing, pressure will be ignored and the touchscreen
> +will only report position.
> + - iio-channel-names: optional channel named "pressure".
> +
> +Example:
> +
> + resistive_touch: resistive_touch {
> + compatible = "resistive-adc-touch";
> + touchscreen-min-pressure = <50000>;
> + io-channels = <&adc 24>, <&adc 25>, <&adc 26>;
> + io-channel-names = "x", "y", "pressure";
> + };
^ permalink raw reply
* [PATCH v7 5/9] iio: adc: at91-sama5d2_adc: add support for position and pressure channels
From: Jonathan Cameron @ 2018-06-10 12:32 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20180522122244.GM22971@rfolt0960.corp.atmel.com>
On Tue, 22 May 2018 14:22:44 +0200
Ludovic Desroches <ludovic.desroches@microchip.com> wrote:
> On Tue, May 22, 2018 at 10:52:35AM +0300, Eugen Hristev wrote:
> > This implements the support for position and pressure for the included
> > touchscreen support in the SAMA5D2 SOC ADC block.
> > Two position channels are added and one for pressure.
> > They can be read in raw format, or through a buffer.
> > A normal use case is for a consumer driver to register a callback buffer
> > for these channels.
> > When the touchscreen channels are in the active scan mask,
> > the driver will start the touchscreen sampling and push the data to the
> > buffer.
> >
> > Some parts of this patch are based on initial original work by
> > Mohamed Jamsheeth Hajanajubudeen and Bandaru Venkateswara Swamy
> >
> > Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Applied, thanks.
Jonathan
>
> > ---
> > Changes in v6:
> > - fixed a crash when issuing buffer enable from sysfs, if no trigger was
> > previously configured. This is because now the driver can work in software
> > buffer mode (to connect the callback buffer). So, when trying to enable the
> > buffer, check if we are going indeed to a triggered mode or not. If not, do
> > not allow buffer to be started (we do not have the right trigger).
> > It's in buffer_postenable and predisable.
> >
> > Changes in v4:
> > - use return value of at91_adc_configure_touch
> > - rewrote some part of the read_info_raw according to Jonathan's
> > suggestion
> >
> > Changes in v3:
> > - prefix macros with AT91_SAMA5D2
> > - reworked the x_pos and y_pos functions into a single one with two
> > additional wrappers
> > - reworked pressure report to have it grow naturally and not top down
> > - fixed some checks regarding IIO_VOLTAGE as suggested
> > - added a comment explaining some code in trigger handling
> > - reworked the frequency get handler to use the saved value instead of
> > reading it from the hardware.
> > - added comment on deffered work queueing
> > - pulled out INFO_RAW function into a separate utility function as suggested
> > - added iio_dev ops structure at all times . The functions are needed in
> > case we do not have a hardware trigger attached, but we want to use the
> > consumer touchscreen driver, thus a callback buffer is attached. Then we still
> > need to have buffer preenable and postdisable to configure the touch IRQs (etc.)
> >
> > Changes in v2:
> > - the support is now based on callback buffer.
> >
> > drivers/iio/adc/at91-sama5d2_adc.c | 609 +++++++++++++++++++++++++++++++++----
> > 1 file changed, 551 insertions(+), 58 deletions(-)
> >
> > diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> > index 8729d65..58c4c2b 100644
> > --- a/drivers/iio/adc/at91-sama5d2_adc.c
> > +++ b/drivers/iio/adc/at91-sama5d2_adc.c
> > @@ -102,14 +102,26 @@
> > #define AT91_SAMA5D2_LCDR 0x20
> > /* Interrupt Enable Register */
> > #define AT91_SAMA5D2_IER 0x24
> > +/* Interrupt Enable Register - TS X measurement ready */
> > +#define AT91_SAMA5D2_IER_XRDY BIT(20)
> > +/* Interrupt Enable Register - TS Y measurement ready */
> > +#define AT91_SAMA5D2_IER_YRDY BIT(21)
> > +/* Interrupt Enable Register - TS pressure measurement ready */
> > +#define AT91_SAMA5D2_IER_PRDY BIT(22)
> > /* Interrupt Enable Register - general overrun error */
> > #define AT91_SAMA5D2_IER_GOVRE BIT(25)
> > +/* Interrupt Enable Register - Pen detect */
> > +#define AT91_SAMA5D2_IER_PEN BIT(29)
> > +/* Interrupt Enable Register - No pen detect */
> > +#define AT91_SAMA5D2_IER_NOPEN BIT(30)
> > /* Interrupt Disable Register */
> > #define AT91_SAMA5D2_IDR 0x28
> > /* Interrupt Mask Register */
> > #define AT91_SAMA5D2_IMR 0x2c
> > /* Interrupt Status Register */
> > #define AT91_SAMA5D2_ISR 0x30
> > +/* Interrupt Status Register - Pen touching sense status */
> > +#define AT91_SAMA5D2_ISR_PENS BIT(31)
> > /* Last Channel Trigger Mode Register */
> > #define AT91_SAMA5D2_LCTMR 0x34
> > /* Last Channel Compare Window Register */
> > @@ -131,8 +143,38 @@
> > #define AT91_SAMA5D2_CDR0 0x50
> > /* Analog Control Register */
> > #define AT91_SAMA5D2_ACR 0x94
> > +/* Analog Control Register - Pen detect sensitivity mask */
> > +#define AT91_SAMA5D2_ACR_PENDETSENS_MASK GENMASK(1, 0)
> > +
> > /* Touchscreen Mode Register */
> > #define AT91_SAMA5D2_TSMR 0xb0
> > +/* Touchscreen Mode Register - No touch mode */
> > +#define AT91_SAMA5D2_TSMR_TSMODE_NONE 0
> > +/* Touchscreen Mode Register - 4 wire screen, no pressure measurement */
> > +#define AT91_SAMA5D2_TSMR_TSMODE_4WIRE_NO_PRESS 1
> > +/* Touchscreen Mode Register - 4 wire screen, pressure measurement */
> > +#define AT91_SAMA5D2_TSMR_TSMODE_4WIRE_PRESS 2
> > +/* Touchscreen Mode Register - 5 wire screen */
> > +#define AT91_SAMA5D2_TSMR_TSMODE_5WIRE 3
> > +/* Touchscreen Mode Register - Average samples mask */
> > +#define AT91_SAMA5D2_TSMR_TSAV_MASK GENMASK(5, 4)
> > +/* Touchscreen Mode Register - Average samples */
> > +#define AT91_SAMA5D2_TSMR_TSAV(x) ((x) << 4)
> > +/* Touchscreen Mode Register - Touch/trigger frequency ratio mask */
> > +#define AT91_SAMA5D2_TSMR_TSFREQ_MASK GENMASK(11, 8)
> > +/* Touchscreen Mode Register - Touch/trigger frequency ratio */
> > +#define AT91_SAMA5D2_TSMR_TSFREQ(x) ((x) << 8)
> > +/* Touchscreen Mode Register - Pen Debounce Time mask */
> > +#define AT91_SAMA5D2_TSMR_PENDBC_MASK GENMASK(31, 28)
> > +/* Touchscreen Mode Register - Pen Debounce Time */
> > +#define AT91_SAMA5D2_TSMR_PENDBC(x) ((x) << 28)
> > +/* Touchscreen Mode Register - No DMA for touch measurements */
> > +#define AT91_SAMA5D2_TSMR_NOTSDMA BIT(22)
> > +/* Touchscreen Mode Register - Disable pen detection */
> > +#define AT91_SAMA5D2_TSMR_PENDET_DIS (0 << 24)
> > +/* Touchscreen Mode Register - Enable pen detection */
> > +#define AT91_SAMA5D2_TSMR_PENDET_ENA BIT(24)
> > +
> > /* Touchscreen X Position Register */
> > #define AT91_SAMA5D2_XPOSR 0xb4
> > /* Touchscreen Y Position Register */
> > @@ -151,6 +193,12 @@
> > #define AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_FALL 2
> > /* Trigger Mode external trigger any edge */
> > #define AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_ANY 3
> > +/* Trigger Mode internal periodic */
> > +#define AT91_SAMA5D2_TRGR_TRGMOD_PERIODIC 5
> > +/* Trigger Mode - trigger period mask */
> > +#define AT91_SAMA5D2_TRGR_TRGPER_MASK GENMASK(31, 16)
> > +/* Trigger Mode - trigger period */
> > +#define AT91_SAMA5D2_TRGR_TRGPER(x) ((x) << 16)
> >
> > /* Correction Select Register */
> > #define AT91_SAMA5D2_COSR 0xd0
> > @@ -169,6 +217,22 @@
> > #define AT91_SAMA5D2_SINGLE_CHAN_CNT 12
> > #define AT91_SAMA5D2_DIFF_CHAN_CNT 6
> >
> > +#define AT91_SAMA5D2_TIMESTAMP_CHAN_IDX (AT91_SAMA5D2_SINGLE_CHAN_CNT + \
> > + AT91_SAMA5D2_DIFF_CHAN_CNT + 1)
> > +
> > +#define AT91_SAMA5D2_TOUCH_X_CHAN_IDX (AT91_SAMA5D2_SINGLE_CHAN_CNT + \
> > + AT91_SAMA5D2_DIFF_CHAN_CNT * 2)
> > +#define AT91_SAMA5D2_TOUCH_Y_CHAN_IDX (AT91_SAMA5D2_TOUCH_X_CHAN_IDX + 1)
> > +#define AT91_SAMA5D2_TOUCH_P_CHAN_IDX (AT91_SAMA5D2_TOUCH_Y_CHAN_IDX + 1)
> > +#define AT91_SAMA5D2_MAX_CHAN_IDX AT91_SAMA5D2_TOUCH_P_CHAN_IDX
> > +
> > +#define AT91_SAMA5D2_TOUCH_SAMPLE_PERIOD_US 2000 /* 2ms */
> > +#define AT91_SAMA5D2_TOUCH_PEN_DETECT_DEBOUNCE_US 200
> > +
> > +#define AT91_SAMA5D2_XYZ_MASK GENMASK(11, 0)
> > +
> > +#define AT91_SAMA5D2_MAX_POS_BITS 12
> > +
> > /*
> > * Maximum number of bytes to hold conversion from all channels
> > * without the timestamp.
> > @@ -222,6 +286,37 @@
> > .indexed = 1, \
> > }
> >
> > +#define AT91_SAMA5D2_CHAN_TOUCH(num, name, mod) \
> > + { \
> > + .type = IIO_POSITIONRELATIVE, \
> > + .modified = 1, \
> > + .channel = num, \
> > + .channel2 = mod, \
> > + .scan_index = num, \
> > + .scan_type = { \
> > + .sign = 'u', \
> > + .realbits = 12, \
> > + .storagebits = 16, \
> > + }, \
> > + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
> > + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),\
> > + .datasheet_name = name, \
> > + }
> > +#define AT91_SAMA5D2_CHAN_PRESSURE(num, name) \
> > + { \
> > + .type = IIO_PRESSURE, \
> > + .channel = num, \
> > + .scan_index = num, \
> > + .scan_type = { \
> > + .sign = 'u', \
> > + .realbits = 12, \
> > + .storagebits = 16, \
> > + }, \
> > + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
> > + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),\
> > + .datasheet_name = name, \
> > + }
> > +
> > #define at91_adc_readl(st, reg) readl_relaxed(st->base + reg)
> > #define at91_adc_writel(st, reg, val) writel_relaxed(val, st->base + reg)
> >
> > @@ -260,6 +355,22 @@ struct at91_adc_dma {
> > s64 dma_ts;
> > };
> >
> > +/**
> > + * at91_adc_touch - at91-sama5d2 touchscreen information struct
> > + * @sample_period_val: the value for periodic trigger interval
> > + * @touching: is the pen touching the screen or not
> > + * @x_pos: temporary placeholder for pressure computation
> > + * @channels_bitmask: bitmask with the touchscreen channels enabled
> > + * @workq: workqueue for buffer data pushing
> > + */
> > +struct at91_adc_touch {
> > + u16 sample_period_val;
> > + bool touching;
> > + u16 x_pos;
> > + unsigned long channels_bitmask;
> > + struct work_struct workq;
> > +};
> > +
> > struct at91_adc_state {
> > void __iomem *base;
> > int irq;
> > @@ -267,6 +378,7 @@ struct at91_adc_state {
> > struct regulator *reg;
> > struct regulator *vref;
> > int vref_uv;
> > + unsigned int current_sample_rate;
> > struct iio_trigger *trig;
> > const struct at91_adc_trigger *selected_trig;
> > const struct iio_chan_spec *chan;
> > @@ -275,6 +387,7 @@ struct at91_adc_state {
> > struct at91_adc_soc_info soc_info;
> > wait_queue_head_t wq_data_available;
> > struct at91_adc_dma dma_st;
> > + struct at91_adc_touch touch_st;
> > u16 buffer[AT91_BUFFER_MAX_HWORDS];
> > /*
> > * lock to prevent concurrent 'single conversion' requests through
> > @@ -329,8 +442,10 @@ static const struct iio_chan_spec at91_adc_channels[] = {
> > AT91_SAMA5D2_CHAN_DIFF(6, 7, 0x68),
> > AT91_SAMA5D2_CHAN_DIFF(8, 9, 0x70),
> > AT91_SAMA5D2_CHAN_DIFF(10, 11, 0x78),
> > - IIO_CHAN_SOFT_TIMESTAMP(AT91_SAMA5D2_SINGLE_CHAN_CNT
> > - + AT91_SAMA5D2_DIFF_CHAN_CNT + 1),
> > + IIO_CHAN_SOFT_TIMESTAMP(AT91_SAMA5D2_TIMESTAMP_CHAN_IDX),
> > + AT91_SAMA5D2_CHAN_TOUCH(AT91_SAMA5D2_TOUCH_X_CHAN_IDX, "x", IIO_MOD_X),
> > + AT91_SAMA5D2_CHAN_TOUCH(AT91_SAMA5D2_TOUCH_Y_CHAN_IDX, "y", IIO_MOD_Y),
> > + AT91_SAMA5D2_CHAN_PRESSURE(AT91_SAMA5D2_TOUCH_P_CHAN_IDX, "pressure"),
> > };
> >
> > static int at91_adc_chan_xlate(struct iio_dev *indio_dev, int chan)
> > @@ -354,6 +469,160 @@ at91_adc_chan_get(struct iio_dev *indio_dev, int chan)
> > return indio_dev->channels + index;
> > }
> >
> > +static inline int at91_adc_of_xlate(struct iio_dev *indio_dev,
> > + const struct of_phandle_args *iiospec)
> > +{
> > + return at91_adc_chan_xlate(indio_dev, iiospec->args[0]);
> > +}
> > +
> > +static int at91_adc_configure_touch(struct at91_adc_state *st, bool state)
> > +{
> > + u32 clk_khz = st->current_sample_rate / 1000;
> > + int i = 0;
> > + u16 pendbc;
> > + u32 tsmr, acr;
> > +
> > + if (!state) {
> > + /* disabling touch IRQs and setting mode to no touch enabled */
> > + at91_adc_writel(st, AT91_SAMA5D2_IDR,
> > + AT91_SAMA5D2_IER_PEN | AT91_SAMA5D2_IER_NOPEN);
> > + at91_adc_writel(st, AT91_SAMA5D2_TSMR, 0);
> > + return 0;
> > + }
> > + /*
> > + * debounce time is in microseconds, we need it in milliseconds to
> > + * multiply with kilohertz, so, divide by 1000, but after the multiply.
> > + * round up to make sure pendbc is at least 1
> > + */
> > + pendbc = round_up(AT91_SAMA5D2_TOUCH_PEN_DETECT_DEBOUNCE_US *
> > + clk_khz / 1000, 1);
> > +
> > + /* get the required exponent */
> > + while (pendbc >> i++)
> > + ;
> > +
> > + pendbc = i;
> > +
> > + tsmr = AT91_SAMA5D2_TSMR_TSMODE_4WIRE_PRESS;
> > +
> > + tsmr |= AT91_SAMA5D2_TSMR_TSAV(2) & AT91_SAMA5D2_TSMR_TSAV_MASK;
> > + tsmr |= AT91_SAMA5D2_TSMR_PENDBC(pendbc) &
> > + AT91_SAMA5D2_TSMR_PENDBC_MASK;
> > + tsmr |= AT91_SAMA5D2_TSMR_NOTSDMA;
> > + tsmr |= AT91_SAMA5D2_TSMR_PENDET_ENA;
> > + tsmr |= AT91_SAMA5D2_TSMR_TSFREQ(2) & AT91_SAMA5D2_TSMR_TSFREQ_MASK;
> > +
> > + at91_adc_writel(st, AT91_SAMA5D2_TSMR, tsmr);
> > +
> > + acr = at91_adc_readl(st, AT91_SAMA5D2_ACR);
> > + acr &= ~AT91_SAMA5D2_ACR_PENDETSENS_MASK;
> > + acr |= 0x02 & AT91_SAMA5D2_ACR_PENDETSENS_MASK;
> > + at91_adc_writel(st, AT91_SAMA5D2_ACR, acr);
> > +
> > + /* Sample Period Time = (TRGPER + 1) / ADCClock */
> > + st->touch_st.sample_period_val =
> > + round_up((AT91_SAMA5D2_TOUCH_SAMPLE_PERIOD_US *
> > + clk_khz / 1000) - 1, 1);
> > + /* enable pen detect IRQ */
> > + at91_adc_writel(st, AT91_SAMA5D2_IER, AT91_SAMA5D2_IER_PEN);
> > +
> > + return 0;
> > +}
> > +
> > +static u16 at91_adc_touch_pos(struct at91_adc_state *st, int reg)
> > +{
> > + u32 val;
> > + u32 scale, result, pos;
> > +
> > + /*
> > + * to obtain the actual position we must divide by scale
> > + * and multiply with max, where
> > + * max = 2^AT91_SAMA5D2_MAX_POS_BITS - 1
> > + */
> > + /* first half of register is the x or y, second half is the scale */
> > + val = at91_adc_readl(st, reg);
> > + if (!val)
> > + dev_dbg(&iio_priv_to_dev(st)->dev, "pos is 0\n");
> > +
> > + pos = val & AT91_SAMA5D2_XYZ_MASK;
> > + result = (pos << AT91_SAMA5D2_MAX_POS_BITS) - pos;
> > + scale = (val >> 16) & AT91_SAMA5D2_XYZ_MASK;
> > + if (scale == 0) {
> > + dev_err(&iio_priv_to_dev(st)->dev, "scale is 0\n");
> > + return 0;
> > + }
> > + result /= scale;
> > +
> > + return result;
> > +}
> > +
> > +static u16 at91_adc_touch_x_pos(struct at91_adc_state *st)
> > +{
> > + st->touch_st.x_pos = at91_adc_touch_pos(st, AT91_SAMA5D2_XPOSR);
> > + return st->touch_st.x_pos;
> > +}
> > +
> > +static u16 at91_adc_touch_y_pos(struct at91_adc_state *st)
> > +{
> > + return at91_adc_touch_pos(st, AT91_SAMA5D2_YPOSR);
> > +}
> > +
> > +static u16 at91_adc_touch_pressure(struct at91_adc_state *st)
> > +{
> > + u32 val;
> > + u32 z1, z2;
> > + u32 pres;
> > + u32 rxp = 1;
> > + u32 factor = 1000;
> > +
> > + /* calculate the pressure */
> > + val = at91_adc_readl(st, AT91_SAMA5D2_PRESSR);
> > + z1 = val & AT91_SAMA5D2_XYZ_MASK;
> > + z2 = (val >> 16) & AT91_SAMA5D2_XYZ_MASK;
> > +
> > + if (z1 != 0)
> > + pres = rxp * (st->touch_st.x_pos * factor / 1024) *
> > + (z2 * factor / z1 - factor) /
> > + factor;
> > + else
> > + pres = 0xFFFF; /* no pen contact */
> > +
> > + /*
> > + * The pressure from device grows down, minimum is 0xFFFF, maximum 0x0.
> > + * We compute it this way, but let's return it in the expected way,
> > + * growing from 0 to 0xFFFF.
> > + */
> > + return 0xFFFF - pres;
> > +}
> > +
> > +static int at91_adc_read_position(struct at91_adc_state *st, int chan, u16 *val)
> > +{
> > + *val = 0;
> > + if (!st->touch_st.touching)
> > + return -ENODATA;
> > + if (chan == AT91_SAMA5D2_TOUCH_X_CHAN_IDX)
> > + *val = at91_adc_touch_x_pos(st);
> > + else if (chan == AT91_SAMA5D2_TOUCH_Y_CHAN_IDX)
> > + *val = at91_adc_touch_y_pos(st);
> > + else
> > + return -ENODATA;
> > +
> > + return IIO_VAL_INT;
> > +}
> > +
> > +static int at91_adc_read_pressure(struct at91_adc_state *st, int chan, u16 *val)
> > +{
> > + *val = 0;
> > + if (!st->touch_st.touching)
> > + return -ENODATA;
> > + if (chan == AT91_SAMA5D2_TOUCH_P_CHAN_IDX)
> > + *val = at91_adc_touch_pressure(st);
> > + else
> > + return -ENODATA;
> > +
> > + return IIO_VAL_INT;
> > +}
> > +
> > static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
> > {
> > struct iio_dev *indio = iio_trigger_get_drvdata(trig);
> > @@ -375,6 +644,11 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
> >
> > if (!chan)
> > continue;
> > + /* these channel types cannot be handled by this trigger */
> > + if (chan->type == IIO_POSITIONRELATIVE ||
> > + chan->type == IIO_PRESSURE)
> > + continue;
> > +
> > if (state) {
> > at91_adc_writel(st, AT91_SAMA5D2_CHER,
> > BIT(chan->channel));
> > @@ -520,7 +794,20 @@ static int at91_adc_dma_start(struct iio_dev *indio_dev)
> > static int at91_adc_buffer_postenable(struct iio_dev *indio_dev)
> > {
> > int ret;
> > + struct at91_adc_state *st = iio_priv(indio_dev);
> >
> > + /* check if we are enabling triggered buffer or the touchscreen */
> > + if (bitmap_subset(indio_dev->active_scan_mask,
> > + &st->touch_st.channels_bitmask,
> > + AT91_SAMA5D2_MAX_CHAN_IDX + 1)) {
> > + /* touchscreen enabling */
> > + return at91_adc_configure_touch(st, true);
> > + }
> > + /* if we are not in triggered mode, we cannot enable the buffer. */
> > + if (!(indio_dev->currentmode & INDIO_ALL_TRIGGERED_MODES))
> > + return -EINVAL;
> > +
> > + /* we continue with the triggered buffer */
> > ret = at91_adc_dma_start(indio_dev);
> > if (ret) {
> > dev_err(&indio_dev->dev, "buffer postenable failed\n");
> > @@ -536,6 +823,18 @@ static int at91_adc_buffer_predisable(struct iio_dev *indio_dev)
> > int ret;
> > u8 bit;
> >
> > + /* check if we are disabling triggered buffer or the touchscreen */
> > + if (bitmap_subset(indio_dev->active_scan_mask,
> > + &st->touch_st.channels_bitmask,
> > + AT91_SAMA5D2_MAX_CHAN_IDX + 1)) {
> > + /* touchscreen disable */
> > + return at91_adc_configure_touch(st, false);
> > + }
> > + /* if we are not in triggered mode, nothing to do here */
> > + if (!(indio_dev->currentmode & INDIO_ALL_TRIGGERED_MODES))
> > + return -EINVAL;
> > +
> > + /* continue with the triggered buffer */
> > ret = iio_triggered_buffer_predisable(indio_dev);
> > if (ret < 0)
> > dev_err(&indio_dev->dev, "buffer predisable failed\n");
> > @@ -558,6 +857,10 @@ static int at91_adc_buffer_predisable(struct iio_dev *indio_dev)
> >
> > if (!chan)
> > continue;
> > + /* these channel types are virtual, no need to do anything */
> > + if (chan->type == IIO_POSITIONRELATIVE ||
> > + chan->type == IIO_PRESSURE)
> > + continue;
> > if (st->dma_st.dma_chan)
> > at91_adc_readl(st, chan->address);
> > }
> > @@ -622,7 +925,22 @@ static void at91_adc_trigger_handler_nodma(struct iio_dev *indio_dev,
> >
> > if (!chan)
> > continue;
> > - st->buffer[i] = at91_adc_readl(st, chan->address);
> > + /*
> > + * Our external trigger only supports the voltage channels.
> > + * In case someone requested a different type of channel
> > + * just put zeroes to buffer.
> > + * This should not happen because we check the scan mode
> > + * and scan mask when we enable the buffer, and we don't allow
> > + * the buffer to start with a mixed mask (voltage and something
> > + * else).
> > + * Thus, emit a warning.
> > + */
> > + if (chan->type == IIO_VOLTAGE) {
> > + st->buffer[i] = at91_adc_readl(st, chan->address);
> > + } else {
> > + st->buffer[i] = 0;
> > + WARN(true, "This trigger cannot handle this type of channel");
> > + }
> > i++;
> > }
> > iio_push_to_buffers_with_timestamp(indio_dev, st->buffer,
> > @@ -688,9 +1006,20 @@ static irqreturn_t at91_adc_trigger_handler(int irq, void *p)
> >
> > static int at91_adc_buffer_init(struct iio_dev *indio)
> > {
> > - return devm_iio_triggered_buffer_setup(&indio->dev, indio,
> > + struct at91_adc_state *st = iio_priv(indio);
> > +
> > + if (st->selected_trig->hw_trig) {
> > + return devm_iio_triggered_buffer_setup(&indio->dev, indio,
> > &iio_pollfunc_store_time,
> > &at91_adc_trigger_handler, &at91_buffer_setup_ops);
> > + }
> > + /*
> > + * we need to prepare the buffer ops in case we will get
> > + * another buffer attached (like a callback buffer for the touchscreen)
> > + */
> > + indio->setup_ops = &at91_buffer_setup_ops;
> > +
> > + return 0;
> > }
> >
> > static unsigned at91_adc_startup_time(unsigned startup_time_min,
> > @@ -736,19 +1065,83 @@ static void at91_adc_setup_samp_freq(struct at91_adc_state *st, unsigned freq)
> >
> > dev_dbg(&indio_dev->dev, "freq: %u, startup: %u, prescal: %u\n",
> > freq, startup, prescal);
> > + st->current_sample_rate = freq;
> > }
> >
> > -static unsigned at91_adc_get_sample_freq(struct at91_adc_state *st)
> > +static inline unsigned at91_adc_get_sample_freq(struct at91_adc_state *st)
> > {
> > - unsigned f_adc, f_per = clk_get_rate(st->per_clk);
> > - unsigned mr, prescal;
> > + return st->current_sample_rate;
> > +}
> >
> > - mr = at91_adc_readl(st, AT91_SAMA5D2_MR);
> > - prescal = (mr >> AT91_SAMA5D2_MR_PRESCAL_OFFSET)
> > - & AT91_SAMA5D2_MR_PRESCAL_MAX;
> > - f_adc = f_per / (2 * (prescal + 1));
> > +static void at91_adc_touch_data_handler(struct iio_dev *indio_dev)
> > +{
> > + struct at91_adc_state *st = iio_priv(indio_dev);
> > + u8 bit;
> > + u16 val;
> > + int i = 0;
> >
> > - return f_adc;
> > + for_each_set_bit(bit, indio_dev->active_scan_mask,
> > + AT91_SAMA5D2_MAX_CHAN_IDX + 1) {
> > + struct iio_chan_spec const *chan =
> > + at91_adc_chan_get(indio_dev, bit);
> > +
> > + if (chan->type == IIO_POSITIONRELATIVE)
> > + at91_adc_read_position(st, chan->channel, &val);
> > + else if (chan->type == IIO_PRESSURE)
> > + at91_adc_read_pressure(st, chan->channel, &val);
> > + else
> > + continue;
> > + st->buffer[i] = val;
> > + i++;
> > + }
> > + /*
> > + * Schedule work to push to buffers.
> > + * This is intended to push to the callback buffer that another driver
> > + * registered. We are still in a handler from our IRQ. If we push
> > + * directly, it means the other driver has it's callback called
> > + * from our IRQ context. Which is something we better avoid.
> > + * Let's schedule it after our IRQ is completed.
> > + */
> > + schedule_work(&st->touch_st.workq);
> > +}
> > +
> > +static void at91_adc_pen_detect_interrupt(struct at91_adc_state *st)
> > +{
> > + at91_adc_writel(st, AT91_SAMA5D2_IDR, AT91_SAMA5D2_IER_PEN);
> > + at91_adc_writel(st, AT91_SAMA5D2_IER, AT91_SAMA5D2_IER_NOPEN |
> > + AT91_SAMA5D2_IER_XRDY | AT91_SAMA5D2_IER_YRDY |
> > + AT91_SAMA5D2_IER_PRDY);
> > + at91_adc_writel(st, AT91_SAMA5D2_TRGR,
> > + AT91_SAMA5D2_TRGR_TRGMOD_PERIODIC |
> > + AT91_SAMA5D2_TRGR_TRGPER(st->touch_st.sample_period_val));
> > + st->touch_st.touching = true;
> > +}
> > +
> > +static void at91_adc_no_pen_detect_interrupt(struct at91_adc_state *st)
> > +{
> > + struct iio_dev *indio_dev = iio_priv_to_dev(st);
> > +
> > + at91_adc_writel(st, AT91_SAMA5D2_TRGR,
> > + AT91_SAMA5D2_TRGR_TRGMOD_NO_TRIGGER);
> > + at91_adc_writel(st, AT91_SAMA5D2_IDR, AT91_SAMA5D2_IER_NOPEN |
> > + AT91_SAMA5D2_IER_XRDY | AT91_SAMA5D2_IER_YRDY |
> > + AT91_SAMA5D2_IER_PRDY);
> > + st->touch_st.touching = false;
> > +
> > + at91_adc_touch_data_handler(indio_dev);
> > +
> > + at91_adc_writel(st, AT91_SAMA5D2_IER, AT91_SAMA5D2_IER_PEN);
> > +}
> > +
> > +static void at91_adc_workq_handler(struct work_struct *workq)
> > +{
> > + struct at91_adc_touch *touch_st = container_of(workq,
> > + struct at91_adc_touch, workq);
> > + struct at91_adc_state *st = container_of(touch_st,
> > + struct at91_adc_state, touch_st);
> > + struct iio_dev *indio_dev = iio_priv_to_dev(st);
> > +
> > + iio_push_to_buffers(indio_dev, st->buffer);
> > }
> >
> > static irqreturn_t at91_adc_interrupt(int irq, void *private)
> > @@ -757,17 +1150,39 @@ static irqreturn_t at91_adc_interrupt(int irq, void *private)
> > struct at91_adc_state *st = iio_priv(indio);
> > u32 status = at91_adc_readl(st, AT91_SAMA5D2_ISR);
> > u32 imr = at91_adc_readl(st, AT91_SAMA5D2_IMR);
> > + u32 rdy_mask = AT91_SAMA5D2_IER_XRDY | AT91_SAMA5D2_IER_YRDY |
> > + AT91_SAMA5D2_IER_PRDY;
> >
> > if (!(status & imr))
> > return IRQ_NONE;
> > -
> > - if (iio_buffer_enabled(indio) && !st->dma_st.dma_chan) {
> > + if (status & AT91_SAMA5D2_IER_PEN) {
> > + /* pen detected IRQ */
> > + at91_adc_pen_detect_interrupt(st);
> > + } else if ((status & AT91_SAMA5D2_IER_NOPEN)) {
> > + /* nopen detected IRQ */
> > + at91_adc_no_pen_detect_interrupt(st);
> > + } else if ((status & AT91_SAMA5D2_ISR_PENS) &&
> > + ((status & rdy_mask) == rdy_mask)) {
> > + /* periodic trigger IRQ - during pen sense */
> > + at91_adc_touch_data_handler(indio);
> > + } else if (status & AT91_SAMA5D2_ISR_PENS) {
> > + /*
> > + * touching, but the measurements are not ready yet.
> > + * read and ignore.
> > + */
> > + status = at91_adc_readl(st, AT91_SAMA5D2_XPOSR);
> > + status = at91_adc_readl(st, AT91_SAMA5D2_YPOSR);
> > + status = at91_adc_readl(st, AT91_SAMA5D2_PRESSR);
> > + } else if (iio_buffer_enabled(indio) && !st->dma_st.dma_chan) {
> > + /* triggered buffer without DMA */
> > disable_irq_nosync(irq);
> > iio_trigger_poll(indio->trig);
> > } else if (iio_buffer_enabled(indio) && st->dma_st.dma_chan) {
> > + /* triggered buffer with DMA - should not happen */
> > disable_irq_nosync(irq);
> > WARN(true, "Unexpected irq occurred\n");
> > } else if (!iio_buffer_enabled(indio)) {
> > + /* software requested conversion */
> > st->conversion_value = at91_adc_readl(st, st->chan->address);
> > st->conversion_done = true;
> > wake_up_interruptible(&st->wq_data_available);
> > @@ -775,58 +1190,97 @@ static irqreturn_t at91_adc_interrupt(int irq, void *private)
> > return IRQ_HANDLED;
> > }
> >
> > -static int at91_adc_read_raw(struct iio_dev *indio_dev,
> > - struct iio_chan_spec const *chan,
> > - int *val, int *val2, long mask)
> > +static int at91_adc_read_info_raw(struct iio_dev *indio_dev,
> > + struct iio_chan_spec const *chan, int *val)
> > {
> > struct at91_adc_state *st = iio_priv(indio_dev);
> > u32 cor = 0;
> > int ret;
> >
> > - switch (mask) {
> > - case IIO_CHAN_INFO_RAW:
> > - /* we cannot use software trigger if hw trigger enabled */
> > + /*
> > + * Keep in mind that we cannot use software trigger or touchscreen
> > + * if external trigger is enabled
> > + */
> > + if (chan->type == IIO_POSITIONRELATIVE) {
> > ret = iio_device_claim_direct_mode(indio_dev);
> > if (ret)
> > return ret;
> > mutex_lock(&st->lock);
> >
> > - st->chan = chan;
> > + ret = at91_adc_read_position(st, chan->channel,
> > + (u16 *)val);
> > + mutex_unlock(&st->lock);
> > + iio_device_release_direct_mode(indio_dev);
> >
> > - if (chan->differential)
> > - cor = (BIT(chan->channel) | BIT(chan->channel2)) <<
> > - AT91_SAMA5D2_COR_DIFF_OFFSET;
> > -
> > - at91_adc_writel(st, AT91_SAMA5D2_COR, cor);
> > - at91_adc_writel(st, AT91_SAMA5D2_CHER, BIT(chan->channel));
> > - at91_adc_writel(st, AT91_SAMA5D2_IER, BIT(chan->channel));
> > - at91_adc_writel(st, AT91_SAMA5D2_CR, AT91_SAMA5D2_CR_START);
> > -
> > - ret = wait_event_interruptible_timeout(st->wq_data_available,
> > - st->conversion_done,
> > - msecs_to_jiffies(1000));
> > - if (ret == 0)
> > - ret = -ETIMEDOUT;
> > -
> > - if (ret > 0) {
> > - *val = st->conversion_value;
> > - if (chan->scan_type.sign == 's')
> > - *val = sign_extend32(*val, 11);
> > - ret = IIO_VAL_INT;
> > - st->conversion_done = false;
> > - }
> > + return ret;
> > + }
> > + if (chan->type == IIO_PRESSURE) {
> > + ret = iio_device_claim_direct_mode(indio_dev);
> > + if (ret)
> > + return ret;
> > + mutex_lock(&st->lock);
> >
> > - at91_adc_writel(st, AT91_SAMA5D2_IDR, BIT(chan->channel));
> > - at91_adc_writel(st, AT91_SAMA5D2_CHDR, BIT(chan->channel));
> > + ret = at91_adc_read_pressure(st, chan->channel,
> > + (u16 *)val);
> > + mutex_unlock(&st->lock);
> > + iio_device_release_direct_mode(indio_dev);
> >
> > - /* Needed to ACK the DRDY interruption */
> > - at91_adc_readl(st, AT91_SAMA5D2_LCDR);
> > + return ret;
> > + }
> >
> > - mutex_unlock(&st->lock);
> > + /* in this case we have a voltage channel */
> >
> > - iio_device_release_direct_mode(indio_dev);
> > + ret = iio_device_claim_direct_mode(indio_dev);
> > + if (ret)
> > return ret;
> > + mutex_lock(&st->lock);
> > +
> > + st->chan = chan;
> > +
> > + if (chan->differential)
> > + cor = (BIT(chan->channel) | BIT(chan->channel2)) <<
> > + AT91_SAMA5D2_COR_DIFF_OFFSET;
> > +
> > + at91_adc_writel(st, AT91_SAMA5D2_COR, cor);
> > + at91_adc_writel(st, AT91_SAMA5D2_CHER, BIT(chan->channel));
> > + at91_adc_writel(st, AT91_SAMA5D2_IER, BIT(chan->channel));
> > + at91_adc_writel(st, AT91_SAMA5D2_CR, AT91_SAMA5D2_CR_START);
> > +
> > + ret = wait_event_interruptible_timeout(st->wq_data_available,
> > + st->conversion_done,
> > + msecs_to_jiffies(1000));
> > + if (ret == 0)
> > + ret = -ETIMEDOUT;
> > +
> > + if (ret > 0) {
> > + *val = st->conversion_value;
> > + if (chan->scan_type.sign == 's')
> > + *val = sign_extend32(*val, 11);
> > + ret = IIO_VAL_INT;
> > + st->conversion_done = false;
> > + }
> > +
> > + at91_adc_writel(st, AT91_SAMA5D2_IDR, BIT(chan->channel));
> > + at91_adc_writel(st, AT91_SAMA5D2_CHDR, BIT(chan->channel));
> > +
> > + /* Needed to ACK the DRDY interruption */
> > + at91_adc_readl(st, AT91_SAMA5D2_LCDR);
> > +
> > + mutex_unlock(&st->lock);
> > +
> > + iio_device_release_direct_mode(indio_dev);
> > + return ret;
> > +}
> > +
> > +static int at91_adc_read_raw(struct iio_dev *indio_dev,
> > + struct iio_chan_spec const *chan,
> > + int *val, int *val2, long mask)
> > +{
> > + struct at91_adc_state *st = iio_priv(indio_dev);
> >
> > + switch (mask) {
> > + case IIO_CHAN_INFO_RAW:
> > + return at91_adc_read_info_raw(indio_dev, chan, val);
> > case IIO_CHAN_INFO_SCALE:
> > *val = st->vref_uv / 1000;
> > if (chan->differential)
> > @@ -974,9 +1428,29 @@ static int at91_adc_set_watermark(struct iio_dev *indio_dev, unsigned int val)
> > return 0;
> > }
> >
> > +static int at91_adc_update_scan_mode(struct iio_dev *indio_dev,
> > + const unsigned long *scan_mask)
> > +{
> > + struct at91_adc_state *st = iio_priv(indio_dev);
> > +
> > + if (bitmap_subset(scan_mask, &st->touch_st.channels_bitmask,
> > + AT91_SAMA5D2_MAX_CHAN_IDX + 1))
> > + return 0;
> > + /*
> > + * if the new bitmap is a combination of touchscreen and regular
> > + * channels, then we are not fine
> > + */
> > + if (bitmap_intersects(&st->touch_st.channels_bitmask, scan_mask,
> > + AT91_SAMA5D2_MAX_CHAN_IDX + 1))
> > + return -EINVAL;
> > + return 0;
> > +}
> > +
> > static const struct iio_info at91_adc_info = {
> > .read_raw = &at91_adc_read_raw,
> > .write_raw = &at91_adc_write_raw,
> > + .update_scan_mode = &at91_adc_update_scan_mode,
> > + .of_xlate = &at91_adc_of_xlate,
> > .hwfifo_set_watermark = &at91_adc_set_watermark,
> > };
> >
> > @@ -1044,13 +1518,20 @@ static int at91_adc_probe(struct platform_device *pdev)
> >
> > indio_dev->dev.parent = &pdev->dev;
> > indio_dev->name = dev_name(&pdev->dev);
> > - indio_dev->modes = INDIO_DIRECT_MODE;
> > + indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_SOFTWARE;
> > indio_dev->info = &at91_adc_info;
> > indio_dev->channels = at91_adc_channels;
> > indio_dev->num_channels = ARRAY_SIZE(at91_adc_channels);
> >
> > st = iio_priv(indio_dev);
> >
> > + bitmap_set(&st->touch_st.channels_bitmask,
> > + AT91_SAMA5D2_TOUCH_X_CHAN_IDX, 1);
> > + bitmap_set(&st->touch_st.channels_bitmask,
> > + AT91_SAMA5D2_TOUCH_Y_CHAN_IDX, 1);
> > + bitmap_set(&st->touch_st.channels_bitmask,
> > + AT91_SAMA5D2_TOUCH_P_CHAN_IDX, 1);
> > +
> > ret = of_property_read_u32(pdev->dev.of_node,
> > "atmel,min-sample-rate-hz",
> > &st->soc_info.min_sample_rate);
> > @@ -1100,6 +1581,7 @@ static int at91_adc_probe(struct platform_device *pdev)
> >
> > init_waitqueue_head(&st->wq_data_available);
> > mutex_init(&st->lock);
> > + INIT_WORK(&st->touch_st.workq, at91_adc_workq_handler);
> >
> > res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > if (!res)
> > @@ -1159,13 +1641,13 @@ static int at91_adc_probe(struct platform_device *pdev)
> >
> > platform_set_drvdata(pdev, indio_dev);
> >
> > - if (st->selected_trig->hw_trig) {
> > - ret = at91_adc_buffer_init(indio_dev);
> > - if (ret < 0) {
> > - dev_err(&pdev->dev, "couldn't initialize the buffer.\n");
> > - goto per_clk_disable_unprepare;
> > - }
> > + ret = at91_adc_buffer_init(indio_dev);
> > + if (ret < 0) {
> > + dev_err(&pdev->dev, "couldn't initialize the buffer.\n");
> > + goto per_clk_disable_unprepare;
> > + }
> >
> > + if (st->selected_trig->hw_trig) {
> > ret = at91_adc_trigger_init(indio_dev);
> > if (ret < 0) {
> > dev_err(&pdev->dev, "couldn't setup the triggers.\n");
> > @@ -1272,9 +1754,20 @@ static __maybe_unused int at91_adc_resume(struct device *dev)
> > at91_adc_hw_init(st);
> >
> > /* reconfiguring trigger hardware state */
> > - if (iio_buffer_enabled(indio_dev))
> > - at91_adc_configure_trigger(st->trig, true);
> > + if (!iio_buffer_enabled(indio_dev))
> > + return 0;
> > +
> > + /* check if we are enabling triggered buffer or the touchscreen */
> > + if (bitmap_subset(indio_dev->active_scan_mask,
> > + &st->touch_st.channels_bitmask,
> > + AT91_SAMA5D2_MAX_CHAN_IDX + 1)) {
> > + /* touchscreen enabling */
> > + return at91_adc_configure_touch(st, true);
> > + } else {
> > + return at91_adc_configure_trigger(st->trig, true);
> > + }
> >
> > + /* not needed but more explicit */
> > return 0;
> >
> > vref_disable_resume:
> > --
> > 2.7.4
> >
^ permalink raw reply
* [PATCH v7 6/9] input: touchscreen: resistive-adc-touch: add generic resistive ADC touchscreen
From: Jonathan Cameron @ 2018-06-10 12:33 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1526975559-18966-7-git-send-email-eugen.hristev@microchip.com>
On Tue, 22 May 2018 10:52:36 +0300
Eugen Hristev <eugen.hristev@microchip.com> wrote:
> This adds a generic resistive touchscreen (GRTS) driver, which is based
> on an IIO device (an ADC). It must be connected to the channels of an ADC
> to receive touch data. Then it will feed the data into the input subsystem
> where it registers an input device.
> It uses an IIO callback buffer to register to the IIO device
>
> Some parts of this patch are based on initial original work by
> Mohamed Jamsheeth Hajanajubudeen and Bandaru Venkateswara Swamy
>
> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.
Thanks,
Jonathan
> ---
> Changes in v7:
> - cosmetic fixes as suggested by Dmitry: moved min pressure
> property lookup below and only if pressure channel is available.
> used the error variable in probe at some point, removed it at
> different point.
>
> Changes in v6:
> - changed a dev_err to dev_dbg which was forgotten in v5.
>
> Changes in v5:
> - return error on probe if failed add_action_or_reset
> - renamed property touchscreen-threshold-pressure to
> touchscreen-min-pressure, changed variables accordingly
>
> Changes in v4:
> - added a small description in file header
> - changed MAX_POS_MASK to GRTS_MAX_POS_MASK
> - initialized press with 0, as this value means no touch.
> press has to be initialized because compiler/checkpatch complains
> that can be used uninitialized.
> - changed of_property_read_u32 to device_*
> - set_abs_params for pressure will have range according to threshold
> - changed evbit and keybit with set_capability call
> - changed variable names to error instead of ret
> - checked errors for add_action_or_reset
> - cosmetic cleaning
>
> Changes in v3:
> - pressure now reported naturally growing down-up
> - using helpers from touchscreen.h to parse DT properties
> - added devm_add_action_or_reset to handle callback buffer clean on exit
> - changed compatible and threshold property to adapt to changed bindings
>
> Changes in v2:
> - this is now a generic resistive adc touchscreen driver
>
> drivers/input/touchscreen/Kconfig | 13 ++
> drivers/input/touchscreen/Makefile | 1 +
> drivers/input/touchscreen/resistive-adc-touch.c | 204 ++++++++++++++++++++++++
> 3 files changed, 218 insertions(+)
> create mode 100644 drivers/input/touchscreen/resistive-adc-touch.c
>
> diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
> index 4f15496..8f85d3a 100644
> --- a/drivers/input/touchscreen/Kconfig
> +++ b/drivers/input/touchscreen/Kconfig
> @@ -92,6 +92,19 @@ config TOUCHSCREEN_AD7879_SPI
> To compile this driver as a module, choose M here: the
> module will be called ad7879-spi.
>
> +config TOUCHSCREEN_ADC
> + tristate "Generic ADC based resistive touchscreen"
> + depends on IIO
> + select IIO_BUFFER_CB
> + help
> + Say Y here if you want to use the generic ADC
> + resistive touchscreen driver.
> +
> + If unsure, say N (but it's safe to say "Y").
> +
> + To compile this driver as a module, choose M here: the
> + module will be called resistive-adc-touch.ko.
> +
> config TOUCHSCREEN_AR1021_I2C
> tristate "Microchip AR1020/1021 i2c touchscreen"
> depends on I2C && OF
> diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
> index dddae79..843c7f9 100644
> --- a/drivers/input/touchscreen/Makefile
> +++ b/drivers/input/touchscreen/Makefile
> @@ -13,6 +13,7 @@ obj-$(CONFIG_TOUCHSCREEN_AD7877) += ad7877.o
> obj-$(CONFIG_TOUCHSCREEN_AD7879) += ad7879.o
> obj-$(CONFIG_TOUCHSCREEN_AD7879_I2C) += ad7879-i2c.o
> obj-$(CONFIG_TOUCHSCREEN_AD7879_SPI) += ad7879-spi.o
> +obj-$(CONFIG_TOUCHSCREEN_ADC) += resistive-adc-touch.o
> obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o
> obj-$(CONFIG_TOUCHSCREEN_AR1021_I2C) += ar1021_i2c.o
> obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += atmel_mxt_ts.o
> diff --git a/drivers/input/touchscreen/resistive-adc-touch.c b/drivers/input/touchscreen/resistive-adc-touch.c
> new file mode 100644
> index 0000000..cfc8bb4
> --- /dev/null
> +++ b/drivers/input/touchscreen/resistive-adc-touch.c
> @@ -0,0 +1,204 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * ADC generic resistive touchscreen (GRTS)
> + * This is a generic input driver that connects to an ADC
> + * given the channels in device tree, and reports events to the input
> + * subsystem.
> + *
> + * Copyright (C) 2017,2018 Microchip Technology,
> + * Author: Eugen Hristev <eugen.hristev@microchip.com>
> + *
> + */
> +#include <linux/input.h>
> +#include <linux/input/touchscreen.h>
> +#include <linux/iio/consumer.h>
> +#include <linux/iio/iio.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/platform_device.h>
> +
> +#define DRIVER_NAME "resistive-adc-touch"
> +#define GRTS_DEFAULT_PRESSURE_MIN 50000
> +#define GRTS_MAX_POS_MASK GENMASK(11, 0)
> +
> +/**
> + * grts_state - generic resistive touch screen information struct
> + * @pressure_min: number representing the minimum for the pressure
> + * @pressure: are we getting pressure info or not
> + * @iio_chans: list of channels acquired
> + * @iio_cb: iio_callback buffer for the data
> + * @input: the input device structure that we register
> + * @prop: touchscreen properties struct
> + */
> +struct grts_state {
> + u32 pressure_min;
> + bool pressure;
> + struct iio_channel *iio_chans;
> + struct iio_cb_buffer *iio_cb;
> + struct input_dev *input;
> + struct touchscreen_properties prop;
> +};
> +
> +static int grts_cb(const void *data, void *private)
> +{
> + const u16 *touch_info = data;
> + struct grts_state *st = private;
> + unsigned int x, y, press = 0x0;
> +
> + /* channel data coming in buffer in the order below */
> + x = touch_info[0];
> + y = touch_info[1];
> + if (st->pressure)
> + press = touch_info[2];
> +
> + if ((!x && !y) || (st->pressure && (press < st->pressure_min))) {
> + /* report end of touch */
> + input_report_key(st->input, BTN_TOUCH, 0);
> + input_sync(st->input);
> + return 0;
> + }
> +
> + /* report proper touch to subsystem*/
> + touchscreen_report_pos(st->input, &st->prop, x, y, false);
> + if (st->pressure)
> + input_report_abs(st->input, ABS_PRESSURE, press);
> + input_report_key(st->input, BTN_TOUCH, 1);
> + input_sync(st->input);
> +
> + return 0;
> +}
> +
> +static int grts_open(struct input_dev *dev)
> +{
> + int error;
> + struct grts_state *st = input_get_drvdata(dev);
> +
> + error = iio_channel_start_all_cb(st->iio_cb);
> + if (error) {
> + dev_err(dev->dev.parent, "failed to start callback buffer.\n");
> + return error;
> + }
> + return 0;
> +}
> +
> +static void grts_close(struct input_dev *dev)
> +{
> + struct grts_state *st = input_get_drvdata(dev);
> +
> + iio_channel_stop_all_cb(st->iio_cb);
> +}
> +
> +static void grts_disable(void *data)
> +{
> + iio_channel_release_all_cb(data);
> +}
> +
> +static int grts_probe(struct platform_device *pdev)
> +{
> + struct grts_state *st;
> + struct input_dev *input;
> + struct device *dev = &pdev->dev;
> + struct iio_channel *chan;
> + int error;
> +
> + st = devm_kzalloc(dev, sizeof(struct grts_state), GFP_KERNEL);
> + if (!st)
> + return -ENOMEM;
> +
> + /* get the channels from IIO device */
> + st->iio_chans = devm_iio_channel_get_all(dev);
> + if (IS_ERR(st->iio_chans)) {
> + error = PTR_ERR(st->iio_chans);
> + if (error != -EPROBE_DEFER)
> + dev_err(dev, "can't get iio channels.\n");
> + return error;
> + }
> +
> + chan = &st->iio_chans[0];
> + st->pressure = false;
> + while (chan && chan->indio_dev) {
> + if (!strcmp(chan->channel->datasheet_name, "pressure"))
> + st->pressure = true;
> + chan++;
> + }
> +
> + if (st->pressure) {
> + error = device_property_read_u32(dev,
> + "touchscreen-min-pressure",
> + &st->pressure_min);
> + if (error) {
> + dev_dbg(dev, "can't get touchscreen-min-pressure property.\n");
> + st->pressure_min = GRTS_DEFAULT_PRESSURE_MIN;
> + }
> + }
> +
> + input = devm_input_allocate_device(dev);
> + if (!input) {
> + dev_err(dev, "failed to allocate input device.\n");
> + return -ENOMEM;
> + }
> +
> + input->name = DRIVER_NAME;
> + input->id.bustype = BUS_HOST;
> + input->open = grts_open;
> + input->close = grts_close;
> +
> + input_set_abs_params(input, ABS_X, 0, GRTS_MAX_POS_MASK - 1, 0, 0);
> + input_set_abs_params(input, ABS_Y, 0, GRTS_MAX_POS_MASK - 1, 0, 0);
> + if (st->pressure)
> + input_set_abs_params(input, ABS_PRESSURE, st->pressure_min,
> + 0xffff, 0, 0);
> +
> + input_set_capability(input, EV_KEY, BTN_TOUCH);
> +
> + /* parse optional device tree properties */
> + touchscreen_parse_properties(input, false, &st->prop);
> +
> + st->input = input;
> + input_set_drvdata(input, st);
> +
> + error = input_register_device(input);
> + if (error) {
> + dev_err(dev, "failed to register input device.");
> + return error;
> + }
> +
> + st->iio_cb = iio_channel_get_all_cb(dev, grts_cb, st);
> + if (IS_ERR(st->iio_cb)) {
> + dev_err(dev, "failed to allocate callback buffer.\n");
> + return PTR_ERR(st->iio_cb);
> + }
> +
> + error = devm_add_action_or_reset(dev, grts_disable, st->iio_cb);
> + if (error) {
> + dev_err(dev, "failed to add disable action.\n");
> + return error;
> + }
> +
> + return 0;
> +}
> +
> +static const struct of_device_id grts_of_match[] = {
> + {
> + .compatible = "resistive-adc-touch",
> + }, {
> + /* sentinel */
> + },
> +};
> +
> +MODULE_DEVICE_TABLE(of, grts_of_match);
> +
> +static struct platform_driver grts_driver = {
> + .probe = grts_probe,
> + .driver = {
> + .name = DRIVER_NAME,
> + .of_match_table = of_match_ptr(grts_of_match),
> + },
> +};
> +
> +module_platform_driver(grts_driver);
> +
> +MODULE_AUTHOR("Eugen Hristev <eugen.hristev@microchip.com>");
> +MODULE_DESCRIPTION("Generic ADC Resistive Touch Driver");
> +MODULE_LICENSE("GPL v2");
^ permalink raw reply
* [PATCH v7 7/9] dt-bindings: iio: adc: at91-sama5d2_adc: add channel specific consumer info
From: Jonathan Cameron @ 2018-06-10 12:34 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20180522122319.GN22971@rfolt0960.corp.atmel.com>
On Tue, 22 May 2018 14:23:19 +0200
Ludovic Desroches <ludovic.desroches@microchip.com> wrote:
> On Tue, May 22, 2018 at 10:52:37AM +0300, Eugen Hristev wrote:
> > Added defines for channel consumer device-tree binding
> >
> > Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> > Reviewed-by: Rob Herring <robh@kernel.org>
> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.
Thanks,
Jonathan
>
> > ---
> > .../devicetree/bindings/iio/adc/at91-sama5d2_adc.txt | 9 +++++++++
> > include/dt-bindings/iio/adc/at91-sama5d2_adc.h | 16 ++++++++++++++++
> > 2 files changed, 25 insertions(+)
> > create mode 100644 include/dt-bindings/iio/adc/at91-sama5d2_adc.h
> >
> > diff --git a/Documentation/devicetree/bindings/iio/adc/at91-sama5d2_adc.txt b/Documentation/devicetree/bindings/iio/adc/at91-sama5d2_adc.txt
> > index 6469a4c..4a3c1d4 100644
> > --- a/Documentation/devicetree/bindings/iio/adc/at91-sama5d2_adc.txt
> > +++ b/Documentation/devicetree/bindings/iio/adc/at91-sama5d2_adc.txt
> > @@ -21,6 +21,14 @@ Optional properties:
> > - dmas: Phandle to dma channel for the ADC.
> > - dma-names: Must be "rx" when dmas property is being used.
> > See ../../dma/dma.txt for details.
> > + - #io-channel-cells: in case consumer drivers are attached, this must be 1.
> > + See <Documentation/devicetree/bindings/iio/iio-bindings.txt> for details.
> > +
> > +Properties for consumer drivers:
> > + - Consumer drivers can be connected to this producer device, as specified
> > + in <Documentation/devicetree/bindings/iio/iio-bindings.txt>
> > + - Channels exposed are specified in:
> > + <dt-bindings/iio/adc/at91-sama5d2_adc.txt>
> >
> > Example:
> >
> > @@ -38,4 +46,5 @@ adc: adc at fc030000 {
> > atmel,trigger-edge-type = <IRQ_TYPE_EDGE_BOTH>;
> > dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) | AT91_XDMAC_DT_PERID(25))>;
> > dma-names = "rx";
> > + #io-channel-cells = <1>;
> > }
> > diff --git a/include/dt-bindings/iio/adc/at91-sama5d2_adc.h b/include/dt-bindings/iio/adc/at91-sama5d2_adc.h
> > new file mode 100644
> > index 0000000..70f99db
> > --- /dev/null
> > +++ b/include/dt-bindings/iio/adc/at91-sama5d2_adc.h
> > @@ -0,0 +1,16 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +/*
> > + * This header provides constants for configuring the AT91 SAMA5D2 ADC
> > + */
> > +
> > +#ifndef _DT_BINDINGS_IIO_ADC_AT91_SAMA5D2_ADC_H
> > +#define _DT_BINDINGS_IIO_ADC_AT91_SAMA5D2_ADC_H
> > +
> > +/* X relative position channel index */
> > +#define AT91_SAMA5D2_ADC_X_CHANNEL 24
> > +/* Y relative position channel index */
> > +#define AT91_SAMA5D2_ADC_Y_CHANNEL 25
> > +/* pressure channel index */
> > +#define AT91_SAMA5D2_ADC_P_CHANNEL 26
> > +
> > +#endif
> > --
> > 2.7.4
> >
^ permalink raw reply
* [PATCH v7 8/9] ARM: dts: at91: sama5d2: add channel cells for ADC device
From: Jonathan Cameron @ 2018-06-10 12:35 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1526975559-18966-9-git-send-email-eugen.hristev@microchip.com>
On Tue, 22 May 2018 10:52:38 +0300
Eugen Hristev <eugen.hristev@microchip.com> wrote:
> Preparing the ADC device to connect channel consumer drivers
>
> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
The driver for the touchscreen is no in the IIO tree, but it wasn't
early enough (due to a block on a fix working it's way in) for this
merge window. Will be going upstream in the next merge window.
Thanks,
Jonathan
> ---
> arch/arm/boot/dts/sama5d2.dtsi | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> index 61f68e5..f06ba99 100644
> --- a/arch/arm/boot/dts/sama5d2.dtsi
> +++ b/arch/arm/boot/dts/sama5d2.dtsi
> @@ -47,6 +47,7 @@
> #include <dt-bindings/dma/at91.h>
> #include <dt-bindings/interrupt-controller/irq.h>
> #include <dt-bindings/clock/at91.h>
> +#include <dt-bindings/iio/adc/at91-sama5d2_adc.h>
>
> / {
> model = "Atmel SAMA5D2 family SoC";
> @@ -1437,6 +1438,7 @@
> atmel,max-sample-rate-hz = <20000000>;
> atmel,startup-time-ms = <4>;
> atmel,trigger-edge-type = <IRQ_TYPE_EDGE_RISING>;
> + #io-channel-cells = <1>;
> status = "disabled";
> };
>
^ permalink raw reply
* [PATCH v7 9/9] ARM: dts: at91: sama5d2: Add resistive touch device
From: Jonathan Cameron @ 2018-06-10 12:36 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1526975559-18966-10-git-send-email-eugen.hristev@microchip.com>
On Tue, 22 May 2018 10:52:39 +0300
Eugen Hristev <eugen.hristev@microchip.com> wrote:
> Add generic resistive touch device which is connected to ADC block
> inside the SAMA5D2 SoC
>
> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
As with the previous patch, the driver side of things is working it's
way through the IIO tree, but will be the next merge window, not the
current one.
Thanks,
Jonathan
> ---
> Changes in v5:
> - renamed touchscreen-threshold-pressure to touchscreen-min-pressure
>
> arch/arm/boot/dts/sama5d2.dtsi | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> index f06ba99..a44f325 100644
> --- a/arch/arm/boot/dts/sama5d2.dtsi
> +++ b/arch/arm/boot/dts/sama5d2.dtsi
> @@ -1442,6 +1442,16 @@
> status = "disabled";
> };
>
> + resistive_touch: resistive-touch {
> + compatible = "resistive-adc-touch";
> + io-channels = <&adc AT91_SAMA5D2_ADC_X_CHANNEL>,
> + <&adc AT91_SAMA5D2_ADC_Y_CHANNEL>,
> + <&adc AT91_SAMA5D2_ADC_P_CHANNEL>;
> + io-channel-names = "x", "y", "pressure";
> + touchscreen-min-pressure = <50000>;
> + status = "disabled";
> + };
> +
> pioA: pinctrl at fc038000 {
> compatible = "atmel,sama5d2-pinctrl";
> reg = <0xfc038000 0x600>;
^ permalink raw reply
* [PATCH 1/1] ARM: dts: s5pv210: Add missing interrupt-controller property to gph2
From: Paweł Chmiel @ 2018-06-10 14:15 UTC (permalink / raw)
To: linux-arm-kernel
This commit adds missing interrupt-controller property to gph2 block,
to silence following warnings during build
/soc/pinctrl at e0200000/gph2: Missing interrupt-controller or interrupt-map property
Observed on not yet mainlined, an S5PV210 based
Samsung Galaxy S (i9000) phone.
Signed-off-by: Pawe? Chmiel <pawel.mikolaj.chmiel@gmail.com>
---
arch/arm/boot/dts/s5pv210-pinctrl.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/boot/dts/s5pv210-pinctrl.dtsi b/arch/arm/boot/dts/s5pv210-pinctrl.dtsi
index 3a79feab11c3..7f0c9d447871 100644
--- a/arch/arm/boot/dts/s5pv210-pinctrl.dtsi
+++ b/arch/arm/boot/dts/s5pv210-pinctrl.dtsi
@@ -258,6 +258,8 @@
gph2: gph2 {
gpio-controller;
#gpio-cells = <2>;
+
+ interrupt-controller;
#interrupt-cells = <2>;
};
--
2.7.4
^ permalink raw reply related
* [PATCH] clocksource/drivers/stm32: fix error return code
From: Julia Lawall @ 2018-06-10 14:24 UTC (permalink / raw)
To: linux-arm-kernel
Return an error code on failure.
Problem found using Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/clocksource/timer-stm32.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/timer-stm32.c b/drivers/clocksource/timer-stm32.c
index e5cdc3a..2717f88 100644
--- a/drivers/clocksource/timer-stm32.c
+++ b/drivers/clocksource/timer-stm32.c
@@ -304,8 +304,10 @@ static int __init stm32_timer_init(struct device_node *node)
to->private_data = kzalloc(sizeof(struct stm32_timer_private),
GFP_KERNEL);
- if (!to->private_data)
+ if (!to->private_data) {
+ ret = -ENOMEM;
goto deinit;
+ }
rstc = of_reset_control_get(node, NULL);
if (!IS_ERR(rstc)) {
^ permalink raw reply related
* [PATCH] media: stm32-dcmi: simplify of_node_put usage
From: Nicholas Mc Guire @ 2018-06-10 15:23 UTC (permalink / raw)
To: linux-arm-kernel
This does not fix any bug - this is just a code simplification. As
np is not used after passing it to v4l2_fwnode_endpoint_parse() its
refcount can be decremented immediately and at one location.
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
Issue found during code reading.
Patch was compile tested with: x86_64_defconfig, MEDIA_SUPPORT=y
MEDIA_CAMERA_SUPPORT=y, V4L_PLATFORM_DRIVERS=y, OF=y, COMPILE_TEST=y
CONFIG_VIDEO_STM32_DCMI=y
(There are a few sparse warnings - but unrelated to the lines changed)
Patch is against 4.17.0 (localversion-next is next-20180608)
drivers/media/platform/stm32/stm32-dcmi.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index 2e1933d..0b61042 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -1696,23 +1696,20 @@ static int dcmi_probe(struct platform_device *pdev)
}
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep);
+ of_node_put(np);
if (ret) {
dev_err(&pdev->dev, "Could not parse the endpoint\n");
- of_node_put(np);
return -ENODEV;
}
if (ep.bus_type == V4L2_MBUS_CSI2) {
dev_err(&pdev->dev, "CSI bus not supported\n");
- of_node_put(np);
return -ENODEV;
}
dcmi->bus.flags = ep.bus.parallel.flags;
dcmi->bus.bus_width = ep.bus.parallel.bus_width;
dcmi->bus.data_shift = ep.bus.parallel.data_shift;
- of_node_put(np);
-
irq = platform_get_irq(pdev, 0);
if (irq <= 0) {
dev_err(&pdev->dev, "Could not get irq\n");
--
2.1.4
^ permalink raw reply related
* [PATCH v5 4/4] kernel hacking: new config CC_OPTIMIZE_FOR_DEBUGGING to apply GCC -Og optimization
From: kbuild test robot @ 2018-06-10 15:49 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1528186420-6615-5-git-send-email-changbin.du@intel.com>
Hi Changbin,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v4.17 next-20180608]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/changbin-du-intel-com/kernel-hacking-GCC-optimization-for-better-debug-experience-Og/20180606-001415
config: i386-randconfig-x076-06101602 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
drivers//usb/typec/fusb302/fusb302.c: In function 'fusb302_handle_togdone_src':
>> drivers//usb/typec/fusb302/fusb302.c:1413:10: warning: 'ra_comp' may be used uninitialized in this function [-Wmaybe-uninitialized]
else if (ra_comp)
^
--
drivers/infiniband/ulp/ipoib/ipoib_main.c: In function 'ipoib_get_netdev':
>> drivers/infiniband/ulp/ipoib/ipoib_main.c:2021:30: warning: 'dev' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (!hca->alloc_rdma_netdev || PTR_ERR(dev) == -EOPNOTSUPP)
--
kernel//cgroup/cgroup-v1.c: In function 'cgroup1_mount':
>> kernel//cgroup/cgroup-v1.c:1268:3: warning: 'root' may be used uninitialized in this function [-Wmaybe-uninitialized]
percpu_ref_reinit(&root->cgrp.self.refcnt);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
kernel//trace/bpf_trace.c: In function 'bpf_trace_printk':
>> kernel//trace/bpf_trace.c:226:20: warning: 'unsafe_addr' may be used uninitialized in this function [-Wmaybe-uninitialized]
(void *) (long) unsafe_addr,
^~~~~~~~~~~~~~~~~~
kernel//trace/bpf_trace.c:170:6: note: 'unsafe_addr' was declared here
u64 unsafe_addr;
^~~~~~~~~~~
--
net//6lowpan/iphc.c: In function 'lowpan_header_decompress':
net//6lowpan/iphc.c:617:12: warning: 'iphc1' may be used uninitialized in this function [-Wmaybe-uninitialized]
u8 iphc0, iphc1, cid = 0;
^~~~~
>> net//6lowpan/iphc.c:617:5: warning: 'iphc0' may be used uninitialized in this function [-Wmaybe-uninitialized]
u8 iphc0, iphc1, cid = 0;
^~~~~
--
net//netfilter/nf_tables_api.c: In function 'nf_tables_dump_set':
>> net//netfilter/nf_tables_api.c:3625:2: warning: 'set' may be used uninitialized in this function [-Wmaybe-uninitialized]
set->ops->walk(&dump_ctx->ctx, set, &args.iter);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
drivers/media/dvb-frontends/mn88472.c: In function 'mn88472_set_frontend':
>> drivers/media/dvb-frontends/mn88472.c:339:27: warning: 'bandwidth_vals_ptr' may be used uninitialized in this function [-Wmaybe-uninitialized]
bandwidth_vals_ptr[i]);
^
>> drivers/media/dvb-frontends/mn88472.c:320:8: warning: 'bandwidth_val' may be used uninitialized in this function [-Wmaybe-uninitialized]
ret = regmap_write(dev->regmap[2], 0x04, bandwidth_val);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
drivers/media/dvb-frontends/mn88473.c: In function 'mn88473_set_frontend':
>> drivers/media/dvb-frontends/mn88473.c:162:7: warning: 'conf_val_ptr' may be used uninitialized in this function [-Wmaybe-uninitialized]
ret = regmap_bulk_write(dev->regmap[1], 0x10, conf_val_ptr, 6);
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
net//netfilter/ipvs/ip_vs_sync.c: In function 'ip_vs_sync_conn':
>> net//netfilter/ipvs/ip_vs_sync.c:731:13: warning: 'm' may be used uninitialized in this function [-Wmaybe-uninitialized]
m->nr_conns++;
~~~~~~~~~~~^~
--
drivers//hwspinlock/hwspinlock_core.c: In function 'of_hwspin_lock_get_id':
>> drivers//hwspinlock/hwspinlock_core.c:339:19: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized]
return ret ? ret : id;
~~~~~~~~~~^~~~
--
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c: In function 'mlxsw_sp_nexthop_group_update':
>> drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3078:7: warning: 'err' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (err)
^
vim +/ra_comp +1413 drivers//usb/typec/fusb302/fusb302.c
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1359
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1360 static int fusb302_handle_togdone_src(struct fusb302_chip *chip,
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1361 u8 togdone_result)
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1362 {
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1363 /*
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1364 * - set polarity (measure cc, vconn, tx)
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1365 * - set pull_up, pull_down
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1366 * - set cc1, cc2, and update to tcpm_port
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1367 * - set I_COMP interrupt on
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1368 */
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1369 int ret = 0;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1370 u8 status0;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1371 u8 ra_mda = ra_mda_value[chip->src_current_status];
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1372 u8 rd_mda = rd_mda_value[chip->src_current_status];
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1373 bool ra_comp, rd_comp;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1374 enum typec_cc_polarity cc_polarity;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1375 enum typec_cc_status cc_status_active, cc1, cc2;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1376
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1377 /* set pull_up, pull_down */
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1378 ret = fusb302_set_cc_pull(chip, true, false);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1379 if (ret < 0) {
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1380 fusb302_log(chip, "cannot set cc to pull up, ret=%d", ret);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1381 return ret;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1382 }
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1383 /* set polarity */
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1384 cc_polarity = (togdone_result == FUSB_REG_STATUS1A_TOGSS_SRC1) ?
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1385 TYPEC_POLARITY_CC1 : TYPEC_POLARITY_CC2;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1386 ret = fusb302_set_cc_polarity(chip, cc_polarity);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1387 if (ret < 0) {
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1388 fusb302_log(chip, "cannot set cc polarity %s, ret=%d",
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1389 cc_polarity_name[cc_polarity], ret);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1390 return ret;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1391 }
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1392 /* fusb302_set_cc_polarity() has set the correct measure block */
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1393 ret = fusb302_i2c_write(chip, FUSB_REG_MEASURE, rd_mda);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1394 if (ret < 0)
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1395 return ret;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1396 usleep_range(50, 100);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1397 ret = fusb302_i2c_read(chip, FUSB_REG_STATUS0, &status0);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1398 if (ret < 0)
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1399 return ret;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1400 rd_comp = !!(status0 & FUSB_REG_STATUS0_COMP);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1401 if (!rd_comp) {
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1402 ret = fusb302_i2c_write(chip, FUSB_REG_MEASURE, ra_mda);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1403 if (ret < 0)
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1404 return ret;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1405 usleep_range(50, 100);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1406 ret = fusb302_i2c_read(chip, FUSB_REG_STATUS0, &status0);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1407 if (ret < 0)
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1408 return ret;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1409 ra_comp = !!(status0 & FUSB_REG_STATUS0_COMP);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1410 }
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1411 if (rd_comp)
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1412 cc_status_active = TYPEC_CC_OPEN;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 @1413 else if (ra_comp)
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1414 cc_status_active = TYPEC_CC_RD;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1415 else
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1416 /* Ra is not supported, report as Open */
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1417 cc_status_active = TYPEC_CC_OPEN;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1418 /* restart toggling if the cc status on the active line is OPEN */
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1419 if (cc_status_active == TYPEC_CC_OPEN) {
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1420 fusb302_log(chip, "restart toggling as CC_OPEN detected");
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1421 ret = fusb302_set_toggling(chip, chip->toggling_mode);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1422 return ret;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1423 }
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1424 /* update tcpm with the new cc value */
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1425 cc1 = (cc_polarity == TYPEC_POLARITY_CC1) ?
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1426 cc_status_active : TYPEC_CC_OPEN;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1427 cc2 = (cc_polarity == TYPEC_POLARITY_CC2) ?
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1428 cc_status_active : TYPEC_CC_OPEN;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1429 if ((chip->cc1 != cc1) || (chip->cc2 != cc2)) {
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1430 chip->cc1 = cc1;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1431 chip->cc2 = cc2;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1432 tcpm_cc_change(chip->tcpm_port);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1433 }
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1434 /* turn off toggling */
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1435 ret = fusb302_set_toggling(chip, TOGGLINE_MODE_OFF);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1436 if (ret < 0) {
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1437 fusb302_log(chip,
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1438 "cannot set toggling mode off, ret=%d", ret);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1439 return ret;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1440 }
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1441 /* set MDAC to Rd threshold, and unmask I_COMP for unplug detection */
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1442 ret = fusb302_i2c_write(chip, FUSB_REG_MEASURE, rd_mda);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1443 if (ret < 0)
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1444 return ret;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1445 /* unmask comp_chng interrupt */
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1446 ret = fusb302_i2c_clear_bits(chip, FUSB_REG_MASK,
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1447 FUSB_REG_MASK_COMP_CHNG);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1448 if (ret < 0) {
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1449 fusb302_log(chip,
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1450 "cannot unmask bc_lcl interrupt, ret=%d", ret);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1451 return ret;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1452 }
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1453 chip->intr_comp_chng = true;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1454 fusb302_log(chip, "detected cc1=%s, cc2=%s",
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1455 typec_cc_status_name[cc1],
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1456 typec_cc_status_name[cc2]);
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1457
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1458 return ret;
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1459 }
c034a43e drivers/staging/typec/fusb302/fusb302.c Yueyao Zhu 2017-04-27 1460
:::::: The code at line 1413 was first introduced by commit
:::::: c034a43e72dda58e4a184d71f5502ef356e04453 staging: typec: Fairchild FUSB302 Type-c chip driver
:::::: TO: Yueyao Zhu <yueyao@google.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 30857 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180610/f9900427/attachment-0001.gz>
^ permalink raw reply
* [nomadik:gemini-sq201-vitesse 17/17] FATAL: drivers/net/dsa/vitesse-vsc73xx: struct of_device_id is not terminated with a NULL entry!
From: kbuild test robot @ 2018-06-10 18:11 UTC (permalink / raw)
To: linux-arm-kernel
tree: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git gemini-sq201-vitesse
head: 8780c8c9f8df0bedea2c38a3236405f608859bea
commit: 8780c8c9f8df0bedea2c38a3236405f608859bea [17/17] net: dsa: Add Vitesse VSC73xx DSA router driver
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 8.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 8780c8c9f8df0bedea2c38a3236405f608859bea
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=ia64
All errors (new ones prefixed by >>):
drivers/net/dsa/vitesse-vsc73xx: struct of_device_id is 200 bytes. The last of 2 is:
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x76 0x69 0x74 0x65 0x73 0x73 0x65 0x2c 0x76 0x73 0x63 0x37 0x33 0x39 0x35 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
>> FATAL: drivers/net/dsa/vitesse-vsc73xx: struct of_device_id is not terminated with a NULL entry!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 49876 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180611/c21123d4/attachment-0001.gz>
^ permalink raw reply
* [PATCH] net: thunderx: prevent concurrent data re-writing by nicvf_set_rx_mode
From: David Miller @ 2018-06-10 19:35 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20180608092759.28059-1-Vadim.Lomovtsev@caviumnetworks.com>
From: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
Date: Fri, 8 Jun 2018 02:27:59 -0700
> + /* Save message data locally to prevent them from
> + * being overwritten by next ndo_set_rx_mode call().
> + */
> + spin_lock(&nic->rx_mode_wq_lock);
> + mode = vf_work->mode;
> + mc = vf_work->mc;
> + vf_work->mc = NULL;
> + spin_unlock(&nic->rx_mode_wq_lock);
At the moment you drop this lock, the memory behind 'mc' can be
freed up by:
> + spin_lock(&nic->rx_mode_wq_lock);
> + kfree(nic->rx_mode_work.mc);
And you'll crash when you dereference it above via
__nicvf_set_rx_mode_task().
^ permalink raw reply
* [PATCH] ASoC: audio-graph-card: add hp and mic detect gpios same as simple-card
From: Kuninori Morimoto @ 2018-06-10 23:52 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20180608080843.11097-1-suzuki.katsuhiro@socionext.com>
Hi Katsuhiro-san
Thank you for your patch
> This patch adds headphone and microphone jack detection gpios as same
> as simple-card driver. This feature move into simple-card-utils from
> simple-card to avoid the duplicating code.
>
> Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
> ---
I think it can be 2 patches ?
1. move function from simple-card to simple-card-utils
2. use it from audio-graph-card
> +static int asoc_graph_soc_card_probe(struct snd_soc_card *card)
> +{
> + struct graph_card_data *priv = snd_soc_card_get_drvdata(card);
> + int ret;
> +
> + ret = asoc_simple_card_init_hp(card, &priv->hp_jack, NULL);
> + if (ret < 0)
> + return ret;
> +
> + ret = asoc_simple_card_init_mic(card, &priv->mic_jack, NULL);
> + if (ret < 0)
> + return ret;
> +
> + return 0;
> +}
> +
> static int asoc_graph_card_probe(struct platform_device *pdev)
> {
> struct graph_card_data *priv;
> @@ -319,6 +336,7 @@ static int asoc_graph_card_probe(struct platform_device *pdev)
> card->num_links = num;
> card->dapm_widgets = asoc_graph_card_dapm_widgets;
> card->num_dapm_widgets = ARRAY_SIZE(asoc_graph_card_dapm_widgets);
> + card->probe = asoc_graph_soc_card_probe;
Current simple-card is calling init_hp/init_mic from
asoc_simple_card_dai_init(), and audio-graph-card has
asoc_graph_card_dai_init().
simple/audio card are doing samethings in different style.
Thus, I want to synchronized whole simple/audio card.
Best regards
---
Kuninori Morimoto
^ permalink raw reply
* arm: mach-mvebu: dts: enable-method is always overwritten
From: Chris Packham @ 2018-06-11 0:48 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20180608155858.GB19702@lunn.ch>
Hi Yves,
On 09/06/18 03:59, Andrew Lunn wrote:
> On Fri, Jun 08, 2018 at 05:43:11PM +0200, Yves Lefloch wrote:
>> Hello everybody,
>
> Adding Chris Packham. He did some work in this area.
>
> Andrew
>
>>
>> I'm facing an issue that I believe to be a conflict between device-tree and
>> machine_desc.
>>
>> My platform is arm/mach-mvebu. I have a DT based on "armada-xp-db-dxbc2.dts"
>> (I just included it and added a few okays), my CPU is a Marvell Bobcat2
>> switching chip. My kernel is a vanilla 4.16.
>>
>> Everything works fine except that my second core won't boot: `CPU1: failed
>> to come online'.
>> I tracked down the problem to arch/arm/mach-mvebu/platsmp.c: in this file is
>> defined a machine_desc that hardcodes the SMP ops to `marvell,armada-xp-smp'
>> whereas my device tree (by including armada-xp-98dx3236.dtsi) attempts to
>> set the ops to `marvell,98dx3236-smp' through enable-method. In setup_arch()
>> the machine_desc's ops overwrites the enable-method's ops, causing the wrong
>> smp_boot_secondary() call to be issued.
>>
>> Now there is a note from 2014 saying that this machine_desc's `smp' field is
>> hardcoded like that because of "old Device Trees that were not specifying
>> the cpus enable-method property". As far as I can tell, this is still the
>> case, for instance "armada-370-db.dts" doesn't have any enable-method
>> property.
>>
>> I have worked around this by commenting out `armada_xp_smp_ops.smp' but
>> obviously I would prefer to keep a vanilla kernel.
>>
>> So I propose to:
>> - Add `enable-method = "marvell,armada-xp-smp"' to armada-370-xp.dtsi,
>> because it seems that all Armada 370/XP include it;
>> - Remove the `smp' field of `armada_xp_smp_ops'.
>>
>> If you agree with the diagnosis and the proposed fix I will write a patch.
Personally my preferred option is to not set .smp at all and let the
device tree do it's thing.
I'm not sure if things have changed w.r.t. backwards compatibility in
the 3.5 years since I initially suggested that, assuming that we still
want backwards compatibility with these older device trees this patch
might help
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-November/303899.html
I was pretty happy with that approach at the time but I obviously never
followed up to get that delivered. If someone has some spare cycles to
spend on it I wouldn't object to it being taken over.
I'll see if I can find some time to resurrect it myself. I don't have an
Armada-370 board but I can test BC2 and A38x.
^ permalink raw reply
* [GIT PULL] Allwinner clock changes for 4.18
From: Masahiro Yamada @ 2018-06-11 2:00 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20180521115947.wqrnv2hczate65lz@flea>
Hi Maxime,
2018-05-21 20:59 GMT+09:00 Maxime Ripard <maxime.ripard@bootlin.com>:
> Hi Mike, Stephen,
>
> Please merge the following changes for the next merge window, thanks!
>
> Maxime
>
> The following changes since commit 60cc43fc888428bb2f18f08997432d426a243338:
>
> Linux 4.17-rc1 (2018-04-15 18:24:20 -0700)
>
> are available in the Git repository at:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git tags/sunxi-clk-for-4.18
>
> for you to fetch changes up to 17de4c857b1f74b90967f7e7fd5ff81be61dc044:
>
> clk: sunxi-ng: r40: export a regmap to access the GMAC register (2018-05-17 14:02:07 +0800)
>
> ----------------------------------------------------------------
> Allwinner clock changes for 4.18
>
> Not a lot of changes for this release, but two quite important features
> were added: the H6 PRCM clock support, and the needed changes to the R40
> clock driver to allow for the EMAC to operate.
>
> ----------------------------------------------------------------
> Icenowy Zheng (3):
> clk: sunxi-ng: add support for H6 PRCM CCU
> clk: sunxi-ng: r40: rewrite init code to a platform driver
> clk: sunxi-ng: r40: export a regmap to access the GMAC register
>
Why was my patch "clk: sunxi-ng: replace lib-y with obj-y"
not included in the pull request?
You said "I've picked it up"
https://patchwork.kernel.org/patch/10348031/
> .../devicetree/bindings/clock/sunxi-ccu.txt | 3 +-
> drivers/clk/sunxi-ng/Kconfig | 5 +
> drivers/clk/sunxi-ng/Makefile | 1 +
> drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c | 207 +++++++++++++++++++++
> drivers/clk/sunxi-ng/ccu-sun50i-h6-r.h | 19 ++
> drivers/clk/sunxi-ng/ccu-sun8i-r40.c | 72 +++++--
> include/dt-bindings/clock/sun50i-h6-r-ccu.h | 24 +++
> include/dt-bindings/reset/sun50i-h6-r-ccu.h | 17 ++
> 8 files changed, 336 insertions(+), 12 deletions(-)
> create mode 100644 drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c
> create mode 100644 drivers/clk/sunxi-ng/ccu-sun50i-h6-r.h
> create mode 100644 include/dt-bindings/clock/sun50i-h6-r-ccu.h
> create mode 100644 include/dt-bindings/reset/sun50i-h6-r-ccu.h
>
> --
> Maxime Ripard, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> https://bootlin.com
--
Best Regards
Masahiro Yamada
^ permalink raw reply
* [alsa-devel] [PATCH] ASoC: audio-graph-card: add hp and mic detect gpios same as simple-card
From: Katsuhiro Suzuki @ 2018-06-11 2:03 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <87h8makxt7.wl-kuninori.morimoto.gx@renesas.com>
Hello Morimoto-san,
Thank you for your reviewing.
On 06/11/18 08:52, Kuninori Morimoto wrote:
>
> Hi Katsuhiro-san
>
> Thank you for your patch
>
>> This patch adds headphone and microphone jack detection gpios as same
>> as simple-card driver. This feature move into simple-card-utils from
>> simple-card to avoid the duplicating code.
>>
>> Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
>> ---
>
> I think it can be 2 patches ?
> 1. move function from simple-card to simple-card-utils
> 2. use it from audio-graph-card
>
OK, I'll split this patch.
>> +static int asoc_graph_soc_card_probe(struct snd_soc_card *card)
>> +{
>> + struct graph_card_data *priv = snd_soc_card_get_drvdata(card);
>> + int ret;
>> +
>> + ret = asoc_simple_card_init_hp(card, &priv->hp_jack, NULL);
>> + if (ret < 0)
>> + return ret;
>> +
>> + ret = asoc_simple_card_init_mic(card, &priv->mic_jack, NULL);
>> + if (ret < 0)
>> + return ret;
>> +
>> + return 0;
>> +}
>> +
>> static int asoc_graph_card_probe(struct platform_device *pdev)
>> {
>> struct graph_card_data *priv;
>> @@ -319,6 +336,7 @@ static int asoc_graph_card_probe(struct platform_device *pdev)
>> card->num_links = num;
>> card->dapm_widgets = asoc_graph_card_dapm_widgets;
>> card->num_dapm_widgets = ARRAY_SIZE(asoc_graph_card_dapm_widgets);
>> + card->probe = asoc_graph_soc_card_probe;
>
> Current simple-card is calling init_hp/init_mic from
> asoc_simple_card_dai_init(), and audio-graph-card has
> asoc_graph_card_dai_init().
> simple/audio card are doing samethings in different style.
> Thus, I want to synchronized whole simple/audio card.
>
Ah, right. I need to add more one patch.
1. move function from simple-card to simple-card-utils
2. change calling init_hp/mic from soc_dai_link.init() to
soc_card.probe()
3. use it from audio-graph-card
Regards,
--
Katsuhiro Suzuki
> Best regards
> ---
> Kuninori Morimoto
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
^ permalink raw reply
* [PATCH] ASoC: audio-graph-card: add hp and mic detect gpios same as simple-card
From: Katsuhiro Suzuki @ 2018-06-11 2:14 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <87h8makxt7.wl-kuninori.morimoto.gx@renesas.com>
Hello Morimoto-san,
Thank you for your reviewing.
> -----Original Message-----
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Sent: Monday, June 11, 2018 8:53 AM
> To: Suzuki, Katsuhiro <suzuki.katsuhiro@socionext.com>
> Cc: Mark Brown <broonie@kernel.org>; alsa-devel at alsa-project.org; Masami
Hiramatsu
> <masami.hiramatsu@linaro.org>; Jassi Brar <jaswinder.singh@linaro.org>;
> linux-arm-kernel at lists.infradead.org; linux-kernel at vger.kernel.org
> Subject: Re: [PATCH] ASoC: audio-graph-card: add hp and mic detect gpios same
as
> simple-card
>
>
> Hi Katsuhiro-san
>
> Thank you for your patch
>
> > This patch adds headphone and microphone jack detection gpios as same
> > as simple-card driver. This feature move into simple-card-utils from
> > simple-card to avoid the duplicating code.
> >
> > Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
> > ---
>
> I think it can be 2 patches ?
> 1. move function from simple-card to simple-card-utils
> 2. use it from audio-graph-card
>
OK, I'll split this patch.
> > +static int asoc_graph_soc_card_probe(struct snd_soc_card *card)
> > +{
> > + struct graph_card_data *priv = snd_soc_card_get_drvdata(card);
> > + int ret;
> > +
> > + ret = asoc_simple_card_init_hp(card, &priv->hp_jack, NULL);
> > + if (ret < 0)
> > + return ret;
> > +
> > + ret = asoc_simple_card_init_mic(card, &priv->mic_jack, NULL);
> > + if (ret < 0)
> > + return ret;
> > +
> > + return 0;
> > +}
> > +
> > static int asoc_graph_card_probe(struct platform_device *pdev)
> > {
> > struct graph_card_data *priv;
> > @@ -319,6 +336,7 @@ static int asoc_graph_card_probe(struct platform_device
> *pdev)
> > card->num_links = num;
> > card->dapm_widgets = asoc_graph_card_dapm_widgets;
> > card->num_dapm_widgets = ARRAY_SIZE(asoc_graph_card_dapm_widgets);
> > + card->probe = asoc_graph_soc_card_probe;
>
> Current simple-card is calling init_hp/init_mic from
> asoc_simple_card_dai_init(), and audio-graph-card has
> asoc_graph_card_dai_init().
> simple/audio card are doing samethings in different style.
> Thus, I want to synchronized whole simple/audio card.
>
Indeed. I need to add more one patch.
1. move function from simple-card to simple-card-utils
2. change calling init_hp/mic from soc_dai_link.init() to
soc_card.probe()
3. use it from audio-graph-card
Regards,
--
Katsuhiro Suzuki
> Best regards
> ---
> Kuninori Morimoto
^ permalink raw reply
* [PATCH 1/2] arm64: avoid alloc memory on offline node
From: Xie XiuQi @ 2018-06-11 3:23 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20180607122152.GP32433@dhcp22.suse.cz>
Hi Michal,
On 2018/6/7 20:21, Michal Hocko wrote:
> On Thu 07-06-18 19:55:53, Hanjun Guo wrote:
>> On 2018/6/7 18:55, Michal Hocko wrote:
> [...]
>>> I am not sure I have the full context but pci_acpi_scan_root calls
>>> kzalloc_node(sizeof(*info), GFP_KERNEL, node)
>>> and that should fall back to whatever node that is online. Offline node
>>> shouldn't keep any pages behind. So there must be something else going
>>> on here and the patch is not the right way to handle it. What does
>>> faddr2line __alloc_pages_nodemask+0xf0 tells on this kernel?
>>
>> The whole context is:
>>
>> The system is booted with a NUMA node has no memory attaching to it
>> (memory-less NUMA node), also with NR_CPUS less than CPUs presented
>> in MADT, so CPUs on this memory-less node are not brought up, and
>> this NUMA node will not be online (but SRAT presents this NUMA node);
>>
>> Devices attaching to this NUMA node such as PCI host bridge still
>> return the valid NUMA node via _PXM, but actually that valid NUMA node
>> is not online which lead to this issue.
>
> But we should have other numa nodes on the zonelists so the allocator
> should fall back to other node. If the zonelist is not intiailized
> properly, though, then this can indeed show up as a problem. Knowing
> which exact place has blown up would help get a better picture...
>
I specific a non-exist node to allocate memory using kzalloc_node,
and got this following error message.
And I found out there is just a VM_WARN, but it does not prevent the memory
allocation continue.
This nid would be use to access NODE_DADA(nid), so if nid is invalid,
it would cause oops here.
459 /*
460 * Allocate pages, preferring the node given as nid. The node must be valid and
461 * online. For more general interface, see alloc_pages_node().
462 */
463 static inline struct page *
464 __alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order)
465 {
466 VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES);
467 VM_WARN_ON(!node_online(nid));
468
469 return __alloc_pages(gfp_mask, order, nid);
470 }
471
(I wrote a ko, to allocate memory on a non-exist node using kzalloc_node().)
[ 120.061693] WARNING: CPU: 6 PID: 3966 at ./include/linux/gfp.h:467 allocate_slab+0x5fd/0x7e0
[ 120.070095] Modules linked in: bench(OE+) nls_utf8 isofs loop xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack libcrc32c ipt_REJECT nf_reject_ipv4 tun bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter dm_mirror dm_region_hash dm_log dm_mod intel_rapl skx_edac nfit vfat libnvdimm fat x86_pkg_temp_thermal coretemp kvm_intel kvm irqbypass iTCO_wdt crct10dif_pclmul iTCO_vendor_support crc32_pclmul ghash_clmulni_intel ses pcbc enclosure aesni_intel scsi_transport_sas crypto_simd cryptd sg glue_helper ipmi_si joydev mei_me i2c_i801 ipmi_devintf ioatdma shpchp pcspkr ipmi_msghandler mei dca i2c_core lpc_ich acpi_power_meter nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables
[ 120.140992] ext4 mbcache jbd2 sd_mod crc32c_intel i40e ahci libahci megaraid_sas libata
[ 120.149053] CPU: 6 PID: 3966 Comm: insmod Tainted: G OE 4.17.0-rc2-RHEL74+ #5
[ 120.157369] Hardware name: Huawei 2288H V5/BC11SPSCB0, BIOS 0.62 03/26/2018
[ 120.164303] RIP: 0010:allocate_slab+0x5fd/0x7e0
[ 120.168817] RSP: 0018:ffff881196947af0 EFLAGS: 00010246
[ 120.174022] RAX: 0000000000000000 RBX: 00000000014012c0 RCX: ffffffffb4bc8173
[ 120.181126] RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff8817aefa7868
[ 120.188233] RBP: 00000000014000c0 R08: ffffed02f5df4f0e R09: ffffed02f5df4f0e
[ 120.195338] R10: ffffed02f5df4f0d R11: ffff8817aefa786f R12: 0000000000000055
[ 120.202444] R13: 0000000000000003 R14: ffff880107c0f800 R15: 0000000000000000
[ 120.209550] FS: 00007f6935d8c740(0000) GS:ffff8817aef80000(0000) knlGS:0000000000000000
[ 120.217606] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 120.223330] CR2: 0000000000c21b88 CR3: 0000001197fd0006 CR4: 00000000007606e0
[ 120.230435] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 120.237541] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 120.244646] PKRU: 55555554
[ 120.247346] Call Trace:
[ 120.249791] ? __kasan_slab_free+0xff/0x150
[ 120.253960] ? mpidr_init+0x20/0x30 [bench]
[ 120.258129] new_slab+0x3d/0x90
[ 120.261262] ___slab_alloc+0x371/0x640
[ 120.265002] ? __wake_up_common+0x8a/0x150
[ 120.269085] ? mpidr_init+0x20/0x30 [bench]
[ 120.273254] ? mpidr_init+0x20/0x30 [bench]
[ 120.277423] __slab_alloc+0x40/0x66
[ 120.280901] kmem_cache_alloc_node_trace+0xbc/0x270
[ 120.285762] ? mpidr_init+0x20/0x30 [bench]
[ 120.289931] ? 0xffffffffc0740000
[ 120.293236] mpidr_init+0x20/0x30 [bench]
[ 120.297236] do_one_initcall+0x4b/0x1f5
[ 120.301062] ? do_init_module+0x22/0x233
[ 120.304972] ? kmem_cache_alloc_trace+0xfe/0x220
[ 120.309571] ? do_init_module+0x22/0x233
[ 120.313481] do_init_module+0x77/0x233
[ 120.317218] load_module+0x21ea/0x2960
[ 120.320955] ? m_show+0x1d0/0x1d0
[ 120.324264] ? security_capable+0x39/0x50
[ 120.328261] __do_sys_finit_module+0x94/0xe0
[ 120.332516] do_syscall_64+0x55/0x180
[ 120.336171] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 120.341203] RIP: 0033:0x7f69352627f9
[ 120.344767] RSP: 002b:00007ffd7d73f718 EFLAGS: 00000206 ORIG_RAX: 0000000000000139
[ 120.352305] RAX: ffffffffffffffda RBX: 0000000000c201d0 RCX: 00007f69352627f9
[ 120.359411] RDX: 0000000000000000 RSI: 000000000041a2d8 RDI: 0000000000000003
[ 120.366517] RBP: 000000000041a2d8 R08: 0000000000000000 R09: 00007ffd7d73f8b8
[ 120.373622] R10: 0000000000000003 R11: 0000000000000206 R12: 0000000000000000
[ 120.380727] R13: 0000000000c20130 R14: 0000000000000000 R15: 0000000000000000
[ 120.387833] Code: 4b e8 ac 97 eb ff e9 e1 fc ff ff 89 de 89 ef e8 7a 35 ff ff 49 89 c7 4d 85 ff 74 71 0f 1f 44 00 00 e9 f1 fa ff ff e8 cf 54 00 00 <0f> 0b 90 e9 c4 fa ff ff 45 89 e8 b9 b1 05 00 00 48 c7 c2 10 79
[ 120.406620] ---[ end trace 89f801c36550734e ]---
[ 120.411234] BUG: unable to handle kernel paging request at 0000000000002088
[ 120.418168] PGD 8000001197c75067 P4D 8000001197c75067 PUD 119858f067 PMD 0
[ 120.425103] Oops: 0000 [#1] SMP KASAN PTI
[ 120.429097] Modules linked in: bench(OE+) nls_utf8 isofs loop xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack libcrc32c ipt_REJECT nf_reject_ipv4 tun bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter dm_mirror dm_region_hash dm_log dm_mod intel_rapl skx_edac nfit vfat libnvdimm fat x86_pkg_temp_thermal coretemp kvm_intel kvm irqbypass iTCO_wdt crct10dif_pclmul iTCO_vendor_support crc32_pclmul ghash_clmulni_intel ses pcbc enclosure aesni_intel scsi_transport_sas crypto_simd cryptd sg glue_helper ipmi_si joydev mei_me i2c_i801 ipmi_devintf ioatdma shpchp pcspkr ipmi_msghandler mei dca i2c_core lpc_ich acpi_power_meter nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables
[ 120.499986] ext4 mbcache jbd2 sd_mod crc32c_intel i40e ahci libahci megaraid_sas libata
[ 120.508045] CPU: 6 PID: 3966 Comm: insmod Tainted: G W OE 4.17.0-rc2-RHEL74+ #5
[ 120.516359] Hardware name: Huawei 2288H V5/BC11SPSCB0, BIOS 0.62 03/26/2018
[ 120.523296] RIP: 0010:__alloc_pages_nodemask+0x10d/0x2c0
[ 120.528586] RSP: 0018:ffff881196947a90 EFLAGS: 00010246
[ 120.533790] RAX: 0000000000000001 RBX: 00000000014012c0 RCX: 0000000000000000
[ 120.540895] RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000002080
[ 120.548000] RBP: 00000000014012c0 R08: ffffed0233ccb8f4 R09: ffffed0233ccb8f4
[ 120.555105] R10: ffffed0233ccb8f3 R11: ffff88119e65c79f R12: 0000000000000000
[ 120.562210] R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000000
[ 120.569316] FS: 00007f6935d8c740(0000) GS:ffff8817aef80000(0000) knlGS:0000000000000000
[ 120.577374] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 120.583095] CR2: 0000000000002088 CR3: 0000001197fd0006 CR4: 00000000007606e0
[ 120.590200] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 120.597307] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 120.604412] PKRU: 55555554
[ 120.607111] Call Trace:
[ 120.609554] allocate_slab+0xd8/0x7e0
[ 120.613205] ? __kasan_slab_free+0xff/0x150
[ 120.617376] ? mpidr_init+0x20/0x30 [bench]
[ 120.621545] new_slab+0x3d/0x90
[ 120.624678] ___slab_alloc+0x371/0x640
[ 120.628415] ? __wake_up_common+0x8a/0x150
[ 120.632498] ? mpidr_init+0x20/0x30 [bench]
[ 120.636667] ? mpidr_init+0x20/0x30 [bench]
[ 120.640836] __slab_alloc+0x40/0x66
[ 120.644315] kmem_cache_alloc_node_trace+0xbc/0x270
[ 120.649175] ? mpidr_init+0x20/0x30 [bench]
[ 120.653343] ? 0xffffffffc0740000
[ 120.656649] mpidr_init+0x20/0x30 [bench]
[ 120.660645] do_one_initcall+0x4b/0x1f5
[ 120.664469] ? do_init_module+0x22/0x233
[ 120.668379] ? kmem_cache_alloc_trace+0xfe/0x220
[ 120.672978] ? do_init_module+0x22/0x233
[ 120.676887] do_init_module+0x77/0x233
[ 120.680624] load_module+0x21ea/0x2960
[ 120.684360] ? m_show+0x1d0/0x1d0
[ 120.687667] ? security_capable+0x39/0x50
[ 120.691663] __do_sys_finit_module+0x94/0xe0
[ 120.695920] do_syscall_64+0x55/0x180
[ 120.699571] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 120.704603] RIP: 0033:0x7f69352627f9
[ 120.708166] RSP: 002b:00007ffd7d73f718 EFLAGS: 00000206 ORIG_RAX: 0000000000000139
[ 120.715704] RAX: ffffffffffffffda RBX: 0000000000c201d0 RCX: 00007f69352627f9
[ 120.722808] RDX: 0000000000000000 RSI: 000000000041a2d8 RDI: 0000000000000003
[ 120.729913] RBP: 000000000041a2d8 R08: 0000000000000000 R09: 00007ffd7d73f8b8
[ 120.737019] R10: 0000000000000003 R11: 0000000000000206 R12: 0000000000000000
[ 120.744123] R13: 0000000000c20130 R14: 0000000000000000 R15: 0000000000000000
[ 120.751230] Code: 89 c6 74 0d e8 55 ab 5e 00 8b 74 24 1c 48 8b 3c 24 48 8b 54 24 08 89 d9 c1 e9 17 83 e1 01 48 85 d2 88 4c 24 20 0f 85 25 01 00 00 <3b> 77 08 0f 82 1c 01 00 00 48 89 f8 44 89 ea 48 89 e1 44 89 e6
[ 120.770020] RIP: __alloc_pages_nodemask+0x10d/0x2c0 RSP: ffff881196947a90
[ 120.776780] CR2: 0000000000002088
[ 120.780116] ---[ end trace 89f801c36550734f ]---
[ 120.978922] Kernel panic - not syncing: Fatal exception
[ 120.984186] Kernel Offset: 0x33800000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[ 121.209501] ---[ end Kernel panic - not syncing: Fatal exception ]---
--
Thanks,
Xie XiuQi
^ permalink raw reply
* [PATCH v5 00/28] Add support for mediatek SOC MT2712
From: Stu Hsieh @ 2018-06-11 3:25 UTC (permalink / raw)
To: linux-arm-kernel
This patch add support for the Mediatek MT2712 DISP subsystem.
MT2712 is base on MT8173, there are some difference as following:
MT2712 support three disp output(two ovl and one rdma)
Change in v5:
- Keep the value of MAX_CONNECTOR, because it is useless
- Add the new patch for component DPI1
- Add the new patch for component DSI2
- Add the new patch for component DSI3
- Add some connection from RDMA0/RDMA1/RDMA2 to
DPI0/DPI1/DSI1/DSI2/DSI3
- Add the new patch about DPI1/DSI2/DSI3 support for mutex
- Add the new patch about DPI1/DSI1/DSI2/DSI3 in comp_init
- Change ddp path DSI2 to DSI3 in third path
Stu Hsieh (28):
drm/mediatek: update dt-bindings for mt2712
drm/mediatek: support maximum 64 mutex mod
drm/mediatek: add ddp component AAL1
drm/mediatek: add ddp component OD1
drm/mediatek: add ddp component PWM1
drm/mediatek: add ddp component PWM2
drm/mediatek: add component DPI1
drm/mediatek: add component DSI2
drm/mediatek: add component DSI3
drm/mediatek: add connection from OD1 to RDMA1
drm/mediatek: add connection from RDMA0 to DPI0
drm/mediatek: add connection from RDMA0 to DSI2
drm/mediatek: add connection from RDMA0 to DSI3
drm/mediatek: add connection from RDMA1 to DPI1
drm/mediatek: add connection from RDMA1 to DSI1
drm/mediatek: add connection from RDMA1 to DSI2
drm/mediatek: add connection from RDMA1 to DSI3
drm/mediatek: add connection from RDMA2 to DPI0
drm/mediatek: add connection from RDMA2 to DPI1
drm/mediatek: add connection from RDMA2 to DSI1
drm/mediatek: add connection from RDMA2 to DSI2
drm/mediatek: add connection from RDMA2 to DSI3
drm/mediatek: add DPI1 support for mutex
drm/mediatek: add DSI2 support for mutex
drm/mediatek: add DSI3 support for mutex
drm/mediatek: add DPI1/DSI1/DSI2/DSI3 in comp_init
drm/mediatek: add third ddp path
drm/mediatek: Add support for mediatek SOC MT2712
.../bindings/display/mediatek/mediatek,disp.txt | 2 +-
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 3 +
drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 227 ++++++++++++++++++---
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 15 +-
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 10 +-
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 47 ++++-
drivers/gpu/drm/mediatek/mtk_drm_drv.h | 5 +-
7 files changed, 270 insertions(+), 39 deletions(-)
--
2.12.5
^ permalink raw reply
* [PATCH 01/28] drm/mediatek: update dt-bindings for mt2712
From: Stu Hsieh @ 2018-06-11 3:25 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1528687580-549-1-git-send-email-stu.hsieh@mediatek.com>
Update device tree binding documentation for the display subsystem for
Mediatek MT2712 SoCs.
Signed-off-by: Stu Hsieh <stu.hsieh@mediatek.com>
Acked-by: CK Hu <ck.hu@mediatek.com>
Acked-by: Rob Herring <robh@kernel.org>
---
Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
index 383183a89164..8469de510001 100644
--- a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
+++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
@@ -40,7 +40,7 @@ Required properties (all function blocks):
"mediatek,<chip>-dpi" - DPI controller, see mediatek,dpi.txt
"mediatek,<chip>-disp-mutex" - display mutex
"mediatek,<chip>-disp-od" - overdrive
- the supported chips are mt2701 and mt8173.
+ the supported chips are mt2701, mt2712 and mt8173.
- reg: Physical base address and length of the function block register space
- interrupts: The interrupt signal from the function block (required, except for
merge and split function blocks).
--
2.12.5
^ permalink raw reply related
* [PATCH 02/28] drm/mediatek: support maximum 64 mutex mod
From: Stu Hsieh @ 2018-06-11 3:25 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1528687580-549-1-git-send-email-stu.hsieh@mediatek.com>
This patch support that if modules more than 32,
add index more than 31 when using DISP_REG_MUTEX_MOD2 bit
Signed-off-by: Stu Hsieh <stu.hsieh@mediatek.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 75 +++++++++++++++++++++-------------
1 file changed, 47 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 8130f3dab661..47ffa240bd25 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -41,31 +41,32 @@
#define DISP_REG_MUTEX_RST(n) (0x28 + 0x20 * (n))
#define DISP_REG_MUTEX_MOD(n) (0x2c + 0x20 * (n))
#define DISP_REG_MUTEX_SOF(n) (0x30 + 0x20 * (n))
+#define DISP_REG_MUTEX_MOD2(n) (0x34 + 0x20 * (n))
#define INT_MUTEX BIT(1)
-#define MT8173_MUTEX_MOD_DISP_OVL0 BIT(11)
-#define MT8173_MUTEX_MOD_DISP_OVL1 BIT(12)
-#define MT8173_MUTEX_MOD_DISP_RDMA0 BIT(13)
-#define MT8173_MUTEX_MOD_DISP_RDMA1 BIT(14)
-#define MT8173_MUTEX_MOD_DISP_RDMA2 BIT(15)
-#define MT8173_MUTEX_MOD_DISP_WDMA0 BIT(16)
-#define MT8173_MUTEX_MOD_DISP_WDMA1 BIT(17)
-#define MT8173_MUTEX_MOD_DISP_COLOR0 BIT(18)
-#define MT8173_MUTEX_MOD_DISP_COLOR1 BIT(19)
-#define MT8173_MUTEX_MOD_DISP_AAL BIT(20)
-#define MT8173_MUTEX_MOD_DISP_GAMMA BIT(21)
-#define MT8173_MUTEX_MOD_DISP_UFOE BIT(22)
-#define MT8173_MUTEX_MOD_DISP_PWM0 BIT(23)
-#define MT8173_MUTEX_MOD_DISP_PWM1 BIT(24)
-#define MT8173_MUTEX_MOD_DISP_OD BIT(25)
-
-#define MT2701_MUTEX_MOD_DISP_OVL BIT(3)
-#define MT2701_MUTEX_MOD_DISP_WDMA BIT(6)
-#define MT2701_MUTEX_MOD_DISP_COLOR BIT(7)
-#define MT2701_MUTEX_MOD_DISP_BLS BIT(9)
-#define MT2701_MUTEX_MOD_DISP_RDMA0 BIT(10)
-#define MT2701_MUTEX_MOD_DISP_RDMA1 BIT(12)
+#define MT8173_MUTEX_MOD_DISP_OVL0 11
+#define MT8173_MUTEX_MOD_DISP_OVL1 12
+#define MT8173_MUTEX_MOD_DISP_RDMA0 13
+#define MT8173_MUTEX_MOD_DISP_RDMA1 14
+#define MT8173_MUTEX_MOD_DISP_RDMA2 15
+#define MT8173_MUTEX_MOD_DISP_WDMA0 16
+#define MT8173_MUTEX_MOD_DISP_WDMA1 17
+#define MT8173_MUTEX_MOD_DISP_COLOR0 18
+#define MT8173_MUTEX_MOD_DISP_COLOR1 19
+#define MT8173_MUTEX_MOD_DISP_AAL 20
+#define MT8173_MUTEX_MOD_DISP_GAMMA 21
+#define MT8173_MUTEX_MOD_DISP_UFOE 22
+#define MT8173_MUTEX_MOD_DISP_PWM0 23
+#define MT8173_MUTEX_MOD_DISP_PWM1 24
+#define MT8173_MUTEX_MOD_DISP_OD 25
+
+#define MT2701_MUTEX_MOD_DISP_OVL 3
+#define MT2701_MUTEX_MOD_DISP_WDMA 6
+#define MT2701_MUTEX_MOD_DISP_COLOR 7
+#define MT2701_MUTEX_MOD_DISP_BLS 9
+#define MT2701_MUTEX_MOD_DISP_RDMA0 10
+#define MT2701_MUTEX_MOD_DISP_RDMA1 12
#define MUTEX_SOF_SINGLE_MODE 0
#define MUTEX_SOF_DSI0 1
@@ -278,6 +279,7 @@ void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex,
struct mtk_ddp *ddp = container_of(mutex, struct mtk_ddp,
mutex[mutex->id]);
unsigned int reg;
+ unsigned int offset;
WARN_ON(&ddp->mutex[mutex->id] != mutex);
@@ -292,9 +294,17 @@ void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex,
reg = MUTEX_SOF_DPI0;
break;
default:
- reg = readl_relaxed(ddp->regs + DISP_REG_MUTEX_MOD(mutex->id));
- reg |= ddp->mutex_mod[id];
- writel_relaxed(reg, ddp->regs + DISP_REG_MUTEX_MOD(mutex->id));
+ if (ddp->mutex_mod[id] < 32) {
+ offset = DISP_REG_MUTEX_MOD(mutex->id);
+ reg = readl_relaxed(ddp->regs + offset);
+ reg |= 1 << ddp->mutex_mod[id];
+ writel_relaxed(reg, ddp->regs + offset);
+ } else {
+ offset = DISP_REG_MUTEX_MOD2(mutex->id);
+ reg = readl_relaxed(ddp->regs + offset);
+ reg |= 1 << (ddp->mutex_mod[id] - 32);
+ writel_relaxed(reg, ddp->regs + offset);
+ }
return;
}
@@ -307,6 +317,7 @@ void mtk_disp_mutex_remove_comp(struct mtk_disp_mutex *mutex,
struct mtk_ddp *ddp = container_of(mutex, struct mtk_ddp,
mutex[mutex->id]);
unsigned int reg;
+ unsigned int offset;
WARN_ON(&ddp->mutex[mutex->id] != mutex);
@@ -318,9 +329,17 @@ void mtk_disp_mutex_remove_comp(struct mtk_disp_mutex *mutex,
ddp->regs + DISP_REG_MUTEX_SOF(mutex->id));
break;
default:
- reg = readl_relaxed(ddp->regs + DISP_REG_MUTEX_MOD(mutex->id));
- reg &= ~(ddp->mutex_mod[id]);
- writel_relaxed(reg, ddp->regs + DISP_REG_MUTEX_MOD(mutex->id));
+ if (ddp->mutex_mod[id] < 32) {
+ offset = DISP_REG_MUTEX_MOD(mutex->id);
+ reg = readl_relaxed(ddp->regs + offset);
+ reg &= ~(1 << ddp->mutex_mod[id]);
+ writel_relaxed(reg, ddp->regs + offset);
+ } else {
+ offset = DISP_REG_MUTEX_MOD2(mutex->id);
+ reg = readl_relaxed(ddp->regs + offset);
+ reg &= ~(1 << (ddp->mutex_mod[id] - 32));
+ writel_relaxed(reg, ddp->regs + offset);
+ }
break;
}
}
--
2.12.5
^ permalink raw reply related
* [PATCH 03/28] drm/mediatek: add ddp component AAL1
From: Stu Hsieh @ 2018-06-11 3:25 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1528687580-549-1-git-send-email-stu.hsieh@mediatek.com>
This patch add component AAL1 and
rename AAL to AAL0
Signed-off-by: Stu Hsieh <stu.hsieh@mediatek.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 2 +-
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 3 ++-
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 3 ++-
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 47ffa240bd25..7217665f4b5d 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -110,7 +110,7 @@ static const unsigned int mt2701_mutex_mod[DDP_COMPONENT_ID_MAX] = {
};
static const unsigned int mt8173_mutex_mod[DDP_COMPONENT_ID_MAX] = {
- [DDP_COMPONENT_AAL] = MT8173_MUTEX_MOD_DISP_AAL,
+ [DDP_COMPONENT_AAL0] = MT8173_MUTEX_MOD_DISP_AAL,
[DDP_COMPONENT_COLOR0] = MT8173_MUTEX_MOD_DISP_COLOR0,
[DDP_COMPONENT_COLOR1] = MT8173_MUTEX_MOD_DISP_COLOR1,
[DDP_COMPONENT_GAMMA] = MT8173_MUTEX_MOD_DISP_GAMMA,
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 4672317e3ad1..0919039805aa 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -218,7 +218,8 @@ struct mtk_ddp_comp_match {
};
static const struct mtk_ddp_comp_match mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
- [DDP_COMPONENT_AAL] = { MTK_DISP_AAL, 0, &ddp_aal },
+ [DDP_COMPONENT_AAL0] = { MTK_DISP_AAL, 0, &ddp_aal },
+ [DDP_COMPONENT_AAL1] = { MTK_DISP_AAL, 1, &ddp_aal },
[DDP_COMPONENT_BLS] = { MTK_DISP_BLS, 0, NULL },
[DDP_COMPONENT_COLOR0] = { MTK_DISP_COLOR, 0, NULL },
[DDP_COMPONENT_COLOR1] = { MTK_DISP_COLOR, 1, NULL },
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index 0828cf8bf85c..eee3c0cc2632 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -41,7 +41,8 @@ enum mtk_ddp_comp_type {
};
enum mtk_ddp_comp_id {
- DDP_COMPONENT_AAL,
+ DDP_COMPONENT_AAL0,
+ DDP_COMPONENT_AAL1,
DDP_COMPONENT_BLS,
DDP_COMPONENT_COLOR0,
DDP_COMPONENT_COLOR1,
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index a2ca90fc403c..a415260f3d5f 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -149,7 +149,7 @@ static const enum mtk_ddp_comp_id mt2701_mtk_ddp_ext[] = {
static const enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = {
DDP_COMPONENT_OVL0,
DDP_COMPONENT_COLOR0,
- DDP_COMPONENT_AAL,
+ DDP_COMPONENT_AAL0,
DDP_COMPONENT_OD,
DDP_COMPONENT_RDMA0,
DDP_COMPONENT_UFOE,
--
2.12.5
^ permalink raw reply related
* [PATCH 04/28] drm/mediatek: add ddp component OD1
From: Stu Hsieh @ 2018-06-11 3:25 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1528687580-549-1-git-send-email-stu.hsieh@mediatek.com>
This patch add the component OD1 and
rename the OD to OD0
Signed-off-by: Stu Hsieh <stu.hsieh@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 4 ++--
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 3 ++-
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 3 ++-
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 +-
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 7217665f4b5d..58e44349e315 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -114,7 +114,7 @@ static const unsigned int mt8173_mutex_mod[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_COLOR0] = MT8173_MUTEX_MOD_DISP_COLOR0,
[DDP_COMPONENT_COLOR1] = MT8173_MUTEX_MOD_DISP_COLOR1,
[DDP_COMPONENT_GAMMA] = MT8173_MUTEX_MOD_DISP_GAMMA,
- [DDP_COMPONENT_OD] = MT8173_MUTEX_MOD_DISP_OD,
+ [DDP_COMPONENT_OD0] = MT8173_MUTEX_MOD_DISP_OD,
[DDP_COMPONENT_OVL0] = MT8173_MUTEX_MOD_DISP_OVL0,
[DDP_COMPONENT_OVL1] = MT8173_MUTEX_MOD_DISP_OVL1,
[DDP_COMPONENT_PWM0] = MT8173_MUTEX_MOD_DISP_PWM0,
@@ -139,7 +139,7 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id cur,
} else if (cur == DDP_COMPONENT_OVL0 && next == DDP_COMPONENT_RDMA0) {
*addr = DISP_REG_CONFIG_DISP_OVL_MOUT_EN;
value = OVL_MOUT_EN_RDMA;
- } else if (cur == DDP_COMPONENT_OD && next == DDP_COMPONENT_RDMA0) {
+ } else if (cur == DDP_COMPONENT_OD0 && next == DDP_COMPONENT_RDMA0) {
*addr = DISP_REG_CONFIG_DISP_OD_MOUT_EN;
value = OD_MOUT_EN_RDMA0;
} else if (cur == DDP_COMPONENT_UFOE && next == DDP_COMPONENT_DSI0) {
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 0919039805aa..87acf6be87f6 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -227,7 +227,8 @@ static const struct mtk_ddp_comp_match mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_DSI0] = { MTK_DSI, 0, NULL },
[DDP_COMPONENT_DSI1] = { MTK_DSI, 1, NULL },
[DDP_COMPONENT_GAMMA] = { MTK_DISP_GAMMA, 0, &ddp_gamma },
- [DDP_COMPONENT_OD] = { MTK_DISP_OD, 0, &ddp_od },
+ [DDP_COMPONENT_OD0] = { MTK_DISP_OD, 0, &ddp_od },
+ [DDP_COMPONENT_OD1] = { MTK_DISP_OD, 1, &ddp_od },
[DDP_COMPONENT_OVL0] = { MTK_DISP_OVL, 0, NULL },
[DDP_COMPONENT_OVL1] = { MTK_DISP_OVL, 1, NULL },
[DDP_COMPONENT_PWM0] = { MTK_DISP_PWM, 0, NULL },
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index eee3c0cc2632..9b19fc4423f1 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -50,7 +50,8 @@ enum mtk_ddp_comp_id {
DDP_COMPONENT_DSI0,
DDP_COMPONENT_DSI1,
DDP_COMPONENT_GAMMA,
- DDP_COMPONENT_OD,
+ DDP_COMPONENT_OD0,
+ DDP_COMPONENT_OD1,
DDP_COMPONENT_OVL0,
DDP_COMPONENT_OVL1,
DDP_COMPONENT_PWM0,
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index a415260f3d5f..08d5d0b47bfe 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -150,7 +150,7 @@ static const enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = {
DDP_COMPONENT_OVL0,
DDP_COMPONENT_COLOR0,
DDP_COMPONENT_AAL0,
- DDP_COMPONENT_OD,
+ DDP_COMPONENT_OD0,
DDP_COMPONENT_RDMA0,
DDP_COMPONENT_UFOE,
DDP_COMPONENT_DSI0,
--
2.12.5
^ permalink raw reply related
* [PATCH 05/28] drm/mediatek: add ddp component PWM1
From: Stu Hsieh @ 2018-06-11 3:25 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1528687580-549-1-git-send-email-stu.hsieh@mediatek.com>
This patch add component PWM1 in mtk_ddp_matches
Signed-off-by: Stu Hsieh <stu.hsieh@mediatek.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 87acf6be87f6..a5c7ac2d162d 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -232,6 +232,7 @@ static const struct mtk_ddp_comp_match mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_OVL0] = { MTK_DISP_OVL, 0, NULL },
[DDP_COMPONENT_OVL1] = { MTK_DISP_OVL, 1, NULL },
[DDP_COMPONENT_PWM0] = { MTK_DISP_PWM, 0, NULL },
+ [DDP_COMPONENT_PWM1] = { MTK_DISP_PWM, 1, NULL },
[DDP_COMPONENT_RDMA0] = { MTK_DISP_RDMA, 0, NULL },
[DDP_COMPONENT_RDMA1] = { MTK_DISP_RDMA, 1, NULL },
[DDP_COMPONENT_RDMA2] = { MTK_DISP_RDMA, 2, NULL },
--
2.12.5
^ permalink raw reply related
* [PATCH 06/28] drm/mediatek: add ddp component PWM2
From: Stu Hsieh @ 2018-06-11 3:25 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1528687580-549-1-git-send-email-stu.hsieh@mediatek.com>
This patch add component PWM2
Signed-off-by: Stu Hsieh <stu.hsieh@mediatek.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 +
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index a5c7ac2d162d..86e8c9e5df41 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -233,6 +233,7 @@ static const struct mtk_ddp_comp_match mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_OVL1] = { MTK_DISP_OVL, 1, NULL },
[DDP_COMPONENT_PWM0] = { MTK_DISP_PWM, 0, NULL },
[DDP_COMPONENT_PWM1] = { MTK_DISP_PWM, 1, NULL },
+ [DDP_COMPONENT_PWM2] = { MTK_DISP_PWM, 2, NULL },
[DDP_COMPONENT_RDMA0] = { MTK_DISP_RDMA, 0, NULL },
[DDP_COMPONENT_RDMA1] = { MTK_DISP_RDMA, 1, NULL },
[DDP_COMPONENT_RDMA2] = { MTK_DISP_RDMA, 2, NULL },
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index 9b19fc4423f1..e00c2e798abd 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -56,6 +56,7 @@ enum mtk_ddp_comp_id {
DDP_COMPONENT_OVL1,
DDP_COMPONENT_PWM0,
DDP_COMPONENT_PWM1,
+ DDP_COMPONENT_PWM2,
DDP_COMPONENT_RDMA0,
DDP_COMPONENT_RDMA1,
DDP_COMPONENT_RDMA2,
--
2.12.5
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox