summaryrefslogtreecommitdiffstats
path: root/drivers/video/ssd1307fb.c
Commit message (Collapse)AuthorAgeFilesLines
* treewide: add MODULE_DEVICE_TABLE markersAhmad Fatoum2023-06-131-0/+1
| | | | | | | | | | | | | | | | Syncing device trees with Linux upstream can lead to breakage, when the device trees are switched to newer bindings, which are not yet supported in barebox. To make it easier to spot such issues, we want to start applying some heuristics to flag possibly problematic DT changes. One step towards being able to do that is to know what nodes barebox actually consumes. Most of the nodes have a compatible entry, which is matched by an array of of_device_id, so let's have MODULE_DEVICE_TABLE point at it for future extraction. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612125908.1087340-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* dev: add dev_bus_is_spi/i2c helpersAhmad Fatoum2023-01-121-2/+2
| | | | | | | | | These will simplify writing drivers that can probe via either I2C or SPI like the SSD1307FB and upcoming KSZ I2C switch support. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230111132956.1153359-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct driver_d to driverSascha Hauer2023-01-101-2/+2
| | | | | | | | | | | The '_d' suffix was originally meant to distinguish barebox struct names from Linux struct names. struct driver doesn't exist in Linux, so we can rename it and remove the meaningless suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-101-1/+1
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename device_d::device_node to device_d::of_nodeSascha Hauer2023-01-101-2/+2
| | | | | | | | | | | | | | | | | | | | Linux struct device has the member of_node for the device_node pointer. Rename this in barebox accordingly to minimize the necessary changes when porting Linux code. This was done with the semantic patch: @@ struct device_d E; @@ - E.device_node + E.of_node @@ struct device_d *E; @@ - E->device_node + E->of_node Plus some manual adjustments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video: ssd1307fb: add spi supportMichael Tretter2022-01-031-6/+56
| | | | | | | | | | | | | The Solomon display drivers also support SPI in addition to the I2C. Add SPI support to the driver that already supports I2C by implementing the bus write function for SPI and registering an SPI driver. While the driver needs I2C or SPI, either subsystem is optional as long as one is enabled. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Link: https://lore.barebox.org/20211223160404.119970-9-m.tretter@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video: ssd1307fb: use function pointer for writeMichael Tretter2022-01-031-9/+17
| | | | | | | | | | | | | The function pointer is an abstraction the I2C accesses to be able to add other bus protocols underneath the driver. The functionality kind of reminds of regmap, but the driver does only write data and does not actually use registers. Therefore, using regmap with the register abstraction is not appropriate. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Link: https://lore.barebox.org/20211223160404.119970-8-m.tretter@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video: ssd1307fb: move i2c setup to single placeMichael Tretter2022-01-031-4/+3
| | | | | | | | | By having the entire i2c dependent initialzation in a single place, it is easier to make it optional later. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Link: https://lore.barebox.org/20211223160404.119970-7-m.tretter@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video: ssd1307fb: don't use i2c client for loggingMichael Tretter2022-01-031-10/+10
| | | | | | | | | We can use the device directly and don't have to use the device that is attached to the I2C client. This reduces the dependency on i2c. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Link: https://lore.barebox.org/20211223160404.119970-6-m.tretter@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video: ssd1307fb: pass par instead of i2c client to writeMichael Tretter2022-01-031-34/+35
| | | | | | | | | | By pushing the dependency to i2c down into the write function, the remaining driver is less dependent on i2c. This allows to delay the decision to use i2c until the actual bus write. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Link: https://lore.barebox.org/20211223160404.119970-5-m.tretter@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: add missing SPDX-License-IdentifierAhmad Fatoum2021-11-011-2/+1
| | | | | | | | | | | | | | | | | | | | This adds the suitable SPDX-License-Identifier to all files in drivers/ that previously lacked one. To aid manual inspection, following heuristics can be used: * No changes outside of comments/whitespace: git show -U0 HEAD | rg -v '^(@@|diff|index)|[-+]([-+]|//|#|[\s/]\*)' * -or-later come in pairs: git show --inter-hunk-context=19 HEAD | \ perl -0777 -F'/^@/gm' -ne 'for (@F) { @m = /later/g; print if @m & 1 }' Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175632.2276077-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video: reunite fb devices with their hardware parentAhmad Fatoum2021-06-021-0/+1
| | | | | | | | | | | | So far, only sdlfb and efi associated the framebuffer device they register with the hardware device providing it. Follow suit for all other frame buffers. This enables devinfo to display parentage. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210527124453.22710-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video: ssd1307fb: fix VBAT supply idMarco Felsch2020-09-291-1/+1
| | | | | | | | | The regulator id should be given without the "-supply" suffix else the core is searching for "vbat-supply-supply". Fixes: bf8f62d334 ("video/ssd1307fb: add support for VBAT") Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video: ssd1307fb: Honour reset GPIO polaritySascha Hauer2020-08-181-7/+11
| | | | | | | The reset GPIO polarity was hardcoded as active low. Honour the polarity flags given in the device tree instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video: ssd1307fb: fix null pointer dereference on errorAhmad Fatoum2020-05-041-1/+1
| | | | | | | | | | On error, a goto may jump over the initialization of vmem and free the uninitialized value during clean up. Fix this. Found by compiling the code with clang. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video/ssd1307fb: make reset GPIO optionalAhmad Fatoum2020-03-091-20/+23
| | | | | | | | Both reset GPIO and regulator are optional as per the binding and the driver can work without if we ignore their absence. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video/ssd1307fb: drop unneeded regulator NULL checksAhmad Fatoum2020-03-091-10/+6
| | | | | | | | regulator_{enable,disable} are already no-ops when the parameter is NULL. Drop the NULL checks thusly. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video/ssd1307fb: fix NULL pointer dereference in probeAhmad Fatoum2020-03-091-1/+3
| | | | | | | | info->priv is dereferenced before a valid value has been set leading to a NULL pointer dereference in the probe function. Fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video/ssd1307fb: fix potential memory leak on errorOleksij Rempel2018-11-191-2/+5
| | | | | Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: introduce device_i2c_driver() macroMarco Felsch2018-10-191-9/+1
| | | | | | | | | Add macro and dependency to avoid boilerplate code. Since now simple i2c drivers only have to include the i2c.h header and call the device_i2c_driver() macro to register a i2c device driver. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* video/ssd1307fb: add support for VBATBastian Stender2017-07-301-0/+24
| | | | | | | | | | | Adds support to the driver to enable VBAT regulator at init time. This is similar to ba14301e0356 ("fbdev/ssd1307fb: add support to enable VBAT") and cfc5b2b551d8 ("fbdev/ssd1307fb: fix optional VBAT support") in Linux kernel. Signed-off-by: Bastian Stender <bst@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* video: add support for Solomon SSD1307 OLED controller familyBastian Stender2017-03-061-0/+567
It was ported from linux v4.10. Like the kernel driver only communication via I2C is supported. It has only been tested with a SSD1306 and a 96x16 OLED display: &i2c0 { status = "okay"; ssd1306: oled@3c { compatible = "solomon,ssd1306fb-i2c"; reg = <0x3c>; reset-gpios = <&gpio1 1 0>; solomon,height = <16>; solomon,width = <96>; solomon,page-offset = <0>; solomon,com-invdir; solomon,com-seq; }; Signed-off-by: Bastian Stender <bst@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>