Skip to contentSkip to conversation

Make "ti,tilcdc,slave" DT binding more sensible

RFC PATCH In review Jyri Sarha 3 participants 6 messages Jan 13, 2015 – Jan 14, 2015 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore

Jyri Sarha

author
#0 lore raw

cover Make "ti,tilcdc,slave" DT binding more sensible

These patches are needed for Beaglebone-back HDMI audio. There is no direct dependency between these patches and the other (dts and ASoC) changes needed for the HDMI audio so these changes can be merged independently. I also feel that these changes make sense even without the HDMI audio.

Best regards,
Jyri

Jyri Sarha (3):
drm: encoder_slave: Add drm_i2c_encoder_attach() drm/tilcdc: slave: Add support for "i2c-slave" DT-parameter
ARM: dts: am335x-boneblack: Use new binding in ti,tilcdc,slave node

 .../devicetree/bindings/drm/tilcdc/slave.txt       |    4 +-
 arch/arm/boot/dts/am335x-boneblack.dts             |    9 +++-
 drivers/gpu/drm/drm_encoder_slave.c                |   51 ++++++++++++++++++++
 drivers/gpu/drm/tilcdc/tilcdc_slave.c              |   50 +++++++++++--------
 include/drm/drm_encoder_slave.h                    |    3 ++
 5 files changed, 95 insertions(+), 22 deletions(-)
Signature · 1 line
1.7.9.5
author
#1 lore raw

RFC PATCH 1/3 drm: encoder_slave: Add drm_i2c_encoder_attach()

Add drm_i2c_encoder_attach() for attaching an already probed i2c encoder. This is needed for instance if the encoder is probed from device tree.

---
 drivers/gpu/drm/drm_encoder_slave.c |   51 +++++++++++++++++++++++++++++++++++
 include/drm/drm_encoder_slave.h     |    3 +++
 2 files changed, 54 insertions(+)
drivers/gpu/drm/drm_encoder_slave.c +51 -0
index d18b88b..ed627f7 100644
@@ -120,6 +120,57 @@ void drm_i2c_encoder_destroy(struct drm_encoder *drm_encoder)
 }
 EXPORT_SYMBOL(drm_i2c_encoder_destroy);
 
+/**
+ * drm_i2c_encoder_attach - Attach an I2C slave encoder
+ * @dev:	DRM device.
+ * @encoder:	Encoder to be attached to the I2C device. You aren't
+ *		required to have called drm_encoder_init() before.
+ * @client:	I2C encoder to be attached.
+ *
+ * Attach the I2C device specified to the specified &drm_encoder_slave.
+ * The @slave_funcs field will be initialized with the hooks provided by
+ * the slave driver.
+ *
+ * Returns 0 on success or a negative errno on failure, in particular,
+ * -ENODEV is returned when no matching driver is found.
+ */
+int drm_i2c_encoder_attach(struct drm_device *dev,
+			   struct drm_encoder_slave *encoder,
+			   struct i2c_client *client)
+{
+	struct drm_i2c_encoder_driver *encoder_drv;
+	struct module *module = NULL;
+	int err = 0;
+
+	if (!client->dev.driver) {
+		err = -ENODEV;
+		goto fail;
+	}
+
+	module = client->dev.driver->owner;
+	if (!try_module_get(module)) {
+		err = -ENODEV;
+		goto fail;
+	}
+
+	encoder->bus_priv = client;
+
+	encoder_drv =
+		to_drm_i2c_encoder_driver(to_i2c_driver(client->dev.driver));
+
+	err = encoder_drv->encoder_init(client, dev, encoder);
+	if (err)
+		goto fail_put;
+
+	return 0;
+
+fail_put:
+	module_put(module);
+fail:
+	return err;
+}
+EXPORT_SYMBOL(drm_i2c_encoder_attach);
+
 /*
  * Wrapper fxns which can be plugged in to drm_encoder_helper_funcs:
  */
include/drm/drm_encoder_slave.h +3 -0
index 8b9cc36..4f7f8d5 100644
@@ -106,6 +106,9 @@ int drm_i2c_encoder_init(struct drm_device *dev,
 			 struct i2c_adapter *adap,
 			 const struct i2c_board_info *info);
 
+int drm_i2c_encoder_attach(struct drm_device *dev,
+			   struct drm_encoder_slave *encoder,
+			   struct i2c_client *client);
 
 /**
  * struct drm_i2c_encoder_driver
Signature · 1 line
1.7.9.5
author
#2 lore raw

RFC PATCH 2/3 drm/tilcdc: slave: Add support for "i2c-slave" DT-parameter

In reply to Jyri Sarha

It is more convenient to refer to the i2c slave encoder directly with phandle than to refer to the i2c bus and to create the device "manually".

---
 .../devicetree/bindings/drm/tilcdc/slave.txt       |    4 +-
 drivers/gpu/drm/tilcdc/tilcdc_slave.c              |   50 ++++++++++++--------
 2 files changed, 33 insertions(+), 21 deletions(-)
Documentation/devicetree/bindings/drm/tilcdc/slave.txt +3 -1
index 3d2c524..930550f 100644
@@ -2,6 +2,8 @@ Device-Tree bindings for tilcdc DRM encoder slave output driver
 
 Required properties:
  - compatible: value should be "ti,tilcdc,slave".
+ - i2c-slave: phandle for the encoder slave device
+ or
  - i2c: the phandle for the i2c device the encoder slave is connected to
 
 Recommended properties:
@@ -12,7 +14,7 @@ Example:
 
 	hdmi {
 		compatible = "ti,tilcdc,slave";
-		i2c = <&i2c0>;
+		i2c-slave = <&tda19988>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&nxp_hdmi_bonelt_pins>;
 	};
drivers/gpu/drm/tilcdc/tilcdc_slave.c +30 -20

87 lines not on this page · raw message

Signature · 1 line
1.7.9.5

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

RFC PATCH 3/3 ARM: dts: am335x-boneblack: Use new binding in ti,tilcdc,slave node

Add node for NXP TDA19988 encoder and refer to it in the hdmi node instead of referring to the i2c bus where the encoder is connected to.

---
 arch/arm/boot/dts/am335x-boneblack.dts |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm/boot/dts/am335x-boneblack.dts +8 -1
index 5c42d25..c0c8e4b 100644
@@ -70,10 +70,17 @@
 	status = "okay";
 };
 
+&i2c0 {
+	tda19988: tda19988@70 {
+		compatible = "nxp,tda998x";
+		reg = <0x70>;
+	};
+};
+
 / {
 	hdmi {
 		compatible = "ti,tilcdc,slave";
-		i2c = <&i2c0>;
+		i2c-slave = <&tda19988>;
 		pinctrl-names = "default", "off";
 		pinctrl-0 = <&nxp_hdmi_bonelt_pins>;
 		pinctrl-1 = <&nxp_hdmi_bonelt_off_pins>;
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw
In reply to Jyri Sarha
Quoted 14 lines · On Tue, 13 Jan 2015 19:12:25 +0200 Jyri Sarha <[email protected]> wrote:

These patches are needed for Beaglebone-back HDMI audio. There is no direct dependency between these patches and the other (dts and ASoC) changes needed for the HDMI audio so these changes can be merged independently. I also feel that these changes make sense even without the HDMI audio.

Best regards,
Jyri

Jyri Sarha (3):
drm: encoder_slave: Add drm_i2c_encoder_attach() drm/tilcdc: slave: Add support for "i2c-slave" DT-parameter
ARM: dts: am335x-boneblack: Use new binding in ti,tilcdc,slave node

Quoted 6 lines
 .../devicetree/bindings/drm/tilcdc/slave.txt       |    4 +-
 arch/arm/boot/dts/am335x-boneblack.dts             |    9 +++-
 drivers/gpu/drm/drm_encoder_slave.c                |   51 ++++++++++++++++++++
 drivers/gpu/drm/tilcdc/tilcdc_slave.c              |   50 +++++++++++--------
 include/drm/drm_encoder_slave.h                    |    3 ++
 5 files changed, 95 insertions(+), 22 deletions(-)

Instead of adding code to have the slave encoder working, it would be simpler to change the way tilcdc uses the tda998x.
I already proposed such a patch:

http://lists.freedesktop.org/archives/dri-devel/2014-March/056065.html

and the changes in the tda998x driver have been done by Russell:

commit: a8f4d4d63739e4bca459ff40636f1d9e4b7ef5e6
drm/i2c: tda998x: allow re-use of tda998x support code
and
commit: c707c3619ca81f499a5ce032021405e989a96ff0
drm/i2c: tda998x: add component support

Signature · 6 lines
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#6 lore raw
Quoted 30 lines · Jean-Francois Moine
Quoted 14 lines · On Tue, 13 Jan 2015 19:12:25 +0200 Jyri Sarha <[email protected]> wrote:

These patches are needed for Beaglebone-back HDMI audio. There is no direct dependency between these patches and the other (dts and ASoC) changes needed for the HDMI audio so these changes can be merged independently. I also feel that these changes make sense even without the HDMI audio.

Best regards,
Jyri

Jyri Sarha (3):
drm: encoder_slave: Add drm_i2c_encoder_attach() drm/tilcdc: slave: Add support for "i2c-slave" DT-parameter
ARM: dts: am335x-boneblack: Use new binding in ti,tilcdc,slave node

Quoted 6 lines
  .../devicetree/bindings/drm/tilcdc/slave.txt       |    4 +-
  arch/arm/boot/dts/am335x-boneblack.dts             |    9 +++-
  drivers/gpu/drm/drm_encoder_slave.c                |   51 ++++++++++++++++++++
  drivers/gpu/drm/tilcdc/tilcdc_slave.c              |   50 +++++++++++--------
  include/drm/drm_encoder_slave.h                    |    3 ++
  5 files changed, 95 insertions(+), 22 deletions(-)

Instead of adding code to have the slave encoder working, it would be simpler to change the way tilcdc uses the tda998x.
I already proposed such a patch:

http://lists.freedesktop.org/archives/dri-devel/2014-March/056065.html

Quoted 8 lines

and the changes in the tda998x driver have been done by Russell:

commit: a8f4d4d63739e4bca459ff40636f1d9e4b7ef5e6
drm/i2c: tda998x: allow re-use of tda998x support code
and
commit: c707c3619ca81f499a5ce032021405e989a96ff0
drm/i2c: tda998x: add component support

Interesting. Would you still have the original branch somewhere? Manual applying the patches from the web-page is time consuming.

Best regards,
Jyri