[PATCH v3 1/2] drm: bridge: Add sii902x driver

Meng Yi meng.yi at nxp.com
Fri Apr 22 09:58:34 UTC 2016


Hi Boris,

> -----Original Message-----
> From: Boris Brezillon [mailto:boris.brezillon at free-electrons.com]
> +

> +static int sii902x_bridge_attach(struct drm_bridge *bridge) {
> +	const struct drm_connector_funcs *funcs = &sii902x_connector_funcs;
> +	struct sii902x *sii902x = bridge_to_sii902x(bridge);
> +	struct drm_device *drm = bridge->dev;
> +	int ret;
> +
> +	drm_connector_helper_add(&sii902x->connector,
> +				 &sii902x_connector_helper_funcs);
> +
> +	if (drm_core_check_feature(drm, DRIVER_ATOMIC))
> +		funcs = &sii902x_atomic_connector_funcs;
> +
> +	ret = drm_connector_init(drm, &sii902x->connector, funcs,
> +				 DRM_MODE_CONNECTOR_HDMIA);
> +	if (ret)
> +		return ret;
> +


I think drm_connector_register should be used here, or drmlib can't find this connector.


> +	if (sii902x->i2c->irq > 0)
> +		sii902x->connector.polled = DRM_CONNECTOR_POLL_HPD;
> +	else
> +		sii902x->connector.polled =
> DRM_CONNECTOR_POLL_CONNECT;
> +
> +	drm_mode_connector_attach_encoder(&sii902x->connector,
> +bridge->encoder);
> +
> +	return 0;
> +}
> +

...
> +
> +static int sii902x_probe(struct i2c_client *client,
> +			 const struct i2c_device_id *id)
> +{
> +	struct device *dev = &client->dev;
> +	unsigned int status = 0;
> +	struct sii902x *sii902x;
> +	u8 chipid[4];
> +	int ret;
> +
> +	sii902x = devm_kzalloc(dev, sizeof(*sii902x), GFP_KERNEL);
> +	if (!sii902x)
> +		return -ENOMEM;
> +
> +	sii902x->i2c = client;
> +	sii902x->regmap = devm_regmap_init_i2c(client,
> &sii902x_regmap_config);
> +	if (IS_ERR(sii902x->regmap))
> +		return PTR_ERR(sii902x->regmap);
> +
> +	sii902x->reset_gpio = devm_gpiod_get(dev, "reset",
> GPIOD_OUT_LOW);
> +	if (IS_ERR(sii902x->reset_gpio)) {
> +		dev_err(dev, "Failed to retrieve/request reset gpio: %ld\n",
> +			PTR_ERR(sii902x->reset_gpio));
> +		return PTR_ERR(sii902x->reset_gpio);


Maybe we can use  "warning" instead of "dev_err" if there is no "reset_gpio" , because some board using CPLD to manage the reset order , they can't reset the HDMI chip independently.

> +	}
> +
> +	sii902x_reset(sii902x);
> +

Regards,
Meng


More information about the dri-devel mailing list