mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 22:14:04 +02:00
drm/bridge: add psave gpio control for dumb-vga-dac
Change-Id: If2c5402d842e13df4baf2d608718e0597f5d4ff7 Signed-off-by: Jerry Xu <xbl@rock-chips.com>
This commit is contained in:
parent
1a0b9345e8
commit
751b94a7e9
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_graph.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
#include <drm/drmP.h>
|
||||
|
|
@ -25,6 +26,7 @@ struct dumb_vga {
|
|||
|
||||
struct i2c_adapter *ddc;
|
||||
struct regulator *vdd;
|
||||
struct gpio_desc *psave_gpio;
|
||||
};
|
||||
|
||||
static inline struct dumb_vga *
|
||||
|
|
@ -136,12 +138,18 @@ static void dumb_vga_enable(struct drm_bridge *bridge)
|
|||
|
||||
if (ret)
|
||||
DRM_ERROR("Failed to enable vdd regulator: %d\n", ret);
|
||||
|
||||
if (vga->psave_gpio)
|
||||
gpiod_direction_output(vga->psave_gpio, 1);
|
||||
}
|
||||
|
||||
static void dumb_vga_disable(struct drm_bridge *bridge)
|
||||
{
|
||||
struct dumb_vga *vga = drm_bridge_to_dumb_vga(bridge);
|
||||
|
||||
if (vga->psave_gpio)
|
||||
gpiod_direction_output(vga->psave_gpio, 0);
|
||||
|
||||
if (vga->vdd)
|
||||
regulator_disable(vga->vdd);
|
||||
}
|
||||
|
|
@ -177,6 +185,7 @@ static struct i2c_adapter *dumb_vga_retrieve_ddc(struct device *dev)
|
|||
static int dumb_vga_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct dumb_vga *vga;
|
||||
int err;
|
||||
|
||||
vga = devm_kzalloc(&pdev->dev, sizeof(*vga), GFP_KERNEL);
|
||||
if (!vga)
|
||||
|
|
@ -192,6 +201,13 @@ static int dumb_vga_probe(struct platform_device *pdev)
|
|||
dev_dbg(&pdev->dev, "No vdd regulator found: %d\n", ret);
|
||||
}
|
||||
|
||||
vga->psave_gpio = devm_gpiod_get_optional(&pdev->dev, "psave", 0);
|
||||
if (IS_ERR(vga->psave_gpio)) {
|
||||
err = PTR_ERR(vga->psave_gpio);
|
||||
dev_err(&pdev->dev, "failed to get psave GPIO: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
vga->ddc = dumb_vga_retrieve_ddc(&pdev->dev);
|
||||
if (IS_ERR(vga->ddc)) {
|
||||
if (PTR_ERR(vga->ddc) == -ENODEV) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user