[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2f8c6467-4aa4-47d6-56ad-dc1252a2ffa2@tronnes.org>
Date: Wed, 8 Aug 2018 18:31:28 +0200
From: Noralf Trønnes <noralf@...nnes.org>
To: Sam Ravnborg <sam@...nborg.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH v1 5/5] tinydrm: add winstar wg160160 driver
Den 08.08.2018 10.32, skrev Sam Ravnborg:
> 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@...nborg.org>
>>> ---
>>> 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?
I was thinking of a regmap-pardata.c like drivers/base/regmap/regmap-i2c.c.
It's not much code an we would avoid having generic register access
functions in DRM. It's not about speed or caching, but just to try and
put code where it logically belongs.
Here is one experiment where I have created a regmap on a 8080 bus:
https://github.com/notro/tinydrm/blob/master/tinydrm-regmap.c
Used here: https://github.com/notro/tinydrm/blob/master/fb_ili9325.c
I don't advocate this particular approach, I mention it just as an
example of using regmap in a tinydrm driver.
Noralf.
> As speed is not the main challenge here I will likely wait with this
> and continue using gpio.
>
> Sam
Powered by blists - more mailing lists