mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 08:34:20 +08:00
a0386bba70
The value returned by an spi driver's remove function is mostly ignored. (Only an error message is printed if the value is non-zero that the error is ignored.) So change the prototype of the remove function to return no value. This way driver authors are not tempted to assume that passing an error to the upper layer is a good idea. All drivers are adapted accordingly. There is no intended change of behaviour, all callbacks were prepared to return 0 before. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Acked-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Claudius Heine <ch@denx.de> Acked-by: Stefan Schmidt <stefan@datenfreihafen.org> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC Acked-by: Marcus Folkesson <marcus.folkesson@gmail.com> Acked-by: Łukasz Stelmach <l.stelmach@samsung.com> Acked-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20220123175201.34839-6-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
89 lines
2.0 KiB
C
89 lines
2.0 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/module.h>
|
|
#include <linux/spi/spi.h>
|
|
#include <linux/delay.h>
|
|
|
|
#include <drm/drm_mipi_dbi.h>
|
|
#include <drm/drm_print.h>
|
|
|
|
#include "panel-samsung-s6e63m0.h"
|
|
|
|
static const u8 s6e63m0_dbi_read_commands[] = {
|
|
MCS_READ_ID1,
|
|
MCS_READ_ID2,
|
|
MCS_READ_ID3,
|
|
0, /* sentinel */
|
|
};
|
|
|
|
static int s6e63m0_spi_dcs_read(struct device *dev, void *trsp,
|
|
const u8 cmd, u8 *data)
|
|
{
|
|
struct mipi_dbi *dbi = trsp;
|
|
int ret;
|
|
|
|
ret = mipi_dbi_command_read(dbi, cmd, data);
|
|
if (ret)
|
|
dev_err(dev, "error on DBI read command %02x\n", cmd);
|
|
|
|
return ret;
|
|
}
|
|
|
|
static int s6e63m0_spi_dcs_write(struct device *dev, void *trsp,
|
|
const u8 *data, size_t len)
|
|
{
|
|
struct mipi_dbi *dbi = trsp;
|
|
int ret;
|
|
|
|
ret = mipi_dbi_command_stackbuf(dbi, data[0], (data + 1), (len - 1));
|
|
usleep_range(300, 310);
|
|
|
|
return ret;
|
|
}
|
|
|
|
static int s6e63m0_spi_probe(struct spi_device *spi)
|
|
{
|
|
struct device *dev = &spi->dev;
|
|
struct mipi_dbi *dbi;
|
|
int ret;
|
|
|
|
dbi = devm_kzalloc(dev, sizeof(*dbi), GFP_KERNEL);
|
|
if (!dbi)
|
|
return -ENOMEM;
|
|
|
|
ret = mipi_dbi_spi_init(spi, dbi, NULL);
|
|
if (ret)
|
|
return dev_err_probe(dev, ret, "MIPI DBI init failed\n");
|
|
/* Register our custom MCS read commands */
|
|
dbi->read_commands = s6e63m0_dbi_read_commands;
|
|
|
|
return s6e63m0_probe(dev, dbi, s6e63m0_spi_dcs_read,
|
|
s6e63m0_spi_dcs_write, false);
|
|
}
|
|
|
|
static void s6e63m0_spi_remove(struct spi_device *spi)
|
|
{
|
|
s6e63m0_remove(&spi->dev);
|
|
}
|
|
|
|
static const struct of_device_id s6e63m0_spi_of_match[] = {
|
|
{ .compatible = "samsung,s6e63m0" },
|
|
{ /* sentinel */ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, s6e63m0_spi_of_match);
|
|
|
|
static struct spi_driver s6e63m0_spi_driver = {
|
|
.probe = s6e63m0_spi_probe,
|
|
.remove = s6e63m0_spi_remove,
|
|
.driver = {
|
|
.name = "panel-samsung-s6e63m0",
|
|
.of_match_table = s6e63m0_spi_of_match,
|
|
},
|
|
};
|
|
module_spi_driver(s6e63m0_spi_driver);
|
|
|
|
MODULE_AUTHOR("Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>");
|
|
MODULE_DESCRIPTION("s6e63m0 LCD SPI Driver");
|
|
MODULE_LICENSE("GPL v2");
|