[PATCH v7 5/6] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding

2016-03-17 Thread kbuild test robot
Hi Jyri,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.5 next-20160317]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Jyri-Sarha/Implement-generic-ASoC-HDMI-codec-and-use-it-in-tda998x/20160317-180926
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: x86_64-randconfig-x019-201611 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/i2c/tda998x_drv.c: In function 'tda998x_configure_audio':
>> drivers/gpu/drm/i2c/tda998x_drv.c:720:6: warning: unused variable 'ret' 
>> [-Wunused-variable]
 int ret;
 ^

vim +/ret +720 drivers/gpu/drm/i2c/tda998x_drv.c

   704  if (on) {
   705  reg_set(priv, REG_SOFTRESET, SOFTRESET_AUDIO);
   706  reg_clear(priv, REG_SOFTRESET, SOFTRESET_AUDIO);
   707  reg_set(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_RST_FIFO);
   708  } else {
   709  reg_clear(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_RST_FIFO);
   710  }
   711  }
   712  
   713  static int
   714  tda998x_configure_audio(struct tda998x_priv *priv,
   715  struct tda998x_audio_params *params,
   716  unsigned mode_clock)
   717  {
   718  u8 buf[6], clksel_aip, clksel_fs, cts_n, adiv;
   719  u32 n;
 > 720  int ret;
   721  
   722  /* Enable audio ports */
   723  reg_write(priv, REG_ENA_AP, params->config);
   724  
   725  /* Set audio input source */
   726  switch (params->format) {
   727  case AFMT_SPDIF:
   728  reg_write(priv, REG_ENA_ACLK, 0);

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
-- next part --
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 22599 bytes
Desc: not available
URL: 



[PATCH v7 5/6] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding

2016-03-17 Thread Jyri Sarha
Register ASoC HDMI codec for audio functionality and adds device tree
binding for audio configuration.

With the registered HDMI codec the tda998x node can be used like a
regular codec node in ASoC card configurations. HDMI audio info-frame
and audio stream header is generated by the ASoC HDMI codec. The codec
also applies constraints for available sample-rates based on Edid Like
Data from the display. The device tree binding document has been
updated [1].

Part of this patch has been inspired by Jean Francoise's "drm/i2c: tda998x:
Add support of a DT graph of ports"-patch [2]. There may still be some
identical lines left from the original patch and some of the ideas
have come from there.

[1] Documentation/devicetree/bindings/display/bridge/tda998x.txt
[2] http://mailman.alsa-project.org/pipermail/alsa-devel/2015-July/095255.html

Signed-off-by: Jyri Sarha 
---
 .../devicetree/bindings/display/bridge/tda998x.txt |  18 ++
 drivers/gpu/drm/i2c/Kconfig|   1 +
 drivers/gpu/drm/i2c/tda998x_drv.c  | 199 -
 include/drm/i2c/tda998x.h  |   4 +-
 include/dt-bindings/display/tda998x.h  |   7 +
 5 files changed, 224 insertions(+), 5 deletions(-)
 create mode 100644 include/dt-bindings/display/tda998x.h

diff --git a/Documentation/devicetree/bindings/display/bridge/tda998x.txt 
b/Documentation/devicetree/bindings/display/bridge/tda998x.txt
index e178e6b..24cc246 100644
--- a/Documentation/devicetree/bindings/display/bridge/tda998x.txt
+++ b/Documentation/devicetree/bindings/display/bridge/tda998x.txt
@@ -21,8 +21,19 @@ Optional properties:
   - video-ports: 24 bits value which defines how the video controller
output is wired to the TDA998x input - default: <0x230145>

+  - audio-ports: array of 8-bit values, 2 values per one DAI[1].
+   The first value defines the DAI type: TDA998x_SPDIF or TDA998x_I2S[2].
+   The second value defines the tda998x AP_ENA reg content when the DAI
+   in question is used. The implementation allows one or two DAIs. If two
+   DAIs are defined, they must be of different type.
+
+[1] Documentation/sound/alsa/soc/DAI.txt
+[2] include/dt-bindings/display/tda998x.h
+
 Example:

+#include 
+
tda998x: hdmi-encoder {
compatible = "nxp,tda998x";
reg = <0x70>;
@@ -30,4 +41,11 @@ Example:
interrupts = <27 2>;/* falling edge */
pinctrl-0 = <_camera>;
pinctrl-names = "default";
+   video-ports = <0x230145>;
+
+   #sound-dai-cells = <2>;
+/* DAI-format  AP_ENA reg value */
+   audio-ports = < TDA998x_SPDIF   0x04
+   TDA998x_I2S 0x03>;
+
};
diff --git a/drivers/gpu/drm/i2c/Kconfig b/drivers/gpu/drm/i2c/Kconfig
index 22c7ed6..088f278 100644
--- a/drivers/gpu/drm/i2c/Kconfig
+++ b/drivers/gpu/drm/i2c/Kconfig
@@ -28,6 +28,7 @@ config DRM_I2C_SIL164
 config DRM_I2C_NXP_TDA998X
tristate "NXP Semiconductors TDA998X HDMI encoder"
default m if DRM_TILCDC
+   select SND_SOC_HDMI_CODEC if SND_SOC
help
  Support for NXP Semiconductors TDA998X HDMI encoders.

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index f97b748..a0dccf9 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -30,6 +31,11 @@

 #define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__)

+struct tda998x_audio_port {
+   u8 format;  /* AFMT_xxx */
+   u8 config;  /* AP value */
+};
+
 struct tda998x_priv {
struct i2c_client *cec;
struct i2c_client *hdmi;
@@ -43,6 +49,8 @@ struct tda998x_priv {
u8 vip_cntrl_2;
struct tda998x_audio_params audio_params;

+   struct platform_device *audio_pdev;
+
wait_queue_head_t wq_edid;
volatile int wq_edid_wait;

@@ -53,6 +61,8 @@ struct tda998x_priv {

struct drm_encoder encoder;
struct drm_connector connector;
+
+   struct tda998x_audio_port audio_port[2];
 };

 #define conn_to_tda998x_priv(x) \
@@ -707,6 +717,7 @@ tda998x_configure_audio(struct tda998x_priv *priv,
 {
u8 buf[6], clksel_aip, clksel_fs, cts_n, adiv;
u32 n;
+   int ret;

/* Enable audio ports */
reg_write(priv, REG_ENA_AP, params->config);
@@ -743,7 +754,7 @@ tda998x_configure_audio(struct tda998x_priv *priv,
break;

default:
-   BUG();
+   dev_err(>hdmi->dev, "Unsupported I2S format\n");
return -EINVAL;
}

@@ -1160,6 +1171,8 @@ static int tda998x_connector_get_modes(struct 
drm_connector *connector)
drm_mode_connector_update_edid_property(connector, edid);
n = drm_add_edid_modes(connector, edid);