From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Javier Martinez Canillas <javierm@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org,
"Geert Uytterhoeven" <geert@linux-m68k.org>,
"Maxime Ripard" <maxime@cerno.tech>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
dri-devel@lists.freedesktop.org,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Sam Ravnborg" <sam@ravnborg.org>,
"Noralf Trønnes" <noralf@tronnes.org>,
"Daniel Vetter" <daniel@ffwll.ch>,
"David Airlie" <airlied@linux.ie>
Subject: Re: [PATCH v4 4/6] drm/solomon: Add SSD130x OLED displays I2C support
Date: Fri, 11 Feb 2022 13:16:14 +0200 [thread overview]
Message-ID: <YgZFfljGSH9p979C@smile.fi.intel.com> (raw)
In-Reply-To: <20220211091927.2988283-5-javierm@redhat.com>
On Fri, Feb 11, 2022 at 10:19:25AM +0100, Javier Martinez Canillas wrote:
> The ssd130x driver only provides the core support for these devices but it
> does not have any bus transport logic. Add a driver to interface over I2C.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
>
> Changes in v4:
> - Remove unnecessary casting (Geert Uytterhoeven)
> - Remove redundant blank lines (Andy Shevchenko)
> - Remove comma after of_device_id table terminator (Andy Shevchenko)
>
> Changes in v3:
> - Add a separate driver for SSD130X chips I2C support (Andy Shevchenko)
>
> drivers/gpu/drm/solomon/Kconfig | 9 ++
> drivers/gpu/drm/solomon/Makefile | 1 +
> drivers/gpu/drm/solomon/ssd130x-i2c.c | 116 ++++++++++++++++++++++++++
> 3 files changed, 126 insertions(+)
> create mode 100644 drivers/gpu/drm/solomon/ssd130x-i2c.c
>
> diff --git a/drivers/gpu/drm/solomon/Kconfig b/drivers/gpu/drm/solomon/Kconfig
> index 7720a7039e8d..5861c3ab7c45 100644
> --- a/drivers/gpu/drm/solomon/Kconfig
> +++ b/drivers/gpu/drm/solomon/Kconfig
> @@ -10,3 +10,12 @@ config DRM_SSD130X
> the appropriate bus transport in your chip also must be selected.
>
> If M is selected the module will be called ssd130x.
> +
> +config DRM_SSD130X_I2C
> + tristate "DRM support for Solomon SSD130x OLED displays (I2C bus)"
> + depends on DRM_SSD130X && I2C
> + select REGMAP_I2C
> + help
> + Say Y here if the SSD130x OLED display is connected via I2C bus.
> +
> + If M is selected the module will be called ssd130x-i2c.
> diff --git a/drivers/gpu/drm/solomon/Makefile b/drivers/gpu/drm/solomon/Makefile
> index f685addb19fe..4bfc5acb0447 100644
> --- a/drivers/gpu/drm/solomon/Makefile
> +++ b/drivers/gpu/drm/solomon/Makefile
> @@ -1 +1,2 @@
> obj-$(CONFIG_DRM_SSD130X) += ssd130x.o
> +obj-$(CONFIG_DRM_SSD130X_I2C) += ssd130x-i2c.o
> diff --git a/drivers/gpu/drm/solomon/ssd130x-i2c.c b/drivers/gpu/drm/solomon/ssd130x-i2c.c
> new file mode 100644
> index 000000000000..3126aeda4ced
> --- /dev/null
> +++ b/drivers/gpu/drm/solomon/ssd130x-i2c.c
> @@ -0,0 +1,116 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * DRM driver for Solomon SSD130x OLED displays (I2C bus)
> + *
> + * Copyright 2022 Red Hat Inc.
> + * Author: Javier Martinez Canillas <javierm@redhat.com>
> + *
> + * Based on drivers/video/fbdev/ssd1307fb.c
> + * Copyright 2012 Free Electrons
> + */
> +#include <linux/i2c.h>
> +#include <linux/module.h>
> +
> +#include "ssd130x.h"
> +
> +#define DRIVER_NAME "ssd130x-i2c"
> +#define DRIVER_DESC "DRM driver for Solomon SSD130x OLED displays (I2C)"
> +
> +static const struct regmap_config ssd130x_i2c_regmap_config = {
> + .reg_bits = 8,
> + .val_bits = 8,
> +};
> +
> +static int ssd130x_i2c_probe(struct i2c_client *client)
> +{
> + struct ssd130x_device *ssd130x;
> + struct regmap *regmap;
> +
> + regmap = devm_regmap_init_i2c(client, &ssd130x_i2c_regmap_config);
> + if (IS_ERR(regmap))
> + return PTR_ERR(regmap);
> +
> + ssd130x = ssd130x_probe(&client->dev, regmap);
> + if (IS_ERR(ssd130x))
> + return PTR_ERR(ssd130x);
> +
> + i2c_set_clientdata(client, ssd130x);
> +
> + return 0;
> +}
> +
> +static int ssd130x_i2c_remove(struct i2c_client *client)
> +{
> + struct ssd130x_device *ssd130x = i2c_get_clientdata(client);
> +
> + return ssd130x_remove(ssd130x);
> +}
> +
> +static void ssd130x_i2c_shutdown(struct i2c_client *client)
> +{
> + struct ssd130x_device *ssd130x = i2c_get_clientdata(client);
> +
> + ssd130x_shutdown(ssd130x);
> +}
> +
> +static struct ssd130x_deviceinfo ssd130x_ssd1305_deviceinfo = {
> + .default_vcomh = 0x34,
> + .default_dclk_div = 1,
> + .default_dclk_frq = 7,
> +};
> +
> +static struct ssd130x_deviceinfo ssd130x_ssd1306_deviceinfo = {
> + .default_vcomh = 0x20,
> + .default_dclk_div = 1,
> + .default_dclk_frq = 8,
> + .need_chargepump = 1,
> +};
> +
> +static struct ssd130x_deviceinfo ssd130x_ssd1307_deviceinfo = {
> + .default_vcomh = 0x20,
> + .default_dclk_div = 2,
> + .default_dclk_frq = 12,
> + .need_pwm = 1,
> +};
> +
> +static struct ssd130x_deviceinfo ssd130x_ssd1309_deviceinfo = {
> + .default_vcomh = 0x34,
> + .default_dclk_div = 1,
> + .default_dclk_frq = 10,
> +};
> +
> +static const struct of_device_id ssd130x_of_match[] = {
> + {
> + .compatible = "solomon,ssd1305fb-i2c",
> + .data = &ssd130x_ssd1305_deviceinfo,
> + },
> + {
> + .compatible = "solomon,ssd1306fb-i2c",
> + .data = &ssd130x_ssd1306_deviceinfo,
> + },
> + {
> + .compatible = "solomon,ssd1307fb-i2c",
> + .data = &ssd130x_ssd1307_deviceinfo,
> + },
> + {
> + .compatible = "solomon,ssd1309fb-i2c",
> + .data = &ssd130x_ssd1309_deviceinfo,
> + },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, ssd130x_of_match);
> +
> +static struct i2c_driver ssd130x_i2c_driver = {
> + .driver = {
> + .name = DRIVER_NAME,
> + .of_match_table = ssd130x_of_match,
> + },
> + .probe_new = ssd130x_i2c_probe,
> + .remove = ssd130x_i2c_remove,
> + .shutdown = ssd130x_i2c_shutdown,
> +};
> +module_i2c_driver(ssd130x_i2c_driver);
> +
> +MODULE_DESCRIPTION(DRIVER_DESC);
> +MODULE_AUTHOR("Javier Martinez Canillas <javierm@redhat.com>");
> +MODULE_LICENSE("GPL v2");
> --
> 2.34.1
>
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2022-02-11 11:17 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-11 9:19 [PATCH v4 0/6] drm: Add driver for Solomon SSD130x OLED displays Javier Martinez Canillas
2022-02-11 9:19 ` [PATCH v4 1/6] drm/format-helper: Add drm_fb_xrgb8888_to_gray8_line() Javier Martinez Canillas
2022-02-11 9:29 ` Thomas Zimmermann
2022-02-11 10:28 ` Andy Shevchenko
2022-02-11 10:40 ` Javier Martinez Canillas
2022-02-11 11:12 ` Andy Shevchenko
2022-02-11 11:54 ` Thomas Zimmermann
2022-02-11 12:05 ` Jani Nikula
2022-02-11 12:11 ` Javier Martinez Canillas
2022-02-11 12:27 ` Geert Uytterhoeven
2022-02-11 15:41 ` Andy Shevchenko
2022-02-11 16:25 ` Jani Nikula
2022-02-11 17:27 ` Andy Shevchenko
2022-02-14 9:17 ` Pekka Paalanen
2022-02-14 10:26 ` Andy Shevchenko
2022-02-14 9:03 ` Thomas Zimmermann
2022-02-14 10:38 ` Andy Shevchenko
2022-02-14 10:52 ` Simon Ser
2022-02-14 10:57 ` Geert Uytterhoeven
2022-02-14 12:12 ` Thomas Zimmermann
2022-02-14 12:47 ` Ville Syrjälä
2022-02-14 12:54 ` Thomas Zimmermann
2022-02-14 13:07 ` Ville Syrjälä
2022-02-14 13:59 ` Andy Shevchenko
2022-02-11 9:19 ` [PATCH v4 2/6] drm/format-helper: Add drm_fb_xrgb8888_to_mono_reversed() Javier Martinez Canillas
2022-02-11 11:10 ` Andy Shevchenko
2022-02-11 11:50 ` Javier Martinez Canillas
2022-02-11 15:55 ` Andy Shevchenko
2022-02-11 11:59 ` Thomas Zimmermann
2022-02-11 12:46 ` Thomas Zimmermann
2022-02-11 9:19 ` [PATCH v4 3/6] drm: Add driver for Solomon SSD130x OLED displays Javier Martinez Canillas
2022-02-11 11:33 ` Andy Shevchenko
2022-02-11 12:05 ` Javier Martinez Canillas
2022-02-11 12:23 ` Geert Uytterhoeven
2022-02-11 12:27 ` Javier Martinez Canillas
2022-02-11 15:49 ` Andy Shevchenko
2022-02-11 12:44 ` Thomas Zimmermann
2022-02-11 9:19 ` [PATCH v4 4/6] drm/solomon: Add SSD130x OLED displays I2C support Javier Martinez Canillas
2022-02-11 11:16 ` Andy Shevchenko [this message]
2022-02-11 9:21 ` [PATCH v4 5/6] MAINTAINERS: Add entry for Solomon SSD130x OLED displays DRM driver Javier Martinez Canillas
2022-02-11 11:34 ` Andy Shevchenko
2022-02-11 9:22 ` [PATCH v4 6/6] dt-bindings: display: ssd1307fb: Add myself as binding co-maintainer Javier Martinez Canillas
2022-02-11 11:35 ` Andy Shevchenko
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=YgZFfljGSH9p979C@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=airlied@linux.ie \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert@linux-m68k.org \
--cc=javierm@redhat.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime@cerno.tech \
--cc=noralf@tronnes.org \
--cc=sam@ravnborg.org \
--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;
as well as URLs for NNTP newsgroup(s).