From: Amit Barzilai <amit.barzilai22@gmail.com>
To: Javier Martinez Canillas <javierm@redhat.com>
Cc: airlied@gmail.com, andriy.shevchenko@intel.com,
conor+dt@kernel.org, devicetree@vger.kernel.org,
dri-devel@lists.freedesktop.org, krzk+dt@kernel.org,
linux-kernel@vger.kernel.org, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, robh@kernel.org, simona@ffwll.ch,
tzimmermann@suse.de
Subject: Re: [PATCH v3 3/3] drm/ssd130x: Add SSD135X_FAMILY and SSD1351 support
Date: Wed, 22 Jul 2026 10:19:11 +0300 [thread overview]
Message-ID: <20260722071921.43687-1-amit.barzilai22@gmail.com> (raw)
In-Reply-To: <87y0fbs05w.fsf@ocarina.mail-host-address-is-not-set>
Javier Martinez Canillas <javierm@redhat.com> wrote:
>> */
>> -static int ssd130x_write_data(struct ssd130x_device *ssd130x, u8 *values, int count)
>> +static int ssd130x_write_data(struct ssd130x_device *ssd130x, const u8 *values, int count)
>> {
>> return regmap_bulk_write(ssd130x->regmap, SSD13XX_DATA, values, count);
>> }
>
>>
>
> This change is correct but need to be split in a separate preparatory
> patch. When you do that, feel free to add my Reviewed-by tag.
Agreed, adding to v4.
> Please split these ssd130x_write_cmds() and ssd1330x_write_cmd() refactoring
> as separate preparatory patches. This patch is changing too many things at
> once, it is better to have each logical changes as a separate patch. This
> makes reviewer much easier.
Ditto.
> I don't like that this logic is in the ssd130x core part of the driver. This
> is supposed to be transport agonistic and should not be aware of the D/C#
> behaviour that is specific to the SPI transport.
>
> Can we move this to the ssd130x-spi driver? For example, something like the
> following might work:
>
> 1. Make ssd130x_write_cmds() to just be a static inline wrapper that calls
> to regmap_raw_write(ssd130x->regmap, SSD13XX_COMMAND, cmd, len).
>
> 2. Make ssd130x_write_cmd() be a variadic wrapper around ssd130x_write_cmds().
>
> 3. Add your logic to ssd130x_spi_write() instead of ssd130x_write_cmds(), that
> way it stays in the correct layer rather than having a leaking abstraction.
I agree, in hindsight this code goes against the transport abstraction.
I'd propose keeping 1 and 2 in a single patch, though. Making ssd130x_write_cmds()
a wrapper around regmap_raw_write() and making ssd130x_write_cmd() a variadic wrapper
around ssd130x_write_cmds() are two halves of the same change: routing command buffers
through regmap_raw_write(). Splitting them would leave an intermediate state that isn't
independently meaningful. Happy to split if you'd still prefer it.
> Also, instead of checking for info->family_id == SSD135X_FAMILY, we could add
> a dc_high_params member (or whatever name is more suitable) to the struct
> ssd130x_spi_transport Then other families that might use the same can just
> reuse this option instead of checking for specific families.
I agree that hard-coding a check for the family isn't open for extension and should be changed.
Adding a member for this in ssd130x_spi_transport is a fitting solution, I'll populate it in
ssd130x_spi_probe() using a static array that will describe which families need dc_high_params.
I'd keep that table in ssd130x-spi.c rather than adding a flag to ssd130x_deviceinfo, so the
D/C# concern stays in the SPI layer instead of leaking into the transport-agnostic device info.
>> + /*
>> + * No long post-reset delay: the controller datasheets only specify
>> + * microsecond-scale reset timing. The lengthy delay seen in some other
>> + * drivers comes from fbtft's generic reset helper and targets slow
>> + * parallel-bus GPIOs, which do not apply here.
>> + */
>> }
>>
>
> I don't understand the point of this comment. You are not changing the logic
> of this function nor I see how this comment is useful.
I originally added a redundant delay that I saw in fb_ssd1351.c, when Andy
noticed it he told me to add a comment so others could understand the difference
between this driver and the fb counterpart.
I agree that it shouldn't be included in v4, it was a specific mistake and I
highly doubt others will see similar situations and if so they can easily research
the subject.
> Instead of ssd133x_write_pixels() and having per family logic in the primary
> place update path, I prefer to have a little bit more of code duplication
> and add an .atomic_update, .atomic_disable, etc for the SSD1351.
>
> Yes, I know that your current approach reduces code duplication but also
> makes it harder to change the primary plane update path for a family without
> affecting another one. This is particularly important in my opinion, given
> that contributors usually just test on their display family when posting
> the patches. So I prefer to have per family callbacks if possible.
Agreed, I'll add per-family .atomic_update/.atomic_disable for SSD135X in v4 and drop
the shared ssd133x_write_pixels() path.
The one thing I'd keep shared is the atomic_check callbacks
(ssd133x_primary_plane_atomic_check and ssd133x_crtc_atomic_check): they have no
family-specific branching - the plane check is generic and the CRTC check only
allocates the RGB565 data_array, which SSD135X needs identically. So I'd reuse them
via the table rather than duplicate. Let me know if you'd rather those were split too.
> Again I wonder if is better to have a device_info member to decide whether to
> register the backlight, instead of harcoding the check for a specific family.
I already have a draft for splitting ssd130x_update_bl() to be per family, removing
the need for this code. I prefer to first submit that patch, and then mention it as
a dependency for v4 of this series.
Feel free to suggest a different solution.
--
Thanks,
Amit
next prev parent reply other threads:[~2026-07-22 7:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-04 8:09 [PATCH v3 0/3] drm/ssd130x: Add support for the Solomon SSD1351 OLED controller Amit Barzilai
2026-07-04 8:09 ` [PATCH v3 1/3] dt-bindings: display: Add " Amit Barzilai
2026-07-04 8:17 ` sashiko-bot
2026-07-06 8:39 ` Amit Barzilai
2026-07-04 8:09 ` [PATCH v3 2/3] drm/ssd130x: Change SSD133X color format to RGB565 from RGB332 Amit Barzilai
2026-07-04 8:23 ` sashiko-bot
2026-07-16 8:36 ` Javier Martinez Canillas
2026-07-22 3:47 ` Amit Barzilai
2026-07-04 8:09 ` [PATCH v3 3/3] drm/ssd130x: Add SSD135X_FAMILY and SSD1351 support Amit Barzilai
2026-07-04 8:26 ` sashiko-bot
2026-07-16 9:35 ` Andy Shevchenko
2026-07-22 3:57 ` Amit Barzilai
2026-07-16 10:23 ` Javier Martinez Canillas
2026-07-22 7:19 ` Amit Barzilai [this message]
2026-07-22 7:52 ` Javier Martinez Canillas
2026-07-06 10:46 ` [PATCH v3 0/3] drm/ssd130x: Add support for the Solomon SSD1351 OLED controller Javier Martinez Canillas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260722071921.43687-1-amit.barzilai22@gmail.com \
--to=amit.barzilai22@gmail.com \
--cc=airlied@gmail.com \
--cc=andriy.shevchenko@intel.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox