Re: [PATCH v1 5/5] tinydrm: add winstar wg160160 driver

From: Sam Ravnborg
Date: Wed Aug 08 2018 - 04:32:45 EST


Hi Noralf.

On Tue, Aug 07, 2018 at 07:35:30PM +0200, Noralf Trønnes wrote:
>
> Den 02.08.2018 21.45, skrev Sam Ravnborg:
> >Add driver for the winstar wg160160 display.
> >The driver utilises pardata-dbi that
> >again utilise the pardata subsystem.
> >
> >Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
> >---
> > MAINTAINERS | 5 +
> > drivers/gpu/drm/tinydrm/Kconfig | 10 ++
> > drivers/gpu/drm/tinydrm/Makefile | 1 +
> > drivers/gpu/drm/tinydrm/wg160160.c | 298 +++++++++++++++++++++++++++++++++++++
> > 4 files changed, 314 insertions(+)
> > create mode 100644 drivers/gpu/drm/tinydrm/wg160160.c
> >
>
> [...]
>
> >+
> >+/**
> >+ * write_reg - Write instruction on parallel bus to controller
> >+ *
> >+ * Check BUSY flag and write instruction
> >+ *
> >+ * @pdd: pardata data
> >+ * @reg: The register to write
> >+ * @value: The value of the register
> >+ *
> >+ * Returns:
> >+ * Zero on success, negative error code on failure
> >+ */
> >+int write_reg(struct pardata_data *pdd, unsigned int reg, unsigned int value)
> >+{
> >+ int ins[PIN_NUM];
> >+ int val[PIN_NUM];
> >+ int i;
> >+
> >+ for (i = 0; i < PIN_NUM; i++)
> >+ ins[PIN_DB0 + i] = !!BIT(reg);
> >+
> >+ for (i = 0; i < PIN_NUM; i++)
> >+ val[PIN_DB0 + i] = !!(value & BIT(i));
> >+
> >+ gpiod_set_value_cansleep(pdd->bus->pin_rs, 1);
> >+ gpiod_set_array_value_cansleep(PIN_NUM, pdd->bus->data_pins->desc, ins);
> >+ wait_busy(pdd);
> >+ pardata_strobe_write(pdd);
> >+
> >+ gpiod_set_value_cansleep(pdd->bus->pin_rs, 0);
> >+ gpiod_set_array_value_cansleep(PIN_NUM, pdd->bus->data_pins->desc, val);
> >+ wait_busy(pdd);
> >+ pardata_strobe_write(pdd);
> >+
> >+ return 0;
> >+}
>
> If this controller has normal registers, you could do a regmap
> implementation for pardata: drivers/base/regmap.

If I understand you correct then you suggest to add a regmap implementation
on top of the registers replacing the current gpio support?

So we in regmap can optimize access to the registers better.
Or did you have something else in mind?

As speed is not the main challenge here I will likely wait with this
and continue using gpio.

Sam