Re: [PATCH v2] drm/bridge: simple-bridge: Add support for TI TDP158

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/05/2024 03:13, Dmitry Baryshkov wrote:

> Bindings please. Also, note that per the datasheet the bridge uses two
> supplies, Vcc for 3.3V and Vdd for 1.1V, so it doesn't fully fit the
> simple-bridge.c (which might need to be adjusted for the second supply).
> Chapter 7.3.2 of the datasheet points out that Vcc should be brought up
> before Vdd.

Is something simple like below acceptable?


// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright 2024 Freebox SAS
 */

#include <drm/drm_bridge.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/delay.h>

struct tdp158 {
	struct i2c_client *client;
	struct gpio_desc *OE; // Operation Enable
	struct drm_bridge bridge;
};

static int tdp158_probe(struct i2c_client *client)
{
	struct device *dev = &client->dev;
	struct tdp158 *tdp158;
	int err;

	tdp158 = devm_kzalloc(dev, sizeof(*tdp158), GFP_KERNEL);
	if (!tdp158)
		return -ENOMEM;

	tdp158->client = client;
	i2c_set_clientdata(client, tdp158);

	err = devm_regulator_get_enable(dev, "Vcc"); // 3.3V
	msleep(100);
	if (err)
		return dev_err_probe(dev, err, "Vcc");

	err = devm_regulator_get_enable(dev, "Vdd"); // 1.1V
	msleep(100);
	if (err)
		return dev_err_probe(dev, err, "Vdd");

	tdp158->OE = devm_gpiod_get(dev, "OE", GPIOD_OUT_LOW);
	if (IS_ERR(tdp158->OE))
		return dev_err_probe(dev, PTR_ERR(tdp158->OE), "OE pin");

	gpiod_set_value_cansleep(tdp158->OE, 1);

	tdp158->bridge.of_node = dev->of_node;

	return devm_drm_bridge_add(dev, &tdp158->bridge);
}

static const struct of_device_id tdp158_match_table[] = {
	{ .compatible = "ti,tdp158" },
	{ }
};
MODULE_DEVICE_TABLE(of, tdp158_match_table);

static struct i2c_driver tdp158_driver = {
	.probe = tdp158_probe,
	.driver = {
		.name = "tdp158",
		.of_match_table = tdp158_match_table,
	},
};

module_i2c_driver(tdp158_driver);

MODULE_DESCRIPTION("TI TDP158 driver");
MODULE_LICENSE("GPL");




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux