summaryrefslogtreecommitdiff
path: root/drivers/regulator/rpi-panel-attiny-regulator.c
AgeCommit message (Collapse)Author
2023-08-08regulator: rpi-panel-attiny: Drop useless headerLinus Walleij
The RPI panel regulator driver includes the legacy header <linux/gpio.h> for no reason, this is a driver and <linux/gpio/driver.h> is already included. Drop the include. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230808-descriptors-regulator-v1-3-939b5e84dd18@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-07regulator: rpi-panel-attiny-regulator: Remove redundant of_match_ptr()Ruan Jinjie
The driver depends on CONFIG_OF, so it is not necessary to use of_match_ptr() here, and __maybe_unused can also be removed. Even for drivers that do not depend on CONFIG_OF, it's almost always better to leave out the of_match_ptr(), since the only thing it can possibly do is to save a few bytes of .text if a driver can be used both with and without it. Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> Link: https://lore.kernel.org/r/20230807134127.2380390-1-ruanjinjie@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-08regulator: Switch i2c drivers back to use .probe()Uwe Kleine-König
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type"), all drivers being converted to .probe_new() and then 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert back to (the new) .probe() to be able to eventually drop .probe_new() from struct i2c_driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de Link: https://lore.kernel.org/r/20230505220218.1239542-1-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org
2023-03-20regulator: Set PROBE_PREFER_ASYNCHRONOUS for drivers between 5.4 and 5.10Douglas Anderson
This follows on the change ("regulator: Set PROBE_PREFER_ASYNCHRONOUS for drivers that existed in 4.14") but changes regulators didn't exist in Linux 5.4 but did exist in Linux 5.10. Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://lore.kernel.org/r/20230316125351.4.I01f21c98901641a009890590ddc1354c0f294e5e@changeid Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-22regulator: rpi-panel-attiny-regulator: Convert to i2c's .probe_new()Uwe Kleine-König
The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-for-MFD-by: Lee Jones <lee@kernel.org> Acked-for-Backlight-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20221118224540.619276-556-uwe@kleine-koenig.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-08-16i2c: Make remove callback return voidUwe Kleine-König
The value returned by an i2c 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. Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com> Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au> Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Crt Mori <cmo@melexis.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013 Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/* Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5 Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860 Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power Acked-by: Krzysztof Hałasa <khalasa@piap.pl> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
2022-06-13regulator: rpi-panel-attiny: Use backlight helperStephen Kitt
backlight_properties.fb_blank is deprecated. The states it represents are handled by other properties; but instead of accessing those properties directly, drivers should use the helpers provided by backlight.h. Instead of retrieving the backlight brightness in struct backlight_properties manually, and then checking whether the backlight should be on at all, use backlight_get_brightness() which does all this and insulates this from future changes. Signed-off-by: Stephen Kitt <steve@sk2.org> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220607185304.1128962-1-steve@sk2.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-06regulator: rpi-panel-attiny: Get rid of duplicate of_node assignmentAndy Shevchenko
GPIO library does copy the of_node from the parent device of the GPIO chip, there is no need to repeat this in the individual drivers. Remove these assignment all at once. For the details one may look into the of_gpio_dev_init() implementation. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220325184508.45670-1-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-28regulator/rpi-panel-attiny: Use two transactions for I2C readDave Stevenson
The I2C to the Atmel is very fussy, and locks up easily on Pi0-3 particularly on reads. If running at 100kHz on Pi3, reading the ID register generally locks up the Atmel, but splitting the register select write and read into two transactions is reliable. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com> Link: https://lore.kernel.org/r/20220124220129.158891-10-detlev.casanova@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-28regulator/rpi-panel-attiny: Use the regmap cacheDave Stevenson
The I2C to the Atmel is very fussy, and locks up easily on Pi0-3 particularly on reads. The LCD power status is controlled solely by this driver, so rather than reading it back from the Atmel, use the regmap cache to avoid reading values. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com> Link: https://lore.kernel.org/r/20220124220129.158891-9-detlev.casanova@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-28regulator: rpi-panel: Remove get_brightness hookDave Stevenson
The driver was implementing a get_brightness function that tried to read back the PWM setting of the display to report as the current brightness. The controller on the display does not support that, therefore we end up reporting a brightness of 0, and that confuses systemd's backlight service. Remove the hook so that the framework returns the current brightness automatically. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com> Link: https://lore.kernel.org/r/20220124220129.158891-8-detlev.casanova@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-28regulator: rpi-panel: Add GPIO control for panel and touch resetsDave Stevenson
We need independent control of the resets for the panel&bridge, vs the touch controller. Expose the reset lines that are on the Atmel's port C via the GPIO API so that they can be controlled appropriately. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com> Link: https://lore.kernel.org/r/20220124220129.158891-7-detlev.casanova@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-28regulator: rpi-panel: Convert to drive lines directlyDave Stevenson
The Atmel was doing a load of automatic sequencing of control lines, however it was combining the touch controller's reset with the bridge/panel control. Change to control the control signals directly rather than through the automatic POWERON control. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com> Link: https://lore.kernel.org/r/20220124220129.158891-6-detlev.casanova@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-28regulator: rpi-panel: Ensure the backlight is off during probe.Dave Stevenson
The initial state of the Atmel is not defined, so ensure the backlight PWM is set to 0 by default. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com> Link: https://lore.kernel.org/r/20220124220129.158891-5-detlev.casanova@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-28regulator: rpi-panel: Serialise operations.Dave Stevenson
The driver was using the regmap lock to serialise the individual accesses, but we really need to protect the timings of enabling the regulators, including any communication with the Atmel. Use a mutex within the driver to control overall accesses to the Atmel, instead of the regmap lock. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com> Link: https://lore.kernel.org/r/20220124220129.158891-4-detlev.casanova@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-28regulator: rpi-panel: Handle I2C errors/timing to the AtmelDave Stevenson
The Atmel is doing some things in the I2C ISR, during which period it will not respond to further commands. This is particularly true of the POWERON command. Increase delays appropriately, and retry should I2C errors be reported. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com> Link: https://lore.kernel.org/r/20220124220129.158891-3-detlev.casanova@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-28regulator: rpi-panel: Register with a unique backlight nameDave Stevenson
There's no reason why 2 Raspberry Pi DSI displays can't be attached to a Pi Compute Module, so the backlight names need to be unique. Use the parent dev_name. It's not as readable, but is unique. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com> Link: https://lore.kernel.org/r/20220124220129.158891-2-detlev.casanova@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-18regulator: rpi-panel: Add regulator/backlight driver for RPi panelMarek Vasut
This regulator/backlight driver handles the ATTINY88 present on the RPi 7" touchscreen panel and exposes the power/backlight interfaces. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Eric Anholt <eric@anholt.net> Cc: Mark Brown <broonie@kernel.org> Cc: Sam Ravnborg <sam@ravnborg.org> To: dri-devel@lists.freedesktop.org Link: https://lore.kernel.org/r/20200809105938.6388-2-marex@denx.de Signed-off-by: Mark Brown <broonie@kernel.org>