[PATCH v7 00/20] Rework OMAP4+ HDMI audio support

2014-11-12 Thread Jyri Sarha
The patches are based on:
git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git for-next

The base, the patches, and couple of additional not-to-be-merged
omap2plus_defconfig patches can be found here:
https://github.com/jsarha/linux.git omap-hdmi-audio

It would make the most sense to get these in trough fbdev tree. So it
would be nice to get acked-bys (if the patches are Ok) for ASoC side
changes from appropriate maintainers.

Changes since v6:
- ASoC: omap-hdmi-audio: Add platform device for OMAP HDMI audio support
  - Fix Kconfig help text
  - Remove #include sound/simple_card.h
  - Use snd-soc-dummy codec instead of hdmi-audio-codec
- Add: OMAPDSS: hdmi_wp: Protect reserved bits in hdmi_wp_audio_config_format()
- Add: OMAPDSS: hdmi5_core: Initialize mandatory sample_order parameter
- Add: OMAPDSS: omapdss.h: Remove audio_state member of struct omap_dss_device
- OMAPDSS: hdmi4: Register ASoC platform device for omap hdmi audio
  - Register omap-hdmi-audio with PLATFORM_DEVID_AUTO
- OMAPDSS: hdmi5: Register ASoC platform device for omap hdmi audio
  - Register omap-hdmi-audio with PLATFORM_DEVID_AUTO
- Add: OMAPDSS: hdmi5: Change hdmi_wp idlemode to to no_idle for audio 
playback

Jyri Sarha (20):
  OMAPDSS: hdmi_wp: Protect reserved bits in
hdmi_wp_audio_config_format()
  OMAPDSS: hdmi5_core: Initialize mandatory sample_order parameter
  OMAPDSS: hdmi.h: Add HDMI_AUDIO_LAYOUT_6CH enum value
  OMAPDSS: hdmi: Remove most of OMAP[45]_DSS_HDMI_AUDIO ifdefs
  OMAPDSS: hdmi4_core: Remove unused hdmi4_audio_get_dma_port()
  OMAPDSS: omapdss.h: Remove audio_state member of struct
omap_dss_device
  OMAPDSS: hdmi_wp: Add function for getting audio dma address
  OMAPDSS: hdmi: Make hdmi structure public
  OMAPDSS: hdmi: Add pdev pointer for audio_pdev in HDMI DRV data
  ASoC: omap-hdmi-audio: Add platform device for OMAP HDMI audio
support
  OMAPDSS: Kconfig: Remove HDMI audio booleans from Kconfig
  OMAPDSS: hdmi: Make hdmi_mode_has_audio() more user friedly
  OMAPDSS: hdmi.h: Add members to hdmi drvdata for audio implementation
  OMAPDSS: hdmi4: Remove callbacks for the old ASoC DAI driver
  OMAPDSS: hdmi4: Register ASoC platform device for omap hdmi audio
  OMAPDSS: hdmi5: Remove callbacks for the old ASoC DAI driver
  OMAPDSS: hdmi5: Register ASoC platform device for omap hdmi audio
  ASoC: omap: Remove obsolete HDMI audio code and Kconfig options
  OMAPDSS: Remove all references to obsolete HDMI audio callbacks
  OMAPDSS: hdmi5: Change hdmi_wp idlemode to to no_idle for audio
playback

 .../fbdev/omap2/displays-new/connector-hdmi.c  |   99 -
 .../fbdev/omap2/displays-new/encoder-tpd12s015.c   |   56 ---
 drivers/video/fbdev/omap2/dss/Kconfig  |7 -
 drivers/video/fbdev/omap2/dss/hdmi.h   |   38 +-
 drivers/video/fbdev/omap2/dss/hdmi4.c  |  269 +++--
 drivers/video/fbdev/omap2/dss/hdmi4_core.c |   14 -
 drivers/video/fbdev/omap2/dss/hdmi4_core.h |4 -
 drivers/video/fbdev/omap2/dss/hdmi5.c  |  265 ++---
 drivers/video/fbdev/omap2/dss/hdmi5_core.c |9 +-
 drivers/video/fbdev/omap2/dss/hdmi5_core.h |2 -
 drivers/video/fbdev/omap2/dss/hdmi_common.c|2 -
 drivers/video/fbdev/omap2/dss/hdmi_wp.c|   16 +-
 include/sound/omap-hdmi-audio.h|   43 +++
 include/video/omapdss.h|   40 --
 sound/soc/omap/Kconfig |   26 +-
 sound/soc/omap/Makefile|6 +-
 sound/soc/omap/omap-hdmi-audio.c   |  407 
 sound/soc/omap/omap-hdmi-card.c|   87 -
 sound/soc/omap/omap-hdmi.c |  364 -
 sound/soc/omap/omap-hdmi.h |   38 --
 20 files changed, 781 insertions(+), 1011 deletions(-)
 create mode 100644 include/sound/omap-hdmi-audio.h
 create mode 100644 sound/soc/omap/omap-hdmi-audio.c
 delete mode 100644 sound/soc/omap/omap-hdmi-card.c
 delete mode 100644 sound/soc/omap/omap-hdmi.c
 delete mode 100644 sound/soc/omap/omap-hdmi.h

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 06/20] OMAPDSS: omapdss.h: Remove audio_state member of struct omap_dss_device

2014-11-12 Thread Jyri Sarha
The audio_state member is not used.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 include/video/omapdss.h |9 -
 1 file changed, 9 deletions(-)

diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 069dfca..9f2699f 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -166,13 +166,6 @@ enum omap_dss_display_state {
OMAP_DSS_DISPLAY_ACTIVE,
 };
 
-enum omap_dss_audio_state {
-   OMAP_DSS_AUDIO_DISABLED = 0,
-   OMAP_DSS_AUDIO_ENABLED,
-   OMAP_DSS_AUDIO_CONFIGURED,
-   OMAP_DSS_AUDIO_PLAYING,
-};
-
 struct omap_dss_audio {
struct snd_aes_iec958 *iec;
struct snd_cea_861_aud_if *cea;
@@ -783,8 +776,6 @@ struct omap_dss_device {
 
enum omap_dss_display_state state;
 
-   enum omap_dss_audio_state audio_state;
-
/* OMAP DSS output specific fields */
 
struct list_head list;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 08/20] OMAPDSS: hdmi: Make hdmi structure public

2014-11-12 Thread Jyri Sarha
Unify the private anonymous struct in hdmi4.c and hdmi5.c, name it as
struct omap_hdmi, and make it public in hdmi.h.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h  |   21 +
 drivers/video/fbdev/omap2/dss/hdmi4.c |   31 ---
 drivers/video/fbdev/omap2/dss/hdmi5.c |   20 ++--
 3 files changed, 31 insertions(+), 41 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 9ba7c1a..6bf077b 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -349,4 +349,25 @@ static inline bool hdmi_mode_has_audio(int mode)
 {
return mode == HDMI_HDMI ? true : false;
 }
+
+/* HDMI DRV data */
+struct omap_hdmi {
+   struct mutex lock;
+   struct platform_device *pdev;
+
+   struct hdmi_wp_data wp;
+   struct hdmi_pll_datapll;
+   struct hdmi_phy_dataphy;
+   struct hdmi_core_data   core;
+
+   struct hdmi_config cfg;
+
+   struct clk *sys_clk;
+   struct regulator *vdda_reg;
+
+   bool core_enabled;
+
+   struct omap_dss_device output;
+};
+
 #endif
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c 
b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 9a8713c..764443e 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -37,25 +37,9 @@
 #include hdmi4_core.h
 #include dss.h
 #include dss_features.h
+#include hdmi.h
 
-static struct {
-   struct mutex lock;
-   struct platform_device *pdev;
-
-   struct hdmi_wp_data wp;
-   struct hdmi_pll_datapll;
-   struct hdmi_phy_dataphy;
-   struct hdmi_core_data   core;
-
-   struct hdmi_config cfg;
-
-   struct clk *sys_clk;
-   struct regulator *vdda_hdmi_dac_reg;
-
-   bool core_enabled;
-
-   struct omap_dss_device output;
-} hdmi;
+static struct omap_hdmi hdmi;
 
 static int hdmi_runtime_get(void)
 {
@@ -117,7 +101,7 @@ static int hdmi_init_regulator(void)
int r;
struct regulator *reg;
 
-   if (hdmi.vdda_hdmi_dac_reg != NULL)
+   if (hdmi.vdda_reg != NULL)
return 0;
 
reg = devm_regulator_get(hdmi.pdev-dev, vdda);
@@ -137,7 +121,7 @@ static int hdmi_init_regulator(void)
}
}
 
-   hdmi.vdda_hdmi_dac_reg = reg;
+   hdmi.vdda_reg = reg;
 
return 0;
 }
@@ -146,7 +130,7 @@ static int hdmi_power_on_core(struct omap_dss_device 
*dssdev)
 {
int r;
 
-   r = regulator_enable(hdmi.vdda_hdmi_dac_reg);
+   r = regulator_enable(hdmi.vdda_reg);
if (r)
return r;
 
@@ -162,7 +146,7 @@ static int hdmi_power_on_core(struct omap_dss_device 
*dssdev)
return 0;
 
 err_runtime_get:
-   regulator_disable(hdmi.vdda_hdmi_dac_reg);
+   regulator_disable(hdmi.vdda_reg);
 
return r;
 }
@@ -172,7 +156,7 @@ static void hdmi_power_off_core(struct omap_dss_device 
*dssdev)
hdmi.core_enabled = false;
 
hdmi_runtime_put();
-   regulator_disable(hdmi.vdda_hdmi_dac_reg);
+   regulator_disable(hdmi.vdda_reg);
 }
 
 static int hdmi_power_on_full(struct omap_dss_device *dssdev)
@@ -678,6 +662,7 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
int irq;
 
hdmi.pdev = pdev;
+   dev_set_drvdata(pdev-dev, hdmi);
 
mutex_init(hdmi.lock);
 
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c 
b/drivers/video/fbdev/omap2/dss/hdmi5.c
index 169b764..694cdee 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -43,24 +43,7 @@
 #include dss.h
 #include dss_features.h
 
-static struct {
-   struct mutex lock;
-   struct platform_device *pdev;
-
-   struct hdmi_wp_data wp;
-   struct hdmi_pll_datapll;
-   struct hdmi_phy_dataphy;
-   struct hdmi_core_data   core;
-
-   struct hdmi_config cfg;
-
-   struct clk *sys_clk;
-   struct regulator *vdda_reg;
-
-   bool core_enabled;
-
-   struct omap_dss_device output;
-} hdmi;
+static struct omap_hdmi hdmi;
 
 static int hdmi_runtime_get(void)
 {
@@ -703,6 +686,7 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
int irq;
 
hdmi.pdev = pdev;
+   dev_set_drvdata(pdev-dev, hdmi);
 
mutex_init(hdmi.lock);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 01/20] OMAPDSS: hdmi_wp: Protect reserved bits in hdmi_wp_audio_config_format()

2014-11-12 Thread Jyri Sarha
Only OMAP4 DSS has non reserved bits above 6th bit in HDMI_WP_AUDIO_CFG.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi_wp.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi_wp.c 
b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
index 496327e..71b499e 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_wp.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
@@ -194,8 +194,12 @@ void hdmi_wp_audio_config_format(struct hdmi_wp_data *wp,
DSSDBG(Enter hdmi_wp_audio_config_format\n);
 
r = hdmi_read_reg(wp-base, HDMI_WP_AUDIO_CFG);
-   r = FLD_MOD(r, aud_fmt-stereo_channels, 26, 24);
-   r = FLD_MOD(r, aud_fmt-active_chnnls_msk, 23, 16);
+   if (omapdss_get_version() == OMAPDSS_VER_OMAP4430_ES1 ||
+   omapdss_get_version() == OMAPDSS_VER_OMAP4430_ES2 ||
+   omapdss_get_version() == OMAPDSS_VER_OMAP4) {
+   r = FLD_MOD(r, aud_fmt-stereo_channels, 26, 24);
+   r = FLD_MOD(r, aud_fmt-active_chnnls_msk, 23, 16);
+   }
r = FLD_MOD(r, aud_fmt-en_sig_blk_strt_end, 5, 5);
r = FLD_MOD(r, aud_fmt-type, 4, 4);
r = FLD_MOD(r, aud_fmt-justification, 3, 3);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 02/20] OMAPDSS: hdmi5_core: Initialize mandatory sample_order parameter

2014-11-12 Thread Jyri Sarha
The hdmi_wp_audio_config_format() expects sample_order of struct
hdmi_audio_format to be initialized. The only allowed value is
HDMI_AUDIO_SAMPLE_LEFT_FIRST.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi5_core.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi5_core.c 
b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
index 83acbf7..9ffa805 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
@@ -879,6 +879,9 @@ int hdmi5_audio_config(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp,
/* only LPCM atm */
audio_format.type = HDMI_AUDIO_TYPE_LPCM;
 
+   /* only allowed option */
+   audio_format.sample_order = HDMI_AUDIO_SAMPLE_LEFT_FIRST;
+
/* disable start/stop signals of IEC 60958 blocks */
audio_format.en_sig_blk_strt_end = HDMI_AUDIO_BLOCK_SIG_STARTEND_ON;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 03/20] OMAPDSS: hdmi.h: Add HDMI_AUDIO_LAYOUT_6CH enum value

2014-11-12 Thread Jyri Sarha
The OMAP5 HDMI audio implementation needs HDMI_AUDIO_LAYOUT_6CH in
hdmi_core_audio_layout enum. I found the correct value from ti-linux
3.8 tree.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 262771b..1f01068 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -160,7 +160,8 @@ enum hdmi_audio_blk_strt_end_sig {
 
 enum hdmi_core_audio_layout {
HDMI_AUDIO_LAYOUT_2CH = 0,
-   HDMI_AUDIO_LAYOUT_8CH = 1
+   HDMI_AUDIO_LAYOUT_8CH = 1,
+   HDMI_AUDIO_LAYOUT_6CH = 2
 };
 
 enum hdmi_core_cts_mode {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 04/20] OMAPDSS: hdmi: Remove most of OMAP[45]_DSS_HDMI_AUDIO ifdefs

2014-11-12 Thread Jyri Sarha
It does not waste too many bytes to compile all audio related core
functions always in with HDMI support. It should help readability and
in keeping the audio code in working shape. Leave the options just for
disabling and enabling the functionality in hdmi[45].c.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h|3 +--
 drivers/video/fbdev/omap2/dss/hdmi4_core.c  |5 -
 drivers/video/fbdev/omap2/dss/hdmi4_core.h  |2 --
 drivers/video/fbdev/omap2/dss/hdmi5_core.c  |6 --
 drivers/video/fbdev/omap2/dss/hdmi5_core.h  |2 --
 drivers/video/fbdev/omap2/dss/hdmi_common.c |2 --
 drivers/video/fbdev/omap2/dss/hdmi_wp.c |2 --
 7 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 1f01068..03726b5 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -335,7 +335,7 @@ int hdmi_phy_parse_lanes(struct hdmi_phy_data *phy, const 
u32 *lanes);
 int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep,
struct hdmi_phy_data *phy);
 
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) || 
defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
+/* Audio funcs */
 int hdmi_compute_acr(u32 pclk, u32 sample_freq, u32 *n, u32 *cts);
 int hdmi_wp_audio_enable(struct hdmi_wp_data *wp, bool enable);
 int hdmi_wp_audio_core_req_enable(struct hdmi_wp_data *wp, bool enable);
@@ -348,4 +348,3 @@ static inline bool hdmi_mode_has_audio(int mode)
return mode == HDMI_HDMI ? true : false;
 }
 #endif
-#endif
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.c 
b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
index 4ad39cf..3b448d9 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
@@ -31,10 +31,8 @@
 #include linux/platform_device.h
 #include linux/string.h
 #include linux/seq_file.h
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
 #include sound/asound.h
 #include sound/asoundef.h
-#endif
 
 #include hdmi4_core.h
 #include dss_features.h
@@ -530,7 +528,6 @@ void hdmi4_core_dump(struct hdmi_core_data *core, struct 
seq_file *s)
DUMPCOREAV(HDMI_CORE_AV_CEC_ADDR_ID);
 }
 
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
 static void hdmi_core_audio_config(struct hdmi_core_data *core,
struct hdmi_core_audio_config *cfg)
 {
@@ -886,8 +883,6 @@ int hdmi4_audio_get_dma_port(u32 *offset, u32 *size)
return 0;
 }
 
-#endif
-
 int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
 {
struct resource *res;
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.h 
b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
index 827909e..c1959f7 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
@@ -266,12 +266,10 @@ void hdmi4_configure(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp,
 void hdmi4_core_dump(struct hdmi_core_data *core, struct seq_file *s);
 int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core);
 
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
 int hdmi4_audio_start(struct hdmi_core_data *core, struct hdmi_wp_data *wp);
 void hdmi4_audio_stop(struct hdmi_core_data *core, struct hdmi_wp_data *wp);
 int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
struct omap_dss_audio *audio, u32 pclk);
 int hdmi4_audio_get_dma_port(u32 *offset, u32 *size);
-#endif
 
 #endif
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5_core.c 
b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
index 9ffa805..a711579 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
@@ -30,10 +30,8 @@
 #include linux/string.h
 #include linux/seq_file.h
 #include drm/drm_edid.h
-#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
 #include sound/asound.h
 #include sound/asoundef.h
-#endif
 
 #include hdmi5_core.h
 
@@ -644,9 +642,6 @@ void hdmi5_configure(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp,
hdmi_core_enable_interrupts(core);
 }
 
-
-#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
-
 static void hdmi5_core_audio_config(struct hdmi_core_data *core,
struct hdmi_core_audio_config *cfg)
 {
@@ -897,7 +892,6 @@ int hdmi5_audio_config(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp,
 
return 0;
 }
-#endif
 
 int hdmi5_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
 {
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5_core.h 
b/drivers/video/fbdev/omap2/dss/hdmi5_core.h
index ce7e9f3..f2f1022 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5_core.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi5_core.h
@@ -299,8 +299,6 @@ void hdmi5_configure(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp,
struct hdmi_config *cfg);
 int hdmi5_core_init(struct platform_device *pdev, struct hdmi_core_data *core);
 
-#if 

[PATCH v7 19/20] OMAPDSS: Remove all references to obsolete HDMI audio callbacks

2014-11-12 Thread Jyri Sarha
In new model these callbacks are obsolete since the ASoC component
drivers are integrated into the HDMI drivers and no callbacks are
needed anymore.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 .../fbdev/omap2/displays-new/connector-hdmi.c  |   99 
 .../fbdev/omap2/displays-new/encoder-tpd12s015.c   |   56 ---
 include/video/omapdss.h|   31 --
 3 files changed, 186 deletions(-)

diff --git a/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c 
b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c
index 7b25967..219f14f 100644
--- a/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c
+++ b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c
@@ -170,98 +170,6 @@ static bool hdmic_detect(struct omap_dss_device *dssdev)
return in-ops.hdmi-detect(in);
 }
 
-static int hdmic_audio_enable(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-   int r;
-
-   /* enable audio only if the display is active */
-   if (!omapdss_device_is_enabled(dssdev))
-   return -EPERM;
-
-   r = in-ops.hdmi-audio_enable(in);
-   if (r)
-   return r;
-
-   dssdev-audio_state = OMAP_DSS_AUDIO_ENABLED;
-
-   return 0;
-}
-
-static void hdmic_audio_disable(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-
-   in-ops.hdmi-audio_disable(in);
-
-   dssdev-audio_state = OMAP_DSS_AUDIO_DISABLED;
-}
-
-static int hdmic_audio_start(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-   int r;
-
-   /*
-* No need to check the panel state. It was checked when trasitioning
-* to AUDIO_ENABLED.
-*/
-   if (dssdev-audio_state != OMAP_DSS_AUDIO_ENABLED)
-   return -EPERM;
-
-   r = in-ops.hdmi-audio_start(in);
-   if (r)
-   return r;
-
-   dssdev-audio_state = OMAP_DSS_AUDIO_PLAYING;
-
-   return 0;
-}
-
-static void hdmic_audio_stop(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-
-   in-ops.hdmi-audio_stop(in);
-
-   dssdev-audio_state = OMAP_DSS_AUDIO_ENABLED;
-}
-
-static bool hdmic_audio_supported(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-
-   if (!omapdss_device_is_enabled(dssdev))
-   return false;
-
-   return in-ops.hdmi-audio_supported(in);
-}
-
-static int hdmic_audio_config(struct omap_dss_device *dssdev,
-   struct omap_dss_audio *audio)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-   int r;
-
-   /* config audio only if the display is active */
-   if (!omapdss_device_is_enabled(dssdev))
-   return -EPERM;
-
-   r = in-ops.hdmi-audio_config(in, audio);
-   if (r)
-   return r;
-
-   dssdev-audio_state = OMAP_DSS_AUDIO_CONFIGURED;
-
-   return 0;
-}
-
 static int hdmic_set_hdmi_mode(struct omap_dss_device *dssdev, bool hdmi_mode)
 {
struct panel_drv_data *ddata = to_panel_data(dssdev);
@@ -296,13 +204,6 @@ static struct omap_dss_driver hdmic_driver = {
.detect = hdmic_detect,
.set_hdmi_mode  = hdmic_set_hdmi_mode,
.set_hdmi_infoframe = hdmic_set_infoframe,
-
-   .audio_enable   = hdmic_audio_enable,
-   .audio_disable  = hdmic_audio_disable,
-   .audio_start= hdmic_audio_start,
-   .audio_stop = hdmic_audio_stop,
-   .audio_supported= hdmic_audio_supported,
-   .audio_config   = hdmic_audio_config,
 };
 
 static int hdmic_probe_pdata(struct platform_device *pdev)
diff --git a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c 
b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
index c4abd56..6fc8b9d 100644
--- a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
+++ b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
@@ -193,55 +193,6 @@ static bool tpd_detect(struct omap_dss_device *dssdev)
return gpio_get_value_cansleep(ddata-hpd_gpio);
 }
 
-static int tpd_audio_enable(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-
-   return in-ops.hdmi-audio_enable(in);
-}
-
-static void tpd_audio_disable(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-
-   in-ops.hdmi-audio_disable(in);
-}
-
-static int 

[PATCH v7 20/20] OMAPDSS: hdmi5: Change hdmi_wp idlemode to to no_idle for audio playback

2014-11-12 Thread Jyri Sarha
Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h  |1 +
 drivers/video/fbdev/omap2/dss/hdmi5.c |7 +++
 2 files changed, 8 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index bfaaf2f..f991dbf 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -372,6 +372,7 @@ struct omap_hdmi {
 
struct platform_device *audio_pdev;
void (*audio_abort_cb)(struct device *dev);
+   int wp_idlemode;
 };
 
 #endif
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c 
b/drivers/video/fbdev/omap2/dss/hdmi5.c
index feb76e2..c91685e 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -614,6 +614,10 @@ static int hdmi_audio_start(struct device *dev)
WARN_ON(!hdmi_mode_has_audio(hd-cfg));
WARN_ON(!hd-display_enabled);
 
+   /* No-idle while playing audio, store the old value */
+   hd-wp_idlemode = REG_GET(hdmi.wp.base, HDMI_WP_SYSCONFIG, 3, 2);
+   REG_FLD_MOD(hdmi.wp.base, HDMI_WP_SYSCONFIG, 1, 3, 2);
+
hdmi_wp_audio_enable(hd-wp, true);
hdmi_wp_audio_core_req_enable(hd-wp, true);
 
@@ -629,6 +633,9 @@ static void hdmi_audio_stop(struct device *dev)
 
hdmi_wp_audio_core_req_enable(hd-wp, false);
hdmi_wp_audio_enable(hd-wp, false);
+
+   /* Playback stopped, restore original idlemode */
+   REG_FLD_MOD(hdmi.wp.base, HDMI_WP_SYSCONFIG, hd-wp_idlemode, 3, 2);
 }
 
 static int hdmi_audio_config(struct device *dev,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 10/20] ASoC: omap-hdmi-audio: Add platform device for OMAP HDMI audio support

2014-11-12 Thread Jyri Sarha
The platform device should only be registered from OMAPDSS HDMI
driver. The platform driver registers and unregisters all ASoC
components needed for OMAP HDMI audio.

The hdmi audio driver implements cpu-dai component using the callbacks
provided by OMAPDSS and registers the component under DSS HDMI
device. Omap-pcm is registered for platform component also under DSS
HDMI device. Dummy codec is used as as codec component. The hdmi audio
driver implements also the card and registers it under its own
platform device.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 include/sound/omap-hdmi-audio.h  |   43 
 sound/soc/omap/Kconfig   |   15 ++
 sound/soc/omap/Makefile  |2 +
 sound/soc/omap/omap-hdmi-audio.c |  407 ++
 4 files changed, 467 insertions(+)
 create mode 100644 include/sound/omap-hdmi-audio.h
 create mode 100644 sound/soc/omap/omap-hdmi-audio.c

diff --git a/include/sound/omap-hdmi-audio.h b/include/sound/omap-hdmi-audio.h
new file mode 100644
index 000..afdb416
--- /dev/null
+++ b/include/sound/omap-hdmi-audio.h
@@ -0,0 +1,43 @@
+/*
+ * hdmi-audio.c -- OMAP4+ DSS HDMI audio support library
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Author: Jyri Sarha jsa...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#include video/omapdss.h
+
+#ifndef __OMAP_HDMI_AUDIO_H__
+#define __OMAP_HDMI_AUDIO_H__
+
+struct omap_hdmi_audio_ops {
+   int (*audio_startup)(struct device *dev,
+void (*abort_cb)(struct device *dev));
+   int (*audio_shutdown)(struct device *dev);
+   int (*audio_start)(struct device *dev);
+   void (*audio_stop)(struct device *dev);
+   int (*audio_config)(struct device *dev,
+   struct omap_dss_audio *dss_audio);
+};
+
+/* HDMI audio initalization data */
+struct omap_hdmi_audio_pdata {
+   struct device *dev;
+   enum omapdss_version dss_version;
+   phys_addr_t audio_dma_addr;
+
+   const struct omap_hdmi_audio_ops *ops;
+};
+
+#endif /* __OMAP_HDMI_AUDIO_H__ */
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index d44463a..2b32b3e 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -15,6 +15,21 @@ config SND_OMAP_SOC_MCPDM
 config SND_OMAP_SOC_HDMI
tristate
 
+config SND_OMAP_SOC_HDMI_AUDIO
+   tristate HDMI audio support for OMAP4+ based SoCs
+   depends on SND_OMAP_SOC
+   help
+ For HDMI audio to work OMAPDSS HDMI support should be
+ enabled.
+ The hdmi audio driver implements cpu-dai component using the
+ callbacks provided by OMAPDSS and registers the component
+ under DSS HDMI device. Omap-pcm is registered for platform
+ component also under DSS HDMI device. Dummy codec is used as
+ as codec component. The hdmi audio driver implements also
+ the card and registers it under its own platform device.
+ The device for the dirver is registered by OMAPDSS hdmi
+ driver.
+
 config SND_OMAP_SOC_N810
tristate SoC Audio support for Nokia N810
depends on SND_OMAP_SOC  MACH_NOKIA_N810  I2C
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index a725905..40688a6 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -4,12 +4,14 @@ snd-soc-omap-dmic-objs := omap-dmic.o
 snd-soc-omap-mcbsp-objs := omap-mcbsp.o mcbsp.o
 snd-soc-omap-mcpdm-objs := omap-mcpdm.o
 snd-soc-omap-hdmi-objs := omap-hdmi.o
+snd-soc-omap-hdmi-audio-objs := omap-hdmi-audio.o
 
 obj-$(CONFIG_SND_OMAP_SOC) += snd-soc-omap.o
 obj-$(CONFIG_SND_OMAP_SOC_DMIC) += snd-soc-omap-dmic.o
 obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o
 obj-$(CONFIG_SND_OMAP_SOC_MCPDM) += snd-soc-omap-mcpdm.o
 obj-$(CONFIG_SND_OMAP_SOC_HDMI) += snd-soc-omap-hdmi.o
+obj-$(CONFIG_SND_OMAP_SOC_HDMI_AUDIO) += snd-soc-omap-hdmi-audio.o
 
 # OMAP Machine Support
 snd-soc-n810-objs := n810.o
diff --git a/sound/soc/omap/omap-hdmi-audio.c b/sound/soc/omap/omap-hdmi-audio.c
new file mode 100644
index 000..3f9ac7d
--- /dev/null
+++ b/sound/soc/omap/omap-hdmi-audio.c
@@ -0,0 +1,407 @@
+/*
+ * omap-hdmi-audio.c -- OMAP4+ DSS HDMI audio support library
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Author: Jyri Sarha jsa...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is 

[PATCH v7 13/20] OMAPDSS: hdmi.h: Add members to hdmi drvdata for audio implementation

2014-11-12 Thread Jyri Sarha
Adds display_enabled flag and audio_abort_cb callback to struct hdmi.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 6d129f2..bfaaf2f 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -366,10 +366,12 @@ struct omap_hdmi {
struct regulator *vdda_reg;
 
bool core_enabled;
+   bool display_enabled;
 
struct omap_dss_device output;
 
struct platform_device *audio_pdev;
+   void (*audio_abort_cb)(struct device *dev);
 };
 
 #endif
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 09/20] OMAPDSS: hdmi: Add pdev pointer for audio_pdev in HDMI DRV data

2014-11-12 Thread Jyri Sarha
This is used to store omap-hdmi-audio pdev for unregistering it.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 6bf077b..a6e08ff 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -368,6 +368,8 @@ struct omap_hdmi {
bool core_enabled;
 
struct omap_dss_device output;
+
+   struct platform_device *audio_pdev;
 };
 
 #endif
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 15/20] OMAPDSS: hdmi4: Register ASoC platform device for omap hdmi audio

2014-11-12 Thread Jyri Sarha
Implements callbacks for OMAP HDMI audio platform driver and registers
it in probe function. Unregistering is done in remove function.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi4.c |  125 +
 1 file changed, 125 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c 
b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 6f6764c..28a55b2 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -33,6 +33,7 @@
 #include linux/gpio.h
 #include linux/regulator/consumer.h
 #include video/omapdss.h
+#include sound/omap-hdmi-audio.h
 
 #include hdmi4_core.h
 #include dss.h
@@ -336,6 +337,8 @@ static int hdmi_display_enable(struct omap_dss_device 
*dssdev)
goto err0;
}
 
+   hdmi.display_enabled = true;
+
mutex_unlock(hdmi.lock);
return 0;
 
@@ -350,8 +353,13 @@ static void hdmi_display_disable(struct omap_dss_device 
*dssdev)
 
mutex_lock(hdmi.lock);
 
+   if (hdmi.audio_pdev  hdmi.audio_abort_cb)
+   hdmi.audio_abort_cb(hdmi.audio_pdev-dev);
+
hdmi_power_off_full(dssdev);
 
+   hdmi.display_enabled = false;
+
mutex_unlock(hdmi.lock);
 }
 
@@ -542,6 +550,112 @@ err:
return r;
 }
 
+/* Audio callbacks */
+static int hdmi_audio_startup(struct device *dev,
+ void (*abort_cb)(struct device *dev))
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+   int ret = 0;
+
+   mutex_lock(hd-lock);
+
+   if (!hdmi_mode_has_audio(hd-cfg) || !hd-display_enabled) {
+   ret = -EPERM;
+   goto out;
+   }
+
+   hd-audio_abort_cb = abort_cb;
+
+out:
+   mutex_unlock(hd-lock);
+
+   return ret;
+}
+
+static int hdmi_audio_shutdown(struct device *dev)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+
+   mutex_lock(hd-lock);
+   hd-audio_abort_cb = NULL;
+   mutex_unlock(hd-lock);
+
+   return 0;
+}
+
+static int hdmi_audio_start(struct device *dev)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+
+   WARN_ON(!hdmi_mode_has_audio(hd-cfg));
+   WARN_ON(!hd-display_enabled);
+
+   hdmi_wp_audio_enable(hd-wp, true);
+   hdmi4_audio_start(hd-core, hd-wp);
+
+   return 0;
+}
+
+static void hdmi_audio_stop(struct device *dev)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+
+   WARN_ON(!hdmi_mode_has_audio(hd-cfg));
+   WARN_ON(!hd-display_enabled);
+
+   hdmi4_audio_stop(hd-core, hd-wp);
+   hdmi_wp_audio_enable(hd-wp, false);
+}
+
+static int hdmi_audio_config(struct device *dev,
+struct omap_dss_audio *dss_audio)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+   int ret;
+
+   mutex_lock(hd-lock);
+
+   if (!hdmi_mode_has_audio(hd-cfg) || !hd-display_enabled) {
+   ret = -EPERM;
+   goto out;
+   }
+
+   ret = hdmi4_audio_config(hd-core, hd-wp, dss_audio,
+hd-cfg.timings.pixelclock);
+
+out:
+   mutex_unlock(hd-lock);
+
+   return ret;
+}
+
+static const struct omap_hdmi_audio_ops hdmi_audio_ops = {
+   .audio_startup = hdmi_audio_startup,
+   .audio_shutdown = hdmi_audio_shutdown,
+   .audio_start = hdmi_audio_start,
+   .audio_stop = hdmi_audio_stop,
+   .audio_config = hdmi_audio_config,
+};
+
+static int hdmi_audio_register(struct device *dev)
+{
+   struct omap_hdmi_audio_pdata pdata = {
+   .dev = dev,
+   .dss_version = omapdss_get_version(),
+   .audio_dma_addr = hdmi_wp_get_audio_dma_addr(hdmi.wp),
+   .ops = hdmi_audio_ops,
+   };
+
+   hdmi.audio_pdev = platform_device_register_data(
+   dev, omap-hdmi-audio, PLATFORM_DEVID_AUTO,
+   pdata, sizeof(pdata));
+
+   if (IS_ERR(hdmi.audio_pdev))
+   return PTR_ERR(hdmi.audio_pdev);
+
+   return 0;
+}
+
 /* HDMI HW IP initialisation */
 static int omapdss_hdmihw_probe(struct platform_device *pdev)
 {
@@ -599,6 +713,14 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 
hdmi_init_output(pdev);
 
+   r = hdmi_audio_register(pdev-dev);
+   if (r) {
+   DSSERR(Registering HDMI audio failed\n);
+   hdmi_uninit_output(pdev);
+   pm_runtime_disable(pdev-dev);
+   return r;
+   }
+
dss_debugfs_create_file(hdmi, hdmi_dump_regs);
 
return 0;
@@ -606,6 +728,9 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 
 static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
 {
+   if (hdmi.audio_pdev)
+   platform_device_unregister(hdmi.audio_pdev);
+
hdmi_uninit_output(pdev);
 
pm_runtime_disable(pdev-dev);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to 

[PATCH v7 12/20] OMAPDSS: hdmi: Make hdmi_mode_has_audio() more user friedly

2014-11-12 Thread Jyri Sarha
Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index a6e08ff..6d129f2 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -345,9 +345,9 @@ void hdmi_wp_audio_config_format(struct hdmi_wp_data *wp,
struct hdmi_audio_format *aud_fmt);
 void hdmi_wp_audio_config_dma(struct hdmi_wp_data *wp,
struct hdmi_audio_dma *aud_dma);
-static inline bool hdmi_mode_has_audio(int mode)
+static inline bool hdmi_mode_has_audio(struct hdmi_config *cfg)
 {
-   return mode == HDMI_HDMI ? true : false;
+   return cfg-hdmi_dvi_mode == HDMI_HDMI ? true : false;
 }
 
 /* HDMI DRV data */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 14/20] OMAPDSS: hdmi4: Remove callbacks for the old ASoC DAI driver

2014-11-12 Thread Jyri Sarha
Removes the OMAP4 HDMI audio callbacks for the old external DAI driver.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi4.c |  113 -
 1 file changed, 113 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c 
b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 764443e..6f6764c 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -468,112 +468,6 @@ static int hdmi_read_edid(struct omap_dss_device *dssdev,
return r;
 }
 
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
-static int hdmi_audio_enable(struct omap_dss_device *dssdev)
-{
-   int r;
-
-   mutex_lock(hdmi.lock);
-
-   if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
-   r = -EPERM;
-   goto err;
-   }
-
-   r = hdmi_wp_audio_enable(hdmi.wp, true);
-   if (r)
-   goto err;
-
-   mutex_unlock(hdmi.lock);
-   return 0;
-
-err:
-   mutex_unlock(hdmi.lock);
-   return r;
-}
-
-static void hdmi_audio_disable(struct omap_dss_device *dssdev)
-{
-   hdmi_wp_audio_enable(hdmi.wp, false);
-}
-
-static int hdmi_audio_start(struct omap_dss_device *dssdev)
-{
-   return hdmi4_audio_start(hdmi.core, hdmi.wp);
-}
-
-static void hdmi_audio_stop(struct omap_dss_device *dssdev)
-{
-   hdmi4_audio_stop(hdmi.core, hdmi.wp);
-}
-
-static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
-{
-   bool r;
-
-   mutex_lock(hdmi.lock);
-
-   r = hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode);
-
-   mutex_unlock(hdmi.lock);
-   return r;
-}
-
-static int hdmi_audio_config(struct omap_dss_device *dssdev,
-   struct omap_dss_audio *audio)
-{
-   int r;
-   u32 pclk = hdmi.cfg.timings.pixelclock;
-
-   mutex_lock(hdmi.lock);
-
-   if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
-   r = -EPERM;
-   goto err;
-   }
-
-   r = hdmi4_audio_config(hdmi.core, hdmi.wp, audio, pclk);
-   if (r)
-   goto err;
-
-   mutex_unlock(hdmi.lock);
-   return 0;
-
-err:
-   mutex_unlock(hdmi.lock);
-   return r;
-}
-#else
-static int hdmi_audio_enable(struct omap_dss_device *dssdev)
-{
-   return -EPERM;
-}
-
-static void hdmi_audio_disable(struct omap_dss_device *dssdev)
-{
-}
-
-static int hdmi_audio_start(struct omap_dss_device *dssdev)
-{
-   return -EPERM;
-}
-
-static void hdmi_audio_stop(struct omap_dss_device *dssdev)
-{
-}
-
-static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
-{
-   return false;
-}
-
-static int hdmi_audio_config(struct omap_dss_device *dssdev,
-   struct omap_dss_audio *audio)
-{
-   return -EPERM;
-}
-#endif
-
 static int hdmi_set_infoframe(struct omap_dss_device *dssdev,
const struct hdmi_avi_infoframe *avi)
 {
@@ -602,13 +496,6 @@ static const struct omapdss_hdmi_ops hdmi_ops = {
.read_edid  = hdmi_read_edid,
.set_infoframe  = hdmi_set_infoframe,
.set_hdmi_mode  = hdmi_set_hdmi_mode,
-
-   .audio_enable   = hdmi_audio_enable,
-   .audio_disable  = hdmi_audio_disable,
-   .audio_start= hdmi_audio_start,
-   .audio_stop = hdmi_audio_stop,
-   .audio_supported= hdmi_audio_supported,
-   .audio_config   = hdmi_audio_config,
 };
 
 static void hdmi_init_output(struct platform_device *pdev)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 16/20] OMAPDSS: hdmi5: Remove callbacks for the old ASoC DAI driver

2014-11-12 Thread Jyri Sarha
Removes the OMAP5 HDMI audio callbacks for the old external DAI driver.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi5.c |  113 -
 1 file changed, 113 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c 
b/drivers/video/fbdev/omap2/dss/hdmi5.c
index 694cdee..1b9c86a 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -492,112 +492,6 @@ static int hdmi_read_edid(struct omap_dss_device *dssdev,
return r;
 }
 
-#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
-static int hdmi_audio_enable(struct omap_dss_device *dssdev)
-{
-   int r;
-
-   mutex_lock(hdmi.lock);
-
-   if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
-   r = -EPERM;
-   goto err;
-   }
-
-   r = hdmi_wp_audio_enable(hdmi.wp, true);
-   if (r)
-   goto err;
-
-   mutex_unlock(hdmi.lock);
-   return 0;
-
-err:
-   mutex_unlock(hdmi.lock);
-   return r;
-}
-
-static void hdmi_audio_disable(struct omap_dss_device *dssdev)
-{
-   hdmi_wp_audio_enable(hdmi.wp, false);
-}
-
-static int hdmi_audio_start(struct omap_dss_device *dssdev)
-{
-   return hdmi_wp_audio_core_req_enable(hdmi.wp, true);
-}
-
-static void hdmi_audio_stop(struct omap_dss_device *dssdev)
-{
-   hdmi_wp_audio_core_req_enable(hdmi.wp, false);
-}
-
-static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
-{
-   bool r;
-
-   mutex_lock(hdmi.lock);
-
-   r = hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode);
-
-   mutex_unlock(hdmi.lock);
-   return r;
-}
-
-static int hdmi_audio_config(struct omap_dss_device *dssdev,
-   struct omap_dss_audio *audio)
-{
-   int r;
-   u32 pclk = hdmi.cfg.timings.pixelclock;
-
-   mutex_lock(hdmi.lock);
-
-   if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
-   r = -EPERM;
-   goto err;
-   }
-
-   r = hdmi5_audio_config(hdmi.core, hdmi.wp, audio, pclk);
-   if (r)
-   goto err;
-
-   mutex_unlock(hdmi.lock);
-   return 0;
-
-err:
-   mutex_unlock(hdmi.lock);
-   return r;
-}
-#else
-static int hdmi_audio_enable(struct omap_dss_device *dssdev)
-{
-   return -EPERM;
-}
-
-static void hdmi_audio_disable(struct omap_dss_device *dssdev)
-{
-}
-
-static int hdmi_audio_start(struct omap_dss_device *dssdev)
-{
-   return -EPERM;
-}
-
-static void hdmi_audio_stop(struct omap_dss_device *dssdev)
-{
-}
-
-static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
-{
-   return false;
-}
-
-static int hdmi_audio_config(struct omap_dss_device *dssdev,
-   struct omap_dss_audio *audio)
-{
-   return -EPERM;
-}
-#endif
-
 static int hdmi_set_infoframe(struct omap_dss_device *dssdev,
const struct hdmi_avi_infoframe *avi)
 {
@@ -626,13 +520,6 @@ static const struct omapdss_hdmi_ops hdmi_ops = {
.read_edid  = hdmi_read_edid,
.set_infoframe  = hdmi_set_infoframe,
.set_hdmi_mode  = hdmi_set_hdmi_mode,
-
-   .audio_enable   = hdmi_audio_enable,
-   .audio_disable  = hdmi_audio_disable,
-   .audio_start= hdmi_audio_start,
-   .audio_stop = hdmi_audio_stop,
-   .audio_supported= hdmi_audio_supported,
-   .audio_config   = hdmi_audio_config,
 };
 
 static void hdmi_init_output(struct platform_device *pdev)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 18/20] ASoC: omap: Remove obsolete HDMI audio code and Kconfig options

2014-11-12 Thread Jyri Sarha
Removes omap-hdmi DAI driver, omap-hdmi-card driver, the related
Kconfig options, and Makefile entries. The HDMI DAI drivers has been
integrated directly to OMAP4+ HDMI drivers and simple-card driver is
used instead of omap-hdmi-card driver.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 sound/soc/omap/Kconfig  |   13 --
 sound/soc/omap/Makefile |4 -
 sound/soc/omap/omap-hdmi-card.c |   87 --
 sound/soc/omap/omap-hdmi.c  |  364 ---
 sound/soc/omap/omap-hdmi.h  |   38 
 5 files changed, 506 deletions(-)
 delete mode 100644 sound/soc/omap/omap-hdmi-card.c
 delete mode 100644 sound/soc/omap/omap-hdmi.c
 delete mode 100644 sound/soc/omap/omap-hdmi.h

diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 2b32b3e..3dfcadf 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -12,9 +12,6 @@ config SND_OMAP_SOC_MCBSP
 config SND_OMAP_SOC_MCPDM
tristate
 
-config SND_OMAP_SOC_HDMI
-   tristate
-
 config SND_OMAP_SOC_HDMI_AUDIO
tristate HDMI audio support for OMAP4+ based SoCs
depends on SND_OMAP_SOC
@@ -115,16 +112,6 @@ config SND_OMAP_SOC_OMAP_ABE_TWL6040
  - PandaBoard (4430)
  - PandaBoardES (4460)
 
-config SND_OMAP_SOC_OMAP_HDMI
-   tristate SoC Audio support for Texas Instruments OMAP HDMI
-   depends on SND_OMAP_SOC  OMAP4_DSS_HDMI  OMAP2_DSS
-   select SND_OMAP_SOC_HDMI
-   select SND_SOC_HDMI_CODEC
-   select OMAP4_DSS_HDMI_AUDIO
-   help
- Say Y if you want to add support for SoC HDMI audio on Texas 
Instruments
- OMAP4 chips
-
 config SND_OMAP_SOC_OMAP3_PANDORA
tristate SoC Audio support for OMAP3 Pandora
depends on TWL4030_CORE  SND_OMAP_SOC  MACH_OMAP3_PANDORA
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 40688a6..db36fbd 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -3,14 +3,12 @@ snd-soc-omap-objs := omap-pcm.o
 snd-soc-omap-dmic-objs := omap-dmic.o
 snd-soc-omap-mcbsp-objs := omap-mcbsp.o mcbsp.o
 snd-soc-omap-mcpdm-objs := omap-mcpdm.o
-snd-soc-omap-hdmi-objs := omap-hdmi.o
 snd-soc-omap-hdmi-audio-objs := omap-hdmi-audio.o
 
 obj-$(CONFIG_SND_OMAP_SOC) += snd-soc-omap.o
 obj-$(CONFIG_SND_OMAP_SOC_DMIC) += snd-soc-omap-dmic.o
 obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o
 obj-$(CONFIG_SND_OMAP_SOC_MCPDM) += snd-soc-omap-mcpdm.o
-obj-$(CONFIG_SND_OMAP_SOC_HDMI) += snd-soc-omap-hdmi.o
 obj-$(CONFIG_SND_OMAP_SOC_HDMI_AUDIO) += snd-soc-omap-hdmi-audio.o
 
 # OMAP Machine Support
@@ -22,7 +20,6 @@ snd-soc-am3517evm-objs := am3517evm.o
 snd-soc-omap-abe-twl6040-objs := omap-abe-twl6040.o
 snd-soc-omap-twl4030-objs := omap-twl4030.o
 snd-soc-omap3pandora-objs := omap3pandora.o
-snd-soc-omap-hdmi-card-objs := omap-hdmi-card.o
 
 obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
 obj-$(CONFIG_SND_OMAP_SOC_RX51) += snd-soc-rx51.o
@@ -32,4 +29,3 @@ obj-$(CONFIG_SND_OMAP_SOC_AM3517EVM) += snd-soc-am3517evm.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040) += snd-soc-omap-abe-twl6040.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP_TWL4030) += snd-soc-omap-twl4030.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
-obj-$(CONFIG_SND_OMAP_SOC_OMAP_HDMI) += snd-soc-omap-hdmi-card.o
diff --git a/sound/soc/omap/omap-hdmi-card.c b/sound/soc/omap/omap-hdmi-card.c
deleted file mode 100644
index f649fe8..000
--- a/sound/soc/omap/omap-hdmi-card.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * omap-hdmi-card.c
- *
- * OMAP ALSA SoC machine driver for TI OMAP HDMI
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- * Author: Ricardo Neri ricardo.n...@ti.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include linux/module.h
-#include sound/pcm.h
-#include sound/soc.h
-#include asm/mach-types.h
-#include video/omapdss.h
-
-#define DRV_NAME omap-hdmi-audio
-
-static struct snd_soc_dai_link omap_hdmi_dai = {
-   .name = HDMI,
-   .stream_name = HDMI,
-   .cpu_dai_name = omap-hdmi-audio-dai,
-   .platform_name = omap-hdmi-audio-dai,
-   .codec_name = hdmi-audio-codec,
-   .codec_dai_name = hdmi-hifi,
-};
-
-static struct snd_soc_card snd_soc_omap_hdmi = {
-   .name = OMAPHDMI,
-   .owner = THIS_MODULE,
-   .dai_link = omap_hdmi_dai,
-   .num_links = 1,
-};
-
-static int 

[PATCH v7 11/20] OMAPDSS: Kconfig: Remove HDMI audio booleans from Kconfig

2014-11-12 Thread Jyri Sarha
The booleans are not used anymore. Just select SND_OMAP_SOC_HDMI_AUDIO
to enable OMAP HDMI audio support.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/Kconfig |7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/Kconfig 
b/drivers/video/fbdev/omap2/dss/Kconfig
index 3d5eb6c..d1fa730 100644
--- a/drivers/video/fbdev/omap2/dss/Kconfig
+++ b/drivers/video/fbdev/omap2/dss/Kconfig
@@ -74,9 +74,6 @@ config OMAP4_DSS_HDMI
help
  HDMI support for OMAP4 based SoCs.
 
-config OMAP4_DSS_HDMI_AUDIO
-   bool
-
 config OMAP5_DSS_HDMI
bool HDMI support for OMAP5
default n
@@ -86,10 +83,6 @@ config OMAP5_DSS_HDMI
  Definition Multimedia Interface. See http://www.hdmi.org/ for HDMI
  specification.
 
-config OMAP5_DSS_HDMI_AUDIO
-   depends on OMAP5_DSS_HDMI
-   bool
-
 config OMAP2_DSS_SDI
bool SDI support
 default n
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 07/20] OMAPDSS: hdmi_wp: Add function for getting audio dma address

2014-11-12 Thread Jyri Sarha
The audio dma port is found in the hdmi_wp physical address space.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h|2 ++
 drivers/video/fbdev/omap2/dss/hdmi_wp.c |6 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 03726b5..9ba7c1a 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -250,6 +250,7 @@ struct hdmi_core_audio_config {
 
 struct hdmi_wp_data {
void __iomem *base;
+   phys_addr_t phys_base;
 };
 
 struct hdmi_pll_data {
@@ -317,6 +318,7 @@ void hdmi_wp_video_config_timing(struct hdmi_wp_data *wp,
 void hdmi_wp_init_vid_fmt_timings(struct hdmi_video_format *video_fmt,
struct omap_video_timings *timings, struct hdmi_config *param);
 int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp);
+phys_addr_t hdmi_wp_get_audio_dma_addr(struct hdmi_wp_data *wp);
 
 /* HDMI PLL funcs */
 int hdmi_pll_enable(struct hdmi_pll_data *pll, struct hdmi_wp_data *wp);
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_wp.c 
b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
index 4ead962..c15377e 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_wp.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
@@ -249,6 +249,7 @@ int hdmi_wp_init(struct platform_device *pdev, struct 
hdmi_wp_data *wp)
DSSERR(can't get WP mem resource\n);
return -EINVAL;
}
+   wp-phys_base = res-start;
 
wp-base = devm_ioremap_resource(pdev-dev, res);
if (IS_ERR(wp-base)) {
@@ -258,3 +259,8 @@ int hdmi_wp_init(struct platform_device *pdev, struct 
hdmi_wp_data *wp)
 
return 0;
 }
+
+phys_addr_t hdmi_wp_get_audio_dma_addr(struct hdmi_wp_data *wp)
+{
+   return wp-phys_base + HDMI_WP_AUDIO_DATA;
+}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 17/20] OMAPDSS: hdmi5: Register ASoC platform device for omap hdmi audio

2014-11-12 Thread Jyri Sarha
Implements callbacks for OMAP HDMI audio platform driver and registers
it in probe function. Unregistering is done in remove function.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi5.c |  125 +
 1 file changed, 125 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c 
b/drivers/video/fbdev/omap2/dss/hdmi5.c
index 1b9c86a..feb76e2 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -38,6 +38,7 @@
 #include linux/gpio.h
 #include linux/regulator/consumer.h
 #include video/omapdss.h
+#include sound/omap-hdmi-audio.h
 
 #include hdmi5_core.h
 #include dss.h
@@ -360,6 +361,8 @@ static int hdmi_display_enable(struct omap_dss_device 
*dssdev)
goto err0;
}
 
+   hdmi.display_enabled = true;
+
mutex_unlock(hdmi.lock);
return 0;
 
@@ -374,8 +377,13 @@ static void hdmi_display_disable(struct omap_dss_device 
*dssdev)
 
mutex_lock(hdmi.lock);
 
+   if (hdmi.audio_pdev  hdmi.audio_abort_cb)
+   hdmi.audio_abort_cb(hdmi.audio_pdev-dev);
+
hdmi_power_off_full(dssdev);
 
+   hdmi.display_enabled = false;
+
mutex_unlock(hdmi.lock);
 }
 
@@ -566,6 +574,112 @@ err:
return r;
 }
 
+/* Audio callbacks */
+static int hdmi_audio_startup(struct device *dev,
+ void (*abort_cb)(struct device *dev))
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+   int ret = 0;
+
+   mutex_lock(hd-lock);
+
+   if (!hdmi_mode_has_audio(hd-cfg) || !hd-display_enabled) {
+   ret = -EPERM;
+   goto out;
+   }
+
+   hd-audio_abort_cb = abort_cb;
+
+out:
+   mutex_unlock(hd-lock);
+
+   return ret;
+}
+
+static int hdmi_audio_shutdown(struct device *dev)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+
+   mutex_lock(hd-lock);
+   hd-audio_abort_cb = NULL;
+   mutex_unlock(hd-lock);
+
+   return 0;
+}
+
+static int hdmi_audio_start(struct device *dev)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+
+   WARN_ON(!hdmi_mode_has_audio(hd-cfg));
+   WARN_ON(!hd-display_enabled);
+
+   hdmi_wp_audio_enable(hd-wp, true);
+   hdmi_wp_audio_core_req_enable(hd-wp, true);
+
+   return 0;
+}
+
+static void hdmi_audio_stop(struct device *dev)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+
+   WARN_ON(!hdmi_mode_has_audio(hd-cfg));
+   WARN_ON(!hd-display_enabled);
+
+   hdmi_wp_audio_core_req_enable(hd-wp, false);
+   hdmi_wp_audio_enable(hd-wp, false);
+}
+
+static int hdmi_audio_config(struct device *dev,
+struct omap_dss_audio *dss_audio)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+   int ret;
+
+   mutex_lock(hd-lock);
+
+   if (!hdmi_mode_has_audio(hd-cfg) || !hd-display_enabled) {
+   ret = -EPERM;
+   goto out;
+   }
+
+   ret = hdmi5_audio_config(hd-core, hd-wp, dss_audio,
+hd-cfg.timings.pixelclock);
+
+out:
+   mutex_unlock(hd-lock);
+
+   return ret;
+}
+
+static const struct omap_hdmi_audio_ops hdmi_audio_ops = {
+   .audio_startup = hdmi_audio_startup,
+   .audio_shutdown = hdmi_audio_shutdown,
+   .audio_start = hdmi_audio_start,
+   .audio_stop = hdmi_audio_stop,
+   .audio_config = hdmi_audio_config,
+};
+
+static int hdmi_audio_register(struct device *dev)
+{
+   struct omap_hdmi_audio_pdata pdata = {
+   .dev = dev,
+   .dss_version = omapdss_get_version(),
+   .audio_dma_addr = hdmi_wp_get_audio_dma_addr(hdmi.wp),
+   .ops = hdmi_audio_ops,
+   };
+
+   hdmi.audio_pdev = platform_device_register_data(
+   dev, omap-hdmi-audio, PLATFORM_DEVID_AUTO,
+   pdata, sizeof(pdata));
+
+   if (IS_ERR(hdmi.audio_pdev))
+   return PTR_ERR(hdmi.audio_pdev);
+
+   return 0;
+}
+
 /* HDMI HW IP initialisation */
 static int omapdss_hdmihw_probe(struct platform_device *pdev)
 {
@@ -623,6 +737,14 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 
hdmi_init_output(pdev);
 
+   r = hdmi_audio_register(pdev-dev);
+   if (r) {
+   DSSERR(Registering HDMI audio failed %d\n, r);
+   hdmi_uninit_output(pdev);
+   pm_runtime_disable(pdev-dev);
+   return r;
+   }
+
dss_debugfs_create_file(hdmi, hdmi_dump_regs);
 
return 0;
@@ -630,6 +752,9 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 
 static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
 {
+   if (hdmi.audio_pdev)
+   platform_device_unregister(hdmi.audio_pdev);
+
hdmi_uninit_output(pdev);
 
pm_runtime_disable(pdev-dev);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a 

[PATCH v7 05/20] OMAPDSS: hdmi4_core: Remove unused hdmi4_audio_get_dma_port()

2014-11-12 Thread Jyri Sarha
hdmi4_audio_get_dma_port() is unused and and broken.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi4_core.c |9 -
 drivers/video/fbdev/omap2/dss/hdmi4_core.h |2 --
 2 files changed, 11 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.c 
b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
index 3b448d9..7eafea5 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
@@ -874,15 +874,6 @@ void hdmi4_audio_stop(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp)
hdmi_wp_audio_core_req_enable(wp, false);
 }
 
-int hdmi4_audio_get_dma_port(u32 *offset, u32 *size)
-{
-   if (!offset || !size)
-   return -EINVAL;
-   *offset = HDMI_WP_AUDIO_DATA;
-   *size = 4;
-   return 0;
-}
-
 int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
 {
struct resource *res;
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.h 
b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
index c1959f7..a069f96 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
@@ -270,6 +270,4 @@ int hdmi4_audio_start(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp);
 void hdmi4_audio_stop(struct hdmi_core_data *core, struct hdmi_wp_data *wp);
 int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
struct omap_dss_audio *audio, u32 pclk);
-int hdmi4_audio_get_dma_port(u32 *offset, u32 *size);
-
 #endif
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/22] OMAPDSS: DSI: wait for hsdiv clocks when enabling PLL

2014-11-12 Thread Tomi Valkeinen
At the moment we have two functions to wait for the HSDIV clocks to get
active, dsi_wait_pll_hsdiv_dispc_active and
dsi_wait_pll_hsdiv_dsi_active. Instead of such inconvenient functions,
let's just make sure that the hsdiv clocks are active after the pll has
been enabled.

This patch adds code to dsi_pll_set_clock_div() to wait until HSDIV
clocks are active.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/dsi.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/dsi.c 
b/drivers/video/fbdev/omap2/dss/dsi.c
index 0793bc67a275..fe8196b17a5e 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -1514,6 +1514,20 @@ static void dsi_pll_calc_dsi_fck(struct dsi_clock_info 
*cinfo)
cinfo-dsi_pll_hsdiv_dsi_clk = cinfo-clkin4ddr / cinfo-regm_dsi;
 }
 
+static int dsi_wait_hsdiv_ack(struct platform_device *dsidev, u32 
hsdiv_ack_mask)
+{
+   int t = 100;
+
+   while (t--  0) {
+   u32 v = dsi_read_reg(dsidev, DSI_PLL_STATUS);
+   v = hsdiv_ack_mask;
+   if (v == hsdiv_ack_mask)
+   return 0;
+   }
+
+   return -ETIMEDOUT;
+}
+
 int dsi_pll_set_clock_div(struct platform_device *dsidev,
struct dsi_clock_info *cinfo)
 {
@@ -1646,6 +1660,13 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev,
l = FLD_MOD(l, 0, 20, 20);  /* DSI_HSDIVBYPASS */
dsi_write_reg(dsidev, DSI_PLL_CONFIGURATION2, l);
 
+   r = dsi_wait_hsdiv_ack(dsidev, BIT(7) | BIT(8));
+   if (r) {
+   DSSERR(failed to enable HSDIV clocks: %d\n, r);
+   goto err;
+   }
+
+
DSSDBG(PLL config done\n);
 err:
return r;
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/22] OMAPDSS: DSI: dsi_runtime_get/put in pll_init

2014-11-12 Thread Tomi Valkeinen
When DPI uses the DSI PLL for pixel clock, the DPI code will call
dsi_runtime_get/put to keep the DSI block enabled. A much simpler way to
handle this is to do dsi_runtime_get/put in DSI's dsi_pll_init() and
dsi_pll_uninit(), thus removing the need for DSI to call the runtime PM
functions.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/dpi.c | 17 +
 drivers/video/fbdev/omap2/dss/dsi.c | 10 --
 drivers/video/fbdev/omap2/dss/dss.h | 10 --
 3 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dpi.c 
b/drivers/video/fbdev/omap2/dss/dpi.c
index 0b9af5d3e650..81dd5e61e75e 100644
--- a/drivers/video/fbdev/omap2/dss/dpi.c
+++ b/drivers/video/fbdev/omap2/dss/dpi.c
@@ -402,10 +402,6 @@ static int dpi_display_enable(struct omap_dss_device 
*dssdev)
goto err_src_sel;
 
if (dpi-dsidev) {
-   r = dsi_runtime_get(dpi-dsidev);
-   if (r)
-   goto err_get_dsi;
-
r = dsi_pll_init(dpi-dsidev);
if (r)
goto err_dsi_pll_init;
@@ -432,9 +428,6 @@ err_set_mode:
if (dpi-dsidev)
dsi_pll_uninit(dpi-dsidev, true);
 err_dsi_pll_init:
-   if (dpi-dsidev)
-   dsi_runtime_put(dpi-dsidev);
-err_get_dsi:
 err_src_sel:
dispc_runtime_put();
 err_get_dispc:
@@ -459,7 +452,6 @@ static void dpi_display_disable(struct omap_dss_device 
*dssdev)
if (dpi-dsidev) {
dss_select_lcd_clk_source(mgr-id, OMAP_DSS_CLK_SRC_FCK);
dsi_pll_uninit(dpi-dsidev, true);
-   dsi_runtime_put(dpi-dsidev);
}
 
dispc_runtime_put();
@@ -554,18 +546,11 @@ static int dpi_verify_dsi_pll(struct platform_device 
*dsidev)
 
/* do initial setup with the PLL to see if it is operational */
 
-   r = dsi_runtime_get(dsidev);
-   if (r)
-   return r;
-
r = dsi_pll_init(dsidev);
-   if (r) {
-   dsi_runtime_put(dsidev);
+   if (r)
return r;
-   }
 
dsi_pll_uninit(dsidev, true);
-   dsi_runtime_put(dsidev);
 
return 0;
 }
diff --git a/drivers/video/fbdev/omap2/dss/dsi.c 
b/drivers/video/fbdev/omap2/dss/dsi.c
index 22cc91851e94..e8415b5e877e 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -1144,7 +1144,7 @@ static u32 dsi_get_errors(struct platform_device *dsidev)
return e;
 }
 
-int dsi_runtime_get(struct platform_device *dsidev)
+static int dsi_runtime_get(struct platform_device *dsidev)
 {
int r;
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
@@ -1156,7 +1156,7 @@ int dsi_runtime_get(struct platform_device *dsidev)
return r  0 ? r : 0;
 }
 
-void dsi_runtime_put(struct platform_device *dsidev)
+static void dsi_runtime_put(struct platform_device *dsidev)
 {
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
int r;
@@ -1674,6 +1674,10 @@ int dsi_pll_init(struct platform_device *dsidev)
if (r)
return r;
 
+   r = dsi_runtime_get(dsidev);
+   if (r)
+   return r;
+
dsi_enable_pll_clock(dsidev, 1);
/*
 * Note: SCP CLK is not required on OMAP3, but it is required on OMAP4.
@@ -1717,6 +1721,7 @@ err1:
 err0:
dsi_disable_scp_clk(dsidev);
dsi_enable_pll_clock(dsidev, 0);
+   dsi_runtime_put(dsidev);
return r;
 }
 
@@ -1733,6 +1738,7 @@ void dsi_pll_uninit(struct platform_device *dsidev, bool 
disconnect_lanes)
 
dsi_disable_scp_clk(dsidev);
dsi_enable_pll_clock(dsidev, 0);
+   dsi_runtime_put(dsidev);
 
DSSDBG(PLL uninit done\n);
 }
diff --git a/drivers/video/fbdev/omap2/dss/dss.h 
b/drivers/video/fbdev/omap2/dss/dss.h
index e14a75b743a4..4c268985235c 100644
--- a/drivers/video/fbdev/omap2/dss/dss.h
+++ b/drivers/video/fbdev/omap2/dss/dss.h
@@ -268,9 +268,6 @@ struct file_operations;
 int dsi_init_platform_driver(void) __init;
 void dsi_uninit_platform_driver(void) __exit;
 
-int dsi_runtime_get(struct platform_device *dsidev);
-void dsi_runtime_put(struct platform_device *dsidev);
-
 void dsi_dump_clocks(struct seq_file *s);
 
 void dsi_irq_handler(void);
@@ -291,13 +288,6 @@ int dsi_pll_init(struct platform_device *dsidev);
 void dsi_pll_uninit(struct platform_device *dsidev, bool disconnect_lanes);
 struct platform_device *dsi_get_dsidev_from_id(int module);
 #else
-static inline int dsi_runtime_get(struct platform_device *dsidev)
-{
-   return 0;
-}
-static inline void dsi_runtime_put(struct platform_device *dsidev)
-{
-}
 static inline u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt)
 {
WARN(%s: DSI not compiled in, returning pixel_size as 0\n, __func__);
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo 

[PATCH 08/22] OMAPDSS: DSI: rename clkin4ddr to clkdco

2014-11-12 Thread Tomi Valkeinen
We are creating a common DSS PLL code, so rename 'clkin4ddr' field,
which is DSI specific name, to 'clkdco' which is a generic name.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/dpi.c |  2 +-
 drivers/video/fbdev/omap2/dss/dsi.c | 36 ++--
 drivers/video/fbdev/omap2/dss/dss.h |  2 +-
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dpi.c 
b/drivers/video/fbdev/omap2/dss/dpi.c
index 91f18ab72007..f6a14c80bd0b 100644
--- a/drivers/video/fbdev/omap2/dss/dpi.c
+++ b/drivers/video/fbdev/omap2/dss/dpi.c
@@ -195,7 +195,7 @@ static bool dpi_calc_pll_cb(int regn, int regm, unsigned 
long fint,
ctx-dsi_cinfo.regn = regn;
ctx-dsi_cinfo.regm = regm;
ctx-dsi_cinfo.fint = fint;
-   ctx-dsi_cinfo.clkin4ddr = pll;
+   ctx-dsi_cinfo.clkdco = pll;
 
return dsi_hsdiv_calc(ctx-dsidev, pll, ctx-pck_min,
dpi_calc_hsdiv_cb, ctx);
diff --git a/drivers/video/fbdev/omap2/dss/dsi.c 
b/drivers/video/fbdev/omap2/dss/dsi.c
index b0a3c9ed1341..5996ffd6dff1 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -1275,7 +1275,7 @@ static unsigned long dsi_get_txbyteclkhs(struct 
platform_device *dsidev)
 {
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
 
-   return dsi-current_cinfo.clkin4ddr / 16;
+   return dsi-current_cinfo.clkdco / 16;
 }
 
 static unsigned long dsi_fclk_rate(struct platform_device *dsidev)
@@ -1484,20 +1484,20 @@ static int dsi_calc_clock_rates(struct platform_device 
*dsidev,
if (cinfo-fint  dsi-fint_max || cinfo-fint  dsi-fint_min)
return -EINVAL;
 
-   cinfo-clkin4ddr = 2 * cinfo-regm * cinfo-fint;
+   cinfo-clkdco = 2 * cinfo-regm * cinfo-fint;
 
-   if (cinfo-clkin4ddr  1800 * 1000 * 1000)
+   if (cinfo-clkdco  1800 * 1000 * 1000)
return -EINVAL;
 
if (cinfo-regm_dispc  0)
cinfo-dsi_pll_hsdiv_dispc_clk =
-   cinfo-clkin4ddr / cinfo-regm_dispc;
+   cinfo-clkdco / cinfo-regm_dispc;
else
cinfo-dsi_pll_hsdiv_dispc_clk = 0;
 
if (cinfo-regm_dsi  0)
cinfo-dsi_pll_hsdiv_dsi_clk =
-   cinfo-clkin4ddr / cinfo-regm_dsi;
+   cinfo-clkdco / cinfo-regm_dsi;
else
cinfo-dsi_pll_hsdiv_dsi_clk = 0;
 
@@ -1510,8 +1510,8 @@ static void dsi_pll_calc_dsi_fck(struct dsi_clock_info 
*cinfo)
 
max_dsi_fck = dss_feat_get_param_max(FEAT_PARAM_DSI_FCK);
 
-   cinfo-regm_dsi = DIV_ROUND_UP(cinfo-clkin4ddr, max_dsi_fck);
-   cinfo-dsi_pll_hsdiv_dsi_clk = cinfo-clkin4ddr / cinfo-regm_dsi;
+   cinfo-regm_dsi = DIV_ROUND_UP(cinfo-clkdco, max_dsi_fck);
+   cinfo-dsi_pll_hsdiv_dsi_clk = cinfo-clkdco / cinfo-regm_dsi;
 }
 
 static int dsi_wait_hsdiv_ack(struct platform_device *dsidev, u32 
hsdiv_ack_mask)
@@ -1551,12 +1551,12 @@ int dsi_pll_set_clock_div(struct platform_device 
*dsidev,
cinfo-regm,
cinfo-regn,
clk_get_rate(dsi-sys_clk),
-   cinfo-clkin4ddr);
+   cinfo-clkdco);
 
DSSDBG(Data rate on 1 DSI lane %ld Mbps\n,
-   cinfo-clkin4ddr / 1000 / 1000 / 2);
+   cinfo-clkdco / 1000 / 1000 / 2);
 
-   DSSDBG(Clock lane freq %ld Hz\n, cinfo-clkin4ddr / 4);
+   DSSDBG(Clock lane freq %ld Hz\n, cinfo-clkdco / 4);
 
DSSDBG(regm_dispc = %d, %s (%s) = %lu\n, cinfo-regm_dispc,

dss_get_generic_clk_source_name(OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC),
@@ -1604,7 +1604,7 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev,
 
l = FLD_MOD(l, f, 4, 1);/* DSI_PLL_FREQSEL */
} else if (dss_has_feature(FEAT_DSI_PLL_SELFREQDCO)) {
-   f = cinfo-clkin4ddr  10 ? 0x2 : 0x4;
+   f = cinfo-clkdco  10 ? 0x2 : 0x4;
 
l = FLD_MOD(l, f, 3, 1);/* PLL_SELFREQDCO */
}
@@ -1754,7 +1754,7 @@ static void dsi_dump_dsidev_clocks(struct platform_device 
*dsidev,
seq_printf(s,   Fint\t\t%-16luregn %u\n, cinfo-fint, cinfo-regn);
 
seq_printf(s,   CLKIN4DDR\t%-16luregm %u\n,
-   cinfo-clkin4ddr, cinfo-regm);
+   cinfo-clkdco, cinfo-regm);
 
seq_printf(s,   DSI_PLL_HSDIV_DISPC (%s)\t%-16luregm_dispc %u\t(%s)\n,
dss_feat_get_clk_source_name(dsi_module == 0 ?
@@ -1783,7 +1783,7 @@ static void dsi_dump_dsidev_clocks(struct platform_device 
*dsidev,
seq_printf(s,   DSI_FCLK\t%lu\n, dsi_fclk_rate(dsidev));
 
seq_printf(s,   DDR_CLK\t\t%lu\n,
-   cinfo-clkin4ddr / 4);
+   cinfo-clkdco / 4);
 
seq_printf(s,   TxByteClkHS\t%lu\n, 

[PATCH 18/22] OMAPDSS: HDMI: store WP pointer to hdmi_pll_data

2014-11-12 Thread Tomi Valkeinen
HDMI PLL code needs the pointer to the WP block so that it can manage
its power. Currently this is passed as a function parameter to
hdmi_pll_enable and hdmi_pll_disable. To make the PLL function adhere to
the DSS PLL API, we need to remove the WP parameter.

This patch stores the WP pointer to hdmi_pll_data in hdmi_pll_init, so
that it's available when needed.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h |  9 ++---
 drivers/video/fbdev/omap2/dss/hdmi4.c|  8 
 drivers/video/fbdev/omap2/dss/hdmi5.c|  8 
 drivers/video/fbdev/omap2/dss/hdmi_pll.c | 12 +---
 4 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 4b9bf0804a48..03761ecb81a6 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -248,6 +248,8 @@ struct hdmi_wp_data {
 struct hdmi_pll_data {
void __iomem *base;
 
+   struct hdmi_wp_data *wp;
+
struct hdmi_pll_info info;
 };
 
@@ -312,12 +314,13 @@ void hdmi_wp_init_vid_fmt_timings(struct 
hdmi_video_format *video_fmt,
 int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp);
 
 /* HDMI PLL funcs */
-int hdmi_pll_enable(struct hdmi_pll_data *pll, struct hdmi_wp_data *wp);
-void hdmi_pll_disable(struct hdmi_pll_data *pll, struct hdmi_wp_data *wp);
+int hdmi_pll_enable(struct hdmi_pll_data *pll);
+void hdmi_pll_disable(struct hdmi_pll_data *pll);
 void hdmi_pll_dump(struct hdmi_pll_data *pll, struct seq_file *s);
 void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned long clkin,
unsigned long target_tmds);
-int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll);
+int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll,
+   struct hdmi_wp_data *wp);
 
 /* HDMI PHY funcs */
 int hdmi_phy_configure(struct hdmi_phy_data *phy, unsigned long hfbitclk,
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c 
b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 1f2fbccaff1f..2094b6eae99e 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -197,7 +197,7 @@ static int hdmi_power_on_full(struct omap_dss_device 
*dssdev)
hdmi_pll_compute(hdmi.pll, clk_get_rate(hdmi.sys_clk), p-pixelclock);
 
/* config the PLL and PHY hdmi_set_pll_pwrfirst */
-   r = hdmi_pll_enable(hdmi.pll, hdmi.wp);
+   r = hdmi_pll_enable(hdmi.pll);
if (r) {
DSSDBG(Failed to lock PLL\n);
goto err_pll_enable;
@@ -241,7 +241,7 @@ err_vid_enable:
 err_phy_cfg:
hdmi_wp_set_phy_pwr(hdmi.wp, HDMI_PHYPWRCMD_OFF);
 err_phy_pwr:
-   hdmi_pll_disable(hdmi.pll, hdmi.wp);
+   hdmi_pll_disable(hdmi.pll);
 err_pll_enable:
hdmi_power_off_core(dssdev);
return -EIO;
@@ -259,7 +259,7 @@ static void hdmi_power_off_full(struct omap_dss_device 
*dssdev)
 
hdmi_wp_set_phy_pwr(hdmi.wp, HDMI_PHYPWRCMD_OFF);
 
-   hdmi_pll_disable(hdmi.pll, hdmi.wp);
+   hdmi_pll_disable(hdmi.pll);
 
hdmi_power_off_core(dssdev);
 }
@@ -688,7 +688,7 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
if (r)
return r;
 
-   r = hdmi_pll_init(pdev, hdmi.pll);
+   r = hdmi_pll_init(pdev, hdmi.pll, hdmi.wp);
if (r)
return r;
 
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c 
b/drivers/video/fbdev/omap2/dss/hdmi5.c
index e8ca9106c8af..fb8c14507a4d 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -215,7 +215,7 @@ static int hdmi_power_on_full(struct omap_dss_device 
*dssdev)
hdmi_wp_get_irqstatus(hdmi.wp));
 
/* config the PLL and PHY hdmi_set_pll_pwrfirst */
-   r = hdmi_pll_enable(hdmi.pll, hdmi.wp);
+   r = hdmi_pll_enable(hdmi.pll);
if (r) {
DSSDBG(Failed to lock PLL\n);
goto err_pll_enable;
@@ -259,7 +259,7 @@ err_vid_enable:
hdmi_wp_set_phy_pwr(hdmi.wp, HDMI_PHYPWRCMD_OFF);
 err_phy_pwr:
 err_phy_cfg:
-   hdmi_pll_disable(hdmi.pll, hdmi.wp);
+   hdmi_pll_disable(hdmi.pll);
 err_pll_enable:
hdmi_power_off_core(dssdev);
return -EIO;
@@ -277,7 +277,7 @@ static void hdmi_power_off_full(struct omap_dss_device 
*dssdev)
 
hdmi_wp_set_phy_pwr(hdmi.wp, HDMI_PHYPWRCMD_OFF);
 
-   hdmi_pll_disable(hdmi.pll, hdmi.wp);
+   hdmi_pll_disable(hdmi.pll);
 
hdmi_power_off_core(dssdev);
 }
@@ -717,7 +717,7 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
if (r)
return r;
 
-   r = hdmi_pll_init(pdev, hdmi.pll);
+   r = hdmi_pll_init(pdev, hdmi.pll, hdmi.wp);
if (r)
return r;
 
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c 
b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
index 0942bdc8dfa6..190bede1dcb9 100644
--- 

[PATCH 06/22] OMAPDSS: DSI: remove pll_locked field

2014-11-12 Thread Tomi Valkeinen
We have pll_locked field in struct dsi_data, but it doesn't have any
meaningful use anymore, and can be removed.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/dsi.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dsi.c 
b/drivers/video/fbdev/omap2/dss/dsi.c
index deab4135ddc0..37517e407f37 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -329,8 +329,6 @@ struct dsi_data {
struct mutex lock;
struct semaphore bus_lock;
 
-   unsigned pll_locked;
-
spinlock_t irq_lock;
struct dsi_isr_tables isr_tables;
/* space for a copy used by the interrupt handler */
@@ -1206,11 +1204,6 @@ static inline void dsi_enable_pll_clock(struct 
platform_device *dsidev,
clk_prepare_enable(dsi-sys_clk);
else
clk_disable_unprepare(dsi-sys_clk);
-
-   if (enable  dsi-pll_locked) {
-   if (wait_for_bit_change(dsidev, DSI_PLL_STATUS, 1, 1) != 1)
-   DSSERR(cannot lock PLL when enabling clocks\n);
-   }
 }
 
 static void _dsi_print_reset_status(struct platform_device *dsidev)
@@ -1647,8 +1640,6 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev,
goto err;
}
 
-   dsi-pll_locked = 1;
-
l = dsi_read_reg(dsidev, DSI_PLL_CONFIGURATION2);
l = FLD_MOD(l, 0, 0, 0);/* DSI_PLL_IDLE */
l = FLD_MOD(l, 0, 5, 5);/* DSI_PLL_PLLLPMODE */
@@ -1739,7 +1730,6 @@ void dsi_pll_uninit(struct platform_device *dsidev, bool 
disconnect_lanes)
 {
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
 
-   dsi-pll_locked = 0;
dsi_pll_power(dsidev, DSI_PLL_POWER_OFF);
if (disconnect_lanes) {
WARN_ON(!dsi-vdds_dsi_enabled);
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/22] OMAPDSS: HDMI: fix setting REFSEL

2014-11-12 Thread Tomi Valkeinen
Only OMAP5+ has REFSEL field, but at the moment it's set also on OMAP4.

Fix this by adding a has_refsel field, and setting the REFSEL based on
that.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h | 8 
 drivers/video/fbdev/omap2/dss/hdmi_pll.c | 8 
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 262771b9b76b..4bbc9d206f4a 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -101,13 +101,6 @@ enum hdmi_core_hdmi_dvi {
HDMI_HDMI = 1
 };
 
-enum hdmi_clk_refsel {
-   HDMI_REFSEL_PCLK = 0,
-   HDMI_REFSEL_REF1 = 1,
-   HDMI_REFSEL_REF2 = 2,
-   HDMI_REFSEL_SYSCLK = 3
-};
-
 enum hdmi_packing_mode {
HDMI_PACK_10b_RGB_YUV444 = 0,
HDMI_PACK_24b_RGB_YUV444_YUV422 = 1,
@@ -199,7 +192,6 @@ struct hdmi_pll_info {
u16 regm2;
u16 regsd;
u16 dcofreq;
-   enum hdmi_clk_refsel refsel;
 };
 
 struct hdmi_audio_format {
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c 
b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
index 6d92bb32fe51..b28d41a08a8f 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_pll.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
@@ -24,6 +24,7 @@
 #define HDMI_DEFAULT_REGM2 1
 
 struct hdmi_pll_features {
+   bool has_refsel;
bool sys_reset;
/* this is a hack, need to replace it with a better computation of M2 */
bool bound_dcofreq;
@@ -96,9 +97,6 @@ void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned 
long clkin, int phy)
pi-dcofreq = phy  1000 * 100;
pi-regsd = ((pi-regm * clkin / 10) / (pi-regn * 250) + 5) / 10;
 
-   /* Set the reference clock to sysclk reference */
-   pi-refsel = HDMI_REFSEL_SYSCLK;
-
DSSDBG(M = %d Mf = %d\n, pi-regm, pi-regmf);
DSSDBG(range = %d sd = %d\n, pi-dcofreq, pi-regsd);
 }
@@ -122,7 +120,8 @@ static int hdmi_pll_config(struct hdmi_pll_data *pll)
r = FLD_MOD(r, 0x0, 12, 12);/* PLL_HIGHFREQ divide by 2 */
r = FLD_MOD(r, 0x1, 13, 13);/* PLL_REFEN */
r = FLD_MOD(r, 0x0, 14, 14);/* PHY_CLKINEN de-assert during locking 
*/
-   r = FLD_MOD(r, fmt-refsel, 22, 21);/* REFSEL */
+   if (pll_feat-has_refsel)
+   r = FLD_MOD(r, 0x3, 22, 21);/* REFSEL = SYSCLK */
 
if (fmt-dcofreq)
r = FLD_MOD(r, 0x4, 3, 1);  /* 1000MHz and 2000MHz */
@@ -222,6 +221,7 @@ static const struct hdmi_pll_features omap44xx_pll_feats = {
 };
 
 static const struct hdmi_pll_features omap54xx_pll_feats = {
+   .has_refsel =   true,
.sys_reset  =   true,
.bound_dcofreq  =   true,
.fint_min   =   62,
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/22] OMAPDSS: DSI: features: combine dsi dispc hsdivs

2014-11-12 Thread Tomi Valkeinen
The HSDIV outputs of DSI PLL (and also other PLLs) all have the same
bit width for the divider value.

Simplify the code by merging HSDIV divider widths into one width.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/dsi.c  | 13 ++---
 drivers/video/fbdev/omap2/dss/dss_features.c | 12 
 drivers/video/fbdev/omap2/dss/dss_features.h |  3 +--
 3 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dsi.c 
b/drivers/video/fbdev/omap2/dss/dsi.c
index 406af309f8ff..22cc91851e94 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -374,7 +374,7 @@ struct dsi_data {
 #endif
/* DSI PLL Parameter Ranges */
unsigned long regm_max, regn_max;
-   unsigned long  regm_dispc_max, regm_dsi_max;
+   unsigned long  regm_hsdiv_max;
unsigned long  fint_min, fint_max;
unsigned long lpdiv_max;
 
@@ -1414,7 +1414,7 @@ bool dsi_hsdiv_calc(struct platform_device *dsidev, 
unsigned long pll,
out_max = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK);
 
regm_start = max(DIV_ROUND_UP(pll, out_max), 1ul);
-   regm_stop = min(pll / out_min, dsi-regm_dispc_max);
+   regm_stop = min(pll / out_min, dsi-regm_hsdiv_max);
 
for (regm = regm_start; regm = regm_stop; ++regm) {
out = pll / regm;
@@ -1477,10 +1477,10 @@ static int dsi_calc_clock_rates(struct platform_device 
*dsidev,
if (cinfo-regm == 0 || cinfo-regm  dsi-regm_max)
return -EINVAL;
 
-   if (cinfo-regm_hsdiv[HSDIV_DISPC]  dsi-regm_dispc_max)
+   if (cinfo-regm_hsdiv[HSDIV_DISPC]  dsi-regm_hsdiv_max)
return -EINVAL;
 
-   if (cinfo-regm_hsdiv[HSDIV_DSI]  dsi-regm_dsi_max)
+   if (cinfo-regm_hsdiv[HSDIV_DSI]  dsi-regm_hsdiv_max)
return -EINVAL;
 
cinfo-fint = clk_get_rate(dsi-sys_clk) / cinfo-regn;
@@ -5232,9 +5232,8 @@ static void dsi_calc_clock_param_ranges(struct 
platform_device *dsidev)
 
dsi-regn_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_REGN);
dsi-regm_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_REGM);
-   dsi-regm_dispc_max =
-   dss_feat_get_param_max(FEAT_PARAM_DSIPLL_REGM_DISPC);
-   dsi-regm_dsi_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_REGM_DSI);
+   dsi-regm_hsdiv_max =
+   dss_feat_get_param_max(FEAT_PARAM_DSIPLL_REGM_HSDIV);
dsi-fint_min = dss_feat_get_param_min(FEAT_PARAM_DSIPLL_FINT);
dsi-fint_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_FINT);
dsi-lpdiv_max = dss_feat_get_param_max(FEAT_PARAM_DSIPLL_LPDIV);
diff --git a/drivers/video/fbdev/omap2/dss/dss_features.c 
b/drivers/video/fbdev/omap2/dss/dss_features.c
index 15088df7bd16..7e7fcf450342 100644
--- a/drivers/video/fbdev/omap2/dss/dss_features.c
+++ b/drivers/video/fbdev/omap2/dss/dss_features.c
@@ -439,8 +439,7 @@ static const struct dss_param_range omap2_dss_param_range[] 
= {
[FEAT_PARAM_DSS_PCD]= { 2, 255 },
[FEAT_PARAM_DSIPLL_REGN]= { 0, 0 },
[FEAT_PARAM_DSIPLL_REGM]= { 0, 0 },
-   [FEAT_PARAM_DSIPLL_REGM_DISPC]  = { 0, 0 },
-   [FEAT_PARAM_DSIPLL_REGM_DSI]= { 0, 0 },
+   [FEAT_PARAM_DSIPLL_REGM_HSDIV]  = { 0, 0 },
[FEAT_PARAM_DSIPLL_FINT]= { 0, 0 },
[FEAT_PARAM_DSIPLL_LPDIV]   = { 0, 0 },
[FEAT_PARAM_DOWNSCALE]  = { 1, 2 },
@@ -456,8 +455,7 @@ static const struct dss_param_range omap3_dss_param_range[] 
= {
[FEAT_PARAM_DSS_PCD]= { 1, 255 },
[FEAT_PARAM_DSIPLL_REGN]= { 0, (1  7) - 1 },
[FEAT_PARAM_DSIPLL_REGM]= { 0, (1  11) - 1 },
-   [FEAT_PARAM_DSIPLL_REGM_DISPC]  = { 0, (1  4) - 1 },
-   [FEAT_PARAM_DSIPLL_REGM_DSI]= { 0, (1  4) - 1 },
+   [FEAT_PARAM_DSIPLL_REGM_HSDIV]  = { 0, (1  4) - 1 },
[FEAT_PARAM_DSIPLL_FINT]= { 75, 210 },
[FEAT_PARAM_DSIPLL_LPDIV]   = { 1, (1  13) - 1},
[FEAT_PARAM_DSI_FCK]= { 0, 17300 },
@@ -477,8 +475,7 @@ static const struct dss_param_range omap4_dss_param_range[] 
= {
[FEAT_PARAM_DSS_PCD]= { 1, 255 },
[FEAT_PARAM_DSIPLL_REGN]= { 0, (1  8) - 1 },
[FEAT_PARAM_DSIPLL_REGM]= { 0, (1  12) - 1 },
-   [FEAT_PARAM_DSIPLL_REGM_DISPC]  = { 0, (1  5) - 1 },
-   [FEAT_PARAM_DSIPLL_REGM_DSI]= { 0, (1  5) - 1 },
+   [FEAT_PARAM_DSIPLL_REGM_HSDIV]  = { 0, (1  5) - 1 },
[FEAT_PARAM_DSIPLL_FINT]= { 50, 250 },
[FEAT_PARAM_DSIPLL_LPDIV]   = { 0, (1  13) - 1 },
[FEAT_PARAM_DSI_FCK]= { 0, 17000 },
@@ -491,8 +488,7 @@ static 

[PATCH 13/22] OMAPDSS: DSI: use common DSS PLL support

2014-11-12 Thread Tomi Valkeinen
Now that we have the common DSS PLL support, change DSI to use it. This
results in quite a lot of changes, but almost all of them are trivial
name changes.

The functions to calculate and program the PLL settings can be removed
from dsi.c, as the common PLL API contains the same functionality.

We also need to create struct dss_pll_hw entries for PLL hardware
features for different OMAP platforms, instead of using the
dss_features.c as the old code does.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/dispc.c |  20 +-
 drivers/video/fbdev/omap2/dss/dpi.c   |  82 ++---
 drivers/video/fbdev/omap2/dss/dsi.c   | 566 --
 drivers/video/fbdev/omap2/dss/dss.h   |  76 -
 4 files changed, 255 insertions(+), 489 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dispc.c 
b/drivers/video/fbdev/omap2/dss/dispc.c
index 0e9a74bb9fc2..0729c08ac75a 100644
--- a/drivers/video/fbdev/omap2/dss/dispc.c
+++ b/drivers/video/fbdev/omap2/dss/dispc.c
@@ -3028,7 +3028,7 @@ static void dispc_mgr_get_lcd_divisor(enum omap_channel 
channel, int *lck_div,
 
 unsigned long dispc_fclk_rate(void)
 {
-   struct platform_device *dsidev;
+   struct dss_pll *pll;
unsigned long r = 0;
 
switch (dss_get_dispc_clk_source()) {
@@ -3036,12 +3036,12 @@ unsigned long dispc_fclk_rate(void)
r = dss_get_dispc_clk_rate();
break;
case OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC:
-   dsidev = dsi_get_dsidev_from_id(0);
-   r = dsi_get_pll_hsdiv_dispc_rate(dsidev);
+   pll = dss_pll_find(dsi0);
+   r = pll-cinfo.clkout[0];
break;
case OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC:
-   dsidev = dsi_get_dsidev_from_id(1);
-   r = dsi_get_pll_hsdiv_dispc_rate(dsidev);
+   pll = dss_pll_find(dsi1);
+   r = pll-cinfo.clkout[0];
break;
default:
BUG();
@@ -3053,7 +3053,7 @@ unsigned long dispc_fclk_rate(void)
 
 unsigned long dispc_mgr_lclk_rate(enum omap_channel channel)
 {
-   struct platform_device *dsidev;
+   struct dss_pll *pll;
int lcd;
unsigned long r;
u32 l;
@@ -3068,12 +3068,12 @@ unsigned long dispc_mgr_lclk_rate(enum omap_channel 
channel)
r = dss_get_dispc_clk_rate();
break;
case OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC:
-   dsidev = dsi_get_dsidev_from_id(0);
-   r = dsi_get_pll_hsdiv_dispc_rate(dsidev);
+   pll = dss_pll_find(dsi0);
+   r = pll-cinfo.clkout[0];
break;
case OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC:
-   dsidev = dsi_get_dsidev_from_id(1);
-   r = dsi_get_pll_hsdiv_dispc_rate(dsidev);
+   pll = dss_pll_find(dsi1);
+   r = pll-cinfo.clkout[0];
break;
default:
BUG();
diff --git a/drivers/video/fbdev/omap2/dss/dpi.c 
b/drivers/video/fbdev/omap2/dss/dpi.c
index 81dd5e61e75e..2edf5caa002f 100644
--- a/drivers/video/fbdev/omap2/dss/dpi.c
+++ b/drivers/video/fbdev/omap2/dss/dpi.c
@@ -31,6 +31,7 @@
 #include linux/regulator/consumer.h
 #include linux/string.h
 #include linux/of.h
+#include linux/clk.h
 
 #include video/omapdss.h
 
@@ -43,7 +44,7 @@ struct dpi_data {
struct platform_device *pdev;
 
struct regulator *vdds_dsi_reg;
-   struct platform_device *dsidev;
+   struct dss_pll *pll;
 
struct mutex lock;
 
@@ -67,7 +68,7 @@ static struct dpi_data *dpi_get_data_from_pdev(struct 
platform_device *pdev)
return dev_get_drvdata(pdev-dev);
 }
 
-static struct platform_device *dpi_get_dsidev(enum omap_channel channel)
+static struct dss_pll *dpi_get_pll(enum omap_channel channel)
 {
/*
 * XXX we can't currently use DSI PLL for DPI with OMAP3, as the DSI PLL
@@ -88,9 +89,9 @@ static struct platform_device *dpi_get_dsidev(enum 
omap_channel channel)
case OMAPDSS_VER_OMAP4:
switch (channel) {
case OMAP_DSS_CHANNEL_LCD:
-   return dsi_get_dsidev_from_id(0);
+   return dss_pll_find(dsi0);
case OMAP_DSS_CHANNEL_LCD2:
-   return dsi_get_dsidev_from_id(1);
+   return dss_pll_find(dsi1);
default:
return NULL;
}
@@ -98,9 +99,9 @@ static struct platform_device *dpi_get_dsidev(enum 
omap_channel channel)
case OMAPDSS_VER_OMAP5:
switch (channel) {
case OMAP_DSS_CHANNEL_LCD:
-   return dsi_get_dsidev_from_id(0);
+   return dss_pll_find(dsi0);
case OMAP_DSS_CHANNEL_LCD3:
-   

[PATCH 04/22] OMAPDSS: DSI: separate LP clock info from dsi_clock_info

2014-11-12 Thread Tomi Valkeinen
struct dsi_clock_info represents the clocks handled by the DSI, mostly
PLL related clocks. In an effort to create common PLL code, we need to
remove all the non-PLL items from dsi_clock_info.

This patch removes LP clock related fields from dsi_clock_info, and
creates a new struct dsi_lp_clock_info for holding clock info for the LP
clock.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/dsi.c | 30 +++---
 drivers/video/fbdev/omap2/dss/dss.h |  2 --
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dsi.c 
b/drivers/video/fbdev/omap2/dss/dsi.c
index 0083f6500949..1c5a15581669 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -287,6 +287,11 @@ struct dsi_clk_calc_ctx {
struct omap_dss_dsi_videomode_timings dsi_vm;
 };
 
+struct dsi_lp_clock_info {
+   unsigned long lp_clk;
+   u16 lp_clk_div;
+};
+
 struct dsi_data {
struct platform_device *pdev;
void __iomem *proto_base;
@@ -307,6 +312,9 @@ struct dsi_data {
 
struct dsi_clock_info current_cinfo;
 
+   struct dsi_lp_clock_info user_lp_cinfo;
+   struct dsi_lp_clock_info current_lp_cinfo;
+
bool vdds_dsi_enabled;
struct regulator *vdds_dsi_reg;
 
@@ -1293,10 +1301,10 @@ static unsigned long dsi_fclk_rate(struct 
platform_device *dsidev)
return r;
 }
 
-static int dsi_lp_clock_calc(struct dsi_clock_info *cinfo,
-   unsigned long lp_clk_min, unsigned long lp_clk_max)
+static int dsi_lp_clock_calc(unsigned long dsi_fclk,
+   unsigned long lp_clk_min, unsigned long lp_clk_max,
+   struct dsi_lp_clock_info *lp_cinfo)
 {
-   unsigned long dsi_fclk = cinfo-dsi_pll_hsdiv_dsi_clk;
unsigned lp_clk_div;
unsigned long lp_clk;
 
@@ -1306,8 +1314,8 @@ static int dsi_lp_clock_calc(struct dsi_clock_info *cinfo,
if (lp_clk  lp_clk_min || lp_clk  lp_clk_max)
return -EINVAL;
 
-   cinfo-lp_clk_div = lp_clk_div;
-   cinfo-lp_clk = lp_clk;
+   lp_cinfo-lp_clk_div = lp_clk_div;
+   lp_cinfo-lp_clk = lp_clk;
 
return 0;
 }
@@ -1319,7 +1327,7 @@ static int dsi_set_lp_clk_divisor(struct platform_device 
*dsidev)
unsigned lp_clk_div;
unsigned long lp_clk;
 
-   lp_clk_div = dsi-user_dsi_cinfo.lp_clk_div;
+   lp_clk_div = dsi-user_lp_cinfo.lp_clk_div;
 
if (lp_clk_div == 0 || lp_clk_div  dsi-lpdiv_max)
return -EINVAL;
@@ -1329,8 +1337,8 @@ static int dsi_set_lp_clk_divisor(struct platform_device 
*dsidev)
lp_clk = dsi_fclk / 2 / lp_clk_div;
 
DSSDBG(LP_CLK_DIV %u, LP_CLK %lu\n, lp_clk_div, lp_clk);
-   dsi-current_cinfo.lp_clk = lp_clk;
-   dsi-current_cinfo.lp_clk_div = lp_clk_div;
+   dsi-current_lp_cinfo.lp_clk = lp_clk;
+   dsi-current_lp_cinfo.lp_clk_div = lp_clk_div;
 
/* LP_CLK_DIVISOR */
REG_FLD_MOD(dsidev, DSI_CLK_CTRL, lp_clk_div, 12, 0);
@@ -1801,7 +1809,7 @@ static void dsi_dump_dsidev_clocks(struct platform_device 
*dsidev,
 
seq_printf(s,   TxByteClkHS\t%lu\n, dsi_get_txbyteclkhs(dsidev));
 
-   seq_printf(s,   LP_CLK\t\t%lu\n, cinfo-lp_clk);
+   seq_printf(s,   LP_CLK\t\t%lu\n, dsi-current_lp_cinfo.lp_clk);
 
dsi_runtime_put(dsidev);
 }
@@ -5110,8 +5118,8 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
 
dsi_pll_calc_dsi_fck(ctx.dsi_cinfo);
 
-   r = dsi_lp_clock_calc(ctx.dsi_cinfo, config-lp_clk_min,
-   config-lp_clk_max);
+   r = dsi_lp_clock_calc(ctx.dsi_cinfo.dsi_pll_hsdiv_dsi_clk,
+   config-lp_clk_min, config-lp_clk_max, dsi-user_lp_cinfo);
if (r) {
DSSERR(failed to find suitable DSI LP clock settings\n);
goto err;
diff --git a/drivers/video/fbdev/omap2/dss/dss.h 
b/drivers/video/fbdev/omap2/dss/dss.h
index 2defcaedbef5..712592d2e5f7 100644
--- a/drivers/video/fbdev/omap2/dss/dss.h
+++ b/drivers/video/fbdev/omap2/dss/dss.h
@@ -119,7 +119,6 @@ struct dsi_clock_info {
 * OMAP4: PLLx_CLK1 */
unsigned long dsi_pll_hsdiv_dsi_clk;/* OMAP3: DSI2_PLL_CLK
 * OMAP4: PLLx_CLK2 */
-   unsigned long lp_clk;
 
/* dividers */
u16 regn;
@@ -128,7 +127,6 @@ struct dsi_clock_info {
 * OMAP4: REGM4 */
u16 regm_dsi;   /* OMAP3: REGM4
 * OMAP4: REGM5 */
-   u16 lp_clk_div;
 };
 
 struct dss_lcd_mgr_config {
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/22] OMAPDSS: DSI: remove unused hsdiv wait funcs

2014-11-12 Thread Tomi Valkeinen
With the previous patch OMAPDSS: DSI: wait for hsdiv clocks when
enabling PLL,  dsi_wait_pll_hsdiv_dispc_active and
dsi_wait_pll_hsdiv_dsi_active are no longer needed, so they and the
callers can be removed.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/dsi.c | 15 ---
 drivers/video/fbdev/omap2/dss/dss.c | 15 ---
 drivers/video/fbdev/omap2/dss/dss.h |  8 
 3 files changed, 38 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dsi.c 
b/drivers/video/fbdev/omap2/dss/dsi.c
index fe8196b17a5e..b7acdcd76f73 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -5255,21 +5255,6 @@ static void dsi_release_vc(struct omap_dss_device 
*dssdev, int channel)
}
 }
 
-void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev)
-{
-   if (wait_for_bit_change(dsidev, DSI_PLL_STATUS, 7, 1) != 1)
-   DSSERR(%s (%s) not active\n,
-   
dss_get_generic_clk_source_name(OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC),
-   
dss_feat_get_clk_source_name(OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC));
-}
-
-void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev)
-{
-   if (wait_for_bit_change(dsidev, DSI_PLL_STATUS, 8, 1) != 1)
-   DSSERR(%s (%s) not active\n,
-   
dss_get_generic_clk_source_name(OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI),
-   
dss_feat_get_clk_source_name(OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI));
-}
 
 static void dsi_calc_clock_param_ranges(struct platform_device *dsidev)
 {
diff --git a/drivers/video/fbdev/omap2/dss/dss.c 
b/drivers/video/fbdev/omap2/dss/dss.c
index 5f6942c5df1c..702c495083ed 100644
--- a/drivers/video/fbdev/omap2/dss/dss.c
+++ b/drivers/video/fbdev/omap2/dss/dss.c
@@ -296,7 +296,6 @@ static void dss_dump_regs(struct seq_file *s)
 
 static void dss_select_dispc_clk_source(enum omap_dss_clk_source clk_src)
 {
-   struct platform_device *dsidev;
int b;
u8 start, end;
 
@@ -306,13 +305,9 @@ static void dss_select_dispc_clk_source(enum 
omap_dss_clk_source clk_src)
break;
case OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC:
b = 1;
-   dsidev = dsi_get_dsidev_from_id(0);
-   dsi_wait_pll_hsdiv_dispc_active(dsidev);
break;
case OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC:
b = 2;
-   dsidev = dsi_get_dsidev_from_id(1);
-   dsi_wait_pll_hsdiv_dispc_active(dsidev);
break;
default:
BUG();
@@ -329,7 +324,6 @@ static void dss_select_dispc_clk_source(enum 
omap_dss_clk_source clk_src)
 void dss_select_dsi_clk_source(int dsi_module,
enum omap_dss_clk_source clk_src)
 {
-   struct platform_device *dsidev;
int b, pos;
 
switch (clk_src) {
@@ -339,14 +333,10 @@ void dss_select_dsi_clk_source(int dsi_module,
case OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI:
BUG_ON(dsi_module != 0);
b = 1;
-   dsidev = dsi_get_dsidev_from_id(0);
-   dsi_wait_pll_hsdiv_dsi_active(dsidev);
break;
case OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI:
BUG_ON(dsi_module != 1);
b = 1;
-   dsidev = dsi_get_dsidev_from_id(1);
-   dsi_wait_pll_hsdiv_dsi_active(dsidev);
break;
default:
BUG();
@@ -362,7 +352,6 @@ void dss_select_dsi_clk_source(int dsi_module,
 void dss_select_lcd_clk_source(enum omap_channel channel,
enum omap_dss_clk_source clk_src)
 {
-   struct platform_device *dsidev;
int b, ix, pos;
 
if (!dss_has_feature(FEAT_LCD_CLK_SRC)) {
@@ -377,15 +366,11 @@ void dss_select_lcd_clk_source(enum omap_channel channel,
case OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC:
BUG_ON(channel != OMAP_DSS_CHANNEL_LCD);
b = 1;
-   dsidev = dsi_get_dsidev_from_id(0);
-   dsi_wait_pll_hsdiv_dispc_active(dsidev);
break;
case OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC:
BUG_ON(channel != OMAP_DSS_CHANNEL_LCD2 
   channel != OMAP_DSS_CHANNEL_LCD3);
b = 1;
-   dsidev = dsi_get_dsidev_from_id(1);
-   dsi_wait_pll_hsdiv_dispc_active(dsidev);
break;
default:
BUG();
diff --git a/drivers/video/fbdev/omap2/dss/dss.h 
b/drivers/video/fbdev/omap2/dss/dss.h
index b70d7dfbfcfb..4617b4d9f78d 100644
--- a/drivers/video/fbdev/omap2/dss/dss.h
+++ b/drivers/video/fbdev/omap2/dss/dss.h
@@ -299,8 +299,6 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev,
 int dsi_pll_init(struct platform_device *dsidev, bool enable_hsclk,
bool enable_hsdiv);
 void dsi_pll_uninit(struct platform_device *dsidev, bool disconnect_lanes);
-void 

[PATCH 09/22] OMAPDSS: DSI: turn hsdivs fields to arrays

2014-11-12 Thread Tomi Valkeinen
We are creating a common DSS PLL code, so having fixed DSI specific
hsdiv fields in the clock information is not ok.

This patch changes the hsdiv fields to arrays, so that we can use all
the 4 possible hsdiv outputs (DSI only usees 2), and we have generic way
to access the hsdivs.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/dpi.c | 10 +++---
 drivers/video/fbdev/omap2/dss/dsi.c | 64 -
 drivers/video/fbdev/omap2/dss/dss.h | 10 ++
 3 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dpi.c 
b/drivers/video/fbdev/omap2/dss/dpi.c
index f6a14c80bd0b..0b9af5d3e650 100644
--- a/drivers/video/fbdev/omap2/dss/dpi.c
+++ b/drivers/video/fbdev/omap2/dss/dpi.c
@@ -37,6 +37,8 @@
 #include dss.h
 #include dss_features.h
 
+#define HSDIV_DISPC0
+
 struct dpi_data {
struct platform_device *pdev;
 
@@ -178,8 +180,8 @@ static bool dpi_calc_hsdiv_cb(int regm_dispc, unsigned long 
dispc,
if (regm_dispc  1  regm_dispc % 2 != 0  ctx-pck_min = 1)
return false;
 
-   ctx-dsi_cinfo.regm_dispc = regm_dispc;
-   ctx-dsi_cinfo.dsi_pll_hsdiv_dispc_clk = dispc;
+   ctx-dsi_cinfo.regm_hsdiv[HSDIV_DISPC] = regm_dispc;
+   ctx-dsi_cinfo.clkout[HSDIV_DISPC] = dispc;
 
return dispc_div_calc(dispc, ctx-pck_min, ctx-pck_max,
dpi_calc_dispc_cb, ctx);
@@ -284,7 +286,7 @@ static int dpi_set_dsi_clk(struct dpi_data *dpi, enum 
omap_channel channel,
 
dpi-mgr_config.clock_info = ctx.dispc_cinfo;
 
-   *fck = ctx.dsi_cinfo.dsi_pll_hsdiv_dispc_clk;
+   *fck = ctx.dsi_cinfo.clkout[HSDIV_DISPC];
*lck_div = ctx.dispc_cinfo.lck_div;
*pck_div = ctx.dispc_cinfo.pck_div;
 
@@ -516,7 +518,7 @@ static int dpi_check_timings(struct omap_dss_device *dssdev,
if (!ok)
return -EINVAL;
 
-   fck = ctx.dsi_cinfo.dsi_pll_hsdiv_dispc_clk;
+   fck = ctx.dsi_cinfo.clkout[HSDIV_DISPC];
} else {
ok = dpi_dss_clk_calc(timings-pixelclock, ctx);
if (!ok)
diff --git a/drivers/video/fbdev/omap2/dss/dsi.c 
b/drivers/video/fbdev/omap2/dss/dsi.c
index 5996ffd6dff1..406af309f8ff 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -219,6 +219,10 @@ static void dsi_display_uninit_dispc(struct 
platform_device *dsidev,
 
 static int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel);
 
+/* DSI PLL HSDIV indices */
+#define HSDIV_DISPC0
+#define HSDIV_DSI  1
+
 #define DSI_MAX_NR_ISRS2
 #define DSI_MAX_NR_LANES   5
 
@@ -1261,14 +1265,14 @@ unsigned long dsi_get_pll_hsdiv_dispc_rate(struct 
platform_device *dsidev)
 {
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
 
-   return dsi-current_cinfo.dsi_pll_hsdiv_dispc_clk;
+   return dsi-current_cinfo.clkout[HSDIV_DISPC];
 }
 
 static unsigned long dsi_get_pll_hsdiv_dsi_rate(struct platform_device *dsidev)
 {
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
 
-   return dsi-current_cinfo.dsi_pll_hsdiv_dsi_clk;
+   return dsi-current_cinfo.clkout[HSDIV_DSI];
 }
 
 static unsigned long dsi_get_txbyteclkhs(struct platform_device *dsidev)
@@ -1473,10 +1477,10 @@ static int dsi_calc_clock_rates(struct platform_device 
*dsidev,
if (cinfo-regm == 0 || cinfo-regm  dsi-regm_max)
return -EINVAL;
 
-   if (cinfo-regm_dispc  dsi-regm_dispc_max)
+   if (cinfo-regm_hsdiv[HSDIV_DISPC]  dsi-regm_dispc_max)
return -EINVAL;
 
-   if (cinfo-regm_dsi  dsi-regm_dsi_max)
+   if (cinfo-regm_hsdiv[HSDIV_DSI]  dsi-regm_dsi_max)
return -EINVAL;
 
cinfo-fint = clk_get_rate(dsi-sys_clk) / cinfo-regn;
@@ -1489,17 +1493,17 @@ static int dsi_calc_clock_rates(struct platform_device 
*dsidev,
if (cinfo-clkdco  1800 * 1000 * 1000)
return -EINVAL;
 
-   if (cinfo-regm_dispc  0)
-   cinfo-dsi_pll_hsdiv_dispc_clk =
-   cinfo-clkdco / cinfo-regm_dispc;
+   if (cinfo-regm_hsdiv[HSDIV_DISPC])
+   cinfo-clkout[HSDIV_DISPC] =
+   cinfo-clkdco / cinfo-regm_hsdiv[HSDIV_DISPC];
else
-   cinfo-dsi_pll_hsdiv_dispc_clk = 0;
+   cinfo-clkout[HSDIV_DISPC] = 0;
 
-   if (cinfo-regm_dsi  0)
-   cinfo-dsi_pll_hsdiv_dsi_clk =
-   cinfo-clkdco / cinfo-regm_dsi;
+   if (cinfo-regm_hsdiv[HSDIV_DSI])
+   cinfo-clkout[HSDIV_DSI] =
+   cinfo-clkdco / cinfo-regm_hsdiv[HSDIV_DSI];
else
-   cinfo-dsi_pll_hsdiv_dsi_clk = 0;
+   cinfo-clkout[HSDIV_DSI] = 0;
 
return 0;
 }
@@ -1510,8 +1514,8 @@ static void dsi_pll_calc_dsi_fck(struct dsi_clock_info 
*cinfo)
 
max_dsi_fck = 

[PATCH 00/22] OMAPDSS: Create a DSS PLL library

2014-11-12 Thread Tomi Valkeinen
Hi,

OMAP DSS hardware contains two different PLLs at the moment: DSI and HDMI PLLs.
With the DRA7x we will have a new PLL, video PLL. The code for DSI and HDMI
PLLs are totally separate, with no shared code.

This series cleans up the PLL code for DSI and HDMI, and creates a common
framework for DSS PLLs, which will also be used by the video PLLs.

The first half of the patches clean up and rework DSI PLL code to make it more
suitable with the common PLL code. We then add the common PLL library, and make
DSI use that.

The second half does the same for HDMI.

There should be no changes visible to the user, although the exact settings for
the PLLs may be slightly different from what we currently end up programming in
to the registers.

Tested on OMAP3/4/5 boards.

This series is based on Archit's OMAPDSS: Support multiple DPI instances
series. I have pushed these to:

git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git work/pll-library

 Tomi

Tomi Valkeinen (22):
  OMAPDSS: DSI: wait for hsdiv clocks when enabling PLL
  OMAPDSS: DSI: remove unused hsdiv wait funcs
  OMAPDSS: DSI: always power on hsclk  hsdiv
  OMAPDSS: DSI: separate LP clock info from dsi_clock_info
  OMAPDSS: DSI: remove clkin from dsi_clock_info
  OMAPDSS: DSI: remove pll_locked field
  OMAPDSS: DSI: use struct copy instead of individual field copy
  OMAPDSS: DSI: rename clkin4ddr to clkdco
  OMAPDSS: DSI: turn hsdivs fields to arrays
  OMAPDSS: DSI: features: combine dsi  dispc hsdivs
  OMAPDSS: DSI: dsi_runtime_get/put in pll_init
  OMAPDSS: Add common PLL code
  OMAPDSS: DSI: use common DSS PLL support
  OMAPDSS: HDMI: fix setting REFSEL
  OMAPDSS: HDMI5: disable interlace modes
  OMAPDSS: HDMI: rewrite HDMI PLL calculation code
  OMAPDSS: HDMI: Remove HDMI PLL reset
  OMAPDSS: HDMI: store WP pointer to hdmi_pll_data
  OMAPDSS: HDMI: split PLL enable  config
  OMAPDSS: HDMI: remove extra poweroff
  OMAPDSS: HDMI: use common DSS PLL support
  OMAPDSS: features: remove unused DSI PLL features

 drivers/video/fbdev/omap2/dss/Makefile   |   2 +-
 drivers/video/fbdev/omap2/dss/dispc.c|  20 +-
 drivers/video/fbdev/omap2/dss/dpi.c  | 106 ++---
 drivers/video/fbdev/omap2/dss/dsi.c  | 659 ++-
 drivers/video/fbdev/omap2/dss/dss.c  |  15 -
 drivers/video/fbdev/omap2/dss/dss.h  | 193 
 drivers/video/fbdev/omap2/dss/dss_features.c |  42 --
 drivers/video/fbdev/omap2/dss/dss_features.h |  12 -
 drivers/video/fbdev/omap2/dss/hdmi.h |  34 +-
 drivers/video/fbdev/omap2/dss/hdmi4.c|  68 ++-
 drivers/video/fbdev/omap2/dss/hdmi5.c|  73 ++-
 drivers/video/fbdev/omap2/dss/hdmi_phy.c |  31 +-
 drivers/video/fbdev/omap2/dss/hdmi_pll.c | 313 ++---
 drivers/video/fbdev/omap2/dss/pll.c  | 378 +++
 14 files changed, 979 insertions(+), 967 deletions(-)
 create mode 100644 drivers/video/fbdev/omap2/dss/pll.c

-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/22] OMAPDSS: DSI: use struct copy instead of individual field copy

2014-11-12 Thread Tomi Valkeinen
Now that dsi_clock_info only contains information about the PLL, we can
just copy the whole struct when storing the clock information, instead
of copying individual fields.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/dsi.c | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dsi.c 
b/drivers/video/fbdev/omap2/dss/dsi.c
index 37517e407f37..b0a3c9ed1341 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -1540,17 +1540,7 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev,
 
DSSDBG(DSI PLL clock config starts);
 
-   dsi-current_cinfo.fint = cinfo-fint;
-   dsi-current_cinfo.clkin4ddr = cinfo-clkin4ddr;
-   dsi-current_cinfo.dsi_pll_hsdiv_dispc_clk =
-   cinfo-dsi_pll_hsdiv_dispc_clk;
-   dsi-current_cinfo.dsi_pll_hsdiv_dsi_clk =
-   cinfo-dsi_pll_hsdiv_dsi_clk;
-
-   dsi-current_cinfo.regn = cinfo-regn;
-   dsi-current_cinfo.regm = cinfo-regm;
-   dsi-current_cinfo.regm_dispc = cinfo-regm_dispc;
-   dsi-current_cinfo.regm_dsi = cinfo-regm_dsi;
+   dsi-current_cinfo = *cinfo;
 
DSSDBG(DSI Fint %ld\n, cinfo-fint);
 
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/22] OMAPDSS: DSI: always power on hsclk hsdiv

2014-11-12 Thread Tomi Valkeinen
The DSS PLL has support to power on the PLL's highspeed clock output
and HSDIV output separately. In practice both need to powered on, as in
most OMAP's that's the only working configuration. We already do that in
dsi_pll_init(), by overriding the passed arguments so that both are
always powered.

Simplify the code by removing the support for choosing which outputs to
power on.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/dpi.c |  4 ++--
 drivers/video/fbdev/omap2/dss/dsi.c | 23 +++
 drivers/video/fbdev/omap2/dss/dss.h |  6 ++
 3 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dpi.c 
b/drivers/video/fbdev/omap2/dss/dpi.c
index ebc294f8dfdb..aa095c4927ec 100644
--- a/drivers/video/fbdev/omap2/dss/dpi.c
+++ b/drivers/video/fbdev/omap2/dss/dpi.c
@@ -405,7 +405,7 @@ static int dpi_display_enable(struct omap_dss_device 
*dssdev)
if (r)
goto err_get_dsi;
 
-   r = dsi_pll_init(dpi-dsidev, 0, 1);
+   r = dsi_pll_init(dpi-dsidev);
if (r)
goto err_dsi_pll_init;
}
@@ -557,7 +557,7 @@ static int dpi_verify_dsi_pll(struct platform_device 
*dsidev)
if (r)
return r;
 
-   r = dsi_pll_init(dsidev, 0, 1);
+   r = dsi_pll_init(dsidev);
if (r) {
dsi_runtime_put(dsidev);
return r;
diff --git a/drivers/video/fbdev/omap2/dss/dsi.c 
b/drivers/video/fbdev/omap2/dss/dsi.c
index b7acdcd76f73..0083f6500949 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -1672,21 +1672,13 @@ err:
return r;
 }
 
-int dsi_pll_init(struct platform_device *dsidev, bool enable_hsclk,
-   bool enable_hsdiv)
+int dsi_pll_init(struct platform_device *dsidev)
 {
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
int r = 0;
-   enum dsi_pll_power_state pwstate;
 
DSSDBG(PLL init\n);
 
-   /*
-* It seems that on many OMAPs we need to enable both to have a
-* functional HSDivider.
-*/
-   enable_hsclk = enable_hsdiv = true;
-
r = dsi_regulator_init(dsidev);
if (r)
return r;
@@ -1718,16 +1710,7 @@ int dsi_pll_init(struct platform_device *dsidev, bool 
enable_hsclk,
 * fill the whole display. No idea about this */
dispc_pck_free_enable(0);
 
-   if (enable_hsclk  enable_hsdiv)
-   pwstate = DSI_PLL_POWER_ON_ALL;
-   else if (enable_hsclk)
-   pwstate = DSI_PLL_POWER_ON_HSCLK;
-   else if (enable_hsdiv)
-   pwstate = DSI_PLL_POWER_ON_DIV;
-   else
-   pwstate = DSI_PLL_POWER_OFF;
-
-   r = dsi_pll_power(dsidev, pwstate);
+   r = dsi_pll_power(dsidev, DSI_PLL_POWER_ON_ALL);
 
if (r)
goto err1;
@@ -4487,7 +4470,7 @@ static int dsi_display_init_dsi(struct platform_device 
*dsidev)
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
int r;
 
-   r = dsi_pll_init(dsidev, true, true);
+   r = dsi_pll_init(dsidev);
if (r)
goto err0;
 
diff --git a/drivers/video/fbdev/omap2/dss/dss.h 
b/drivers/video/fbdev/omap2/dss/dss.h
index 4617b4d9f78d..2defcaedbef5 100644
--- a/drivers/video/fbdev/omap2/dss/dss.h
+++ b/drivers/video/fbdev/omap2/dss/dss.h
@@ -296,8 +296,7 @@ bool dsi_pll_calc(struct platform_device *dsidev, unsigned 
long clkin,
 unsigned long dsi_get_pll_hsdiv_dispc_rate(struct platform_device *dsidev);
 int dsi_pll_set_clock_div(struct platform_device *dsidev,
struct dsi_clock_info *cinfo);
-int dsi_pll_init(struct platform_device *dsidev, bool enable_hsclk,
-   bool enable_hsdiv);
+int dsi_pll_init(struct platform_device *dsidev);
 void dsi_pll_uninit(struct platform_device *dsidev, bool disconnect_lanes);
 struct platform_device *dsi_get_dsidev_from_id(int module);
 #else
@@ -324,8 +323,7 @@ static inline int dsi_pll_set_clock_div(struct 
platform_device *dsidev,
WARN(%s: DSI not compiled in\n, __func__);
return -ENODEV;
 }
-static inline int dsi_pll_init(struct platform_device *dsidev,
-   bool enable_hsclk, bool enable_hsdiv)
+static inline int dsi_pll_init(struct platform_device *dsidev)
 {
WARN(%s: DSI not compiled in\n, __func__);
return -ENODEV;
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/22] OMAPDSS: DSI: remove clkin from dsi_clock_info

2014-11-12 Thread Tomi Valkeinen
struct dsi_clock_info contains clkin field, which is the rate of the
PLL's input clock. This field is not needed, as it can be easily
retrieved by using the clk_get_rate().

This patch removes the clkin field.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/dpi.c |  1 -
 drivers/video/fbdev/omap2/dss/dsi.c | 13 -
 drivers/video/fbdev/omap2/dss/dss.h |  1 -
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dpi.c 
b/drivers/video/fbdev/omap2/dss/dpi.c
index aa095c4927ec..91f18ab72007 100644
--- a/drivers/video/fbdev/omap2/dss/dpi.c
+++ b/drivers/video/fbdev/omap2/dss/dpi.c
@@ -223,7 +223,6 @@ static bool dpi_dsi_clk_calc(struct dpi_data *dpi, unsigned 
long pck,
ctx-dsidev = dpi-dsidev;
ctx-pck_min = pck - 1000;
ctx-pck_max = pck + 1000;
-   ctx-dsi_cinfo.clkin = clkin;
 
pll_min = 0;
pll_max = 0;
diff --git a/drivers/video/fbdev/omap2/dss/dsi.c 
b/drivers/video/fbdev/omap2/dss/dsi.c
index 1c5a15581669..deab4135ddc0 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -1486,8 +1486,7 @@ static int dsi_calc_clock_rates(struct platform_device 
*dsidev,
if (cinfo-regm_dsi  dsi-regm_dsi_max)
return -EINVAL;
 
-   cinfo-clkin = clk_get_rate(dsi-sys_clk);
-   cinfo-fint = cinfo-clkin / cinfo-regn;
+   cinfo-fint = clk_get_rate(dsi-sys_clk) / cinfo-regn;
 
if (cinfo-fint  dsi-fint_max || cinfo-fint  dsi-fint_min)
return -EINVAL;
@@ -1548,7 +1547,6 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev,
 
DSSDBG(DSI PLL clock config starts);
 
-   dsi-current_cinfo.clkin = cinfo-clkin;
dsi-current_cinfo.fint = cinfo-fint;
dsi-current_cinfo.clkin4ddr = cinfo-clkin4ddr;
dsi-current_cinfo.dsi_pll_hsdiv_dispc_clk =
@@ -1563,13 +1561,13 @@ int dsi_pll_set_clock_div(struct platform_device 
*dsidev,
 
DSSDBG(DSI Fint %ld\n, cinfo-fint);
 
-   DSSDBG(clkin rate %ld\n, cinfo-clkin);
+   DSSDBG(clkin rate %ld\n, clk_get_rate(dsi-sys_clk));
 
/* DSIPHY == CLKIN4DDR */
DSSDBG(CLKIN4DDR = 2 * %d / %d * %lu = %lu\n,
cinfo-regm,
cinfo-regn,
-   cinfo-clkin,
+   clk_get_rate(dsi-sys_clk),
cinfo-clkin4ddr);
 
DSSDBG(Data rate on 1 DSI lane %ld Mbps\n,
@@ -1771,7 +1769,7 @@ static void dsi_dump_dsidev_clocks(struct platform_device 
*dsidev,
 
seq_printf(s,   - DSI%d PLL -\n, dsi_module + 1);
 
-   seq_printf(s,   dsi pll clkin\t%lu\n, cinfo-clkin);
+   seq_printf(s,   dsi pll clkin\t%lu\n, clk_get_rate(dsi-sys_clk));
 
seq_printf(s,   Fint\t\t%-16luregn %u\n, cinfo-fint, cinfo-regn);
 
@@ -4780,7 +4778,6 @@ static bool dsi_cm_calc(struct dsi_data *dsi,
ctx-req_pck_min = pck;
ctx-req_pck_nom = pck;
ctx-req_pck_max = pck * 3 / 2;
-   ctx-dsi_cinfo.clkin = clkin;
 
pll_min = max(cfg-hs_clk_min * 4, txbyteclk * 4 * 4);
pll_max = cfg-hs_clk_max * 4;
@@ -5066,8 +5063,6 @@ static bool dsi_vm_calc(struct dsi_data *dsi,
ctx-dsidev = dsi-pdev;
ctx-config = cfg;
 
-   ctx-dsi_cinfo.clkin = clkin;
-
/* these limits should come from the panel driver */
ctx-req_pck_min = t-pixelclock - 1000;
ctx-req_pck_nom = t-pixelclock;
diff --git a/drivers/video/fbdev/omap2/dss/dss.h 
b/drivers/video/fbdev/omap2/dss/dss.h
index 712592d2e5f7..45e255ecff29 100644
--- a/drivers/video/fbdev/omap2/dss/dss.h
+++ b/drivers/video/fbdev/omap2/dss/dss.h
@@ -114,7 +114,6 @@ struct dsi_clock_info {
/* rates that we get with dividers below */
unsigned long fint;
unsigned long clkin4ddr;
-   unsigned long clkin;
unsigned long dsi_pll_hsdiv_dispc_clk;  /* OMAP3: DSI1_PLL_CLK
 * OMAP4: PLLx_CLK1 */
unsigned long dsi_pll_hsdiv_dsi_clk;/* OMAP3: DSI2_PLL_CLK
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/22] OMAPDSS: HDMI5: disable interlace modes

2014-11-12 Thread Tomi Valkeinen
We don't support interlace modes properly on OMAP5+ HDMI, so we need to
reject interlace timings.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi5.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c 
b/drivers/video/fbdev/omap2/dss/hdmi5.c
index 169b764bb9d4..c053d692ec16 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -290,6 +290,10 @@ static int hdmi_display_check_timing(struct 
omap_dss_device *dssdev,
 {
struct omap_dss_device *out = hdmi.output;
 
+   /* TODO: proper interlace support */
+   if (timings-interlace)
+   return -EINVAL;
+
if (!dispc_mgr_timings_ok(out-dispc_channel, timings))
return -EINVAL;
 
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/22] OMAPDSS: Add common PLL code

2014-11-12 Thread Tomi Valkeinen
OMAP DSS currently contains two different PLLs: DSI PLL (Type A PLL) and
HDMI PLL (Type B PLL). When DRA7 support is added, we will also support
Video PLLs (Type A).

The driver currently handles all PLLs totally separately. This patch
adds common DSS PLL code, which

a) lets us have common code for the PLLs
b) lets the users of the PLLs use a common API, instead of DSI API or
   HDMI API.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/Makefile |   2 +-
 drivers/video/fbdev/omap2/dss/dss.h|  88 
 drivers/video/fbdev/omap2/dss/pll.c| 378 +
 3 files changed, 467 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/fbdev/omap2/dss/pll.c

diff --git a/drivers/video/fbdev/omap2/dss/Makefile 
b/drivers/video/fbdev/omap2/dss/Makefile
index 245f933060ee..2ea9d382354c 100644
--- a/drivers/video/fbdev/omap2/dss/Makefile
+++ b/drivers/video/fbdev/omap2/dss/Makefile
@@ -2,7 +2,7 @@ obj-$(CONFIG_OMAP2_DSS_INIT) += omapdss-boot-init.o
 obj-$(CONFIG_OMAP2_DSS) += omapdss.o
 # Core DSS files
 omapdss-y := core.o dss.o dss_features.o dispc.o dispc_coefs.o display.o \
-   output.o dss-of.o
+   output.o dss-of.o pll.o
 # DSS compat layer files
 omapdss-y += manager.o manager-sysfs.o overlay.o overlay-sysfs.o apply.o \
dispc-compat.o display-sysfs.o
diff --git a/drivers/video/fbdev/omap2/dss/dss.h 
b/drivers/video/fbdev/omap2/dss/dss.h
index 4c268985235c..8563e2bc702c 100644
--- a/drivers/video/fbdev/omap2/dss/dss.h
+++ b/drivers/video/fbdev/omap2/dss/dss.h
@@ -100,6 +100,69 @@ enum dss_writeback_channel {
DSS_WB_LCD3_MGR =   7,
 };
 
+struct dss_pll;
+
+#define DSS_PLL_MAX_HSDIVS 4
+
+/*
+ * Type-A PLLs: clkout[]/mX[] refer to hsdiv outputs m4, m5, m6, m7.
+ * Type-B PLLs: clkout[0] refers to m2.
+ */
+struct dss_pll_clock_info {
+   /* rates that we get with dividers below */
+   unsigned long fint;
+   unsigned long clkdco;
+   unsigned long clkout[DSS_PLL_MAX_HSDIVS];
+
+   /* dividers */
+   u16 n;
+   u16 m;
+   u32 mf;
+   u16 mX[DSS_PLL_MAX_HSDIVS];
+   u16 sd;
+};
+
+struct dss_pll_ops {
+   int (*enable)(struct dss_pll *pll);
+   void (*disable)(struct dss_pll *pll);
+   int (*set_config)(struct dss_pll *pll,
+   const struct dss_pll_clock_info *cinfo);
+};
+
+struct dss_pll_hw {
+   unsigned n_max;
+   unsigned m_min;
+   unsigned m_max;
+   unsigned mX_max;
+
+   unsigned long fint_min, fint_max;
+   unsigned long clkdco_min, clkdco_low, clkdco_max;
+
+   u8 n_msb, n_lsb;
+   u8 m_msb, m_lsb;
+   u8 mX_msb[DSS_PLL_MAX_HSDIVS], mX_lsb[DSS_PLL_MAX_HSDIVS];
+
+   bool has_stopmode;
+   bool has_freqsel;
+   bool has_selfreqdco;
+   bool has_refsel;
+};
+
+struct dss_pll {
+   const char *name;
+
+   struct clk *clkin;
+   struct regulator *regulator;
+
+   void __iomem *base;
+
+   const struct dss_pll_hw *hw;
+
+   const struct dss_pll_ops *ops;
+
+   struct dss_pll_clock_info cinfo;
+};
+
 struct dispc_clock_info {
/* rates that we get with dividers below */
unsigned long lck;
@@ -435,4 +498,29 @@ static inline void dss_collect_irq_stats(u32 irqstatus, 
unsigned *irq_arr)
 }
 #endif
 
+/* PLL */
+typedef bool (*dss_pll_calc_func)(int n, int m, unsigned long fint,
+   unsigned long clkdco, void *data);
+typedef bool (*dss_hsdiv_calc_func)(int m_dispc, unsigned long dispc,
+   void *data);
+
+int dss_pll_register(struct dss_pll *pll);
+void dss_pll_unregister(struct dss_pll *pll);
+struct dss_pll *dss_pll_find(const char *name);
+int dss_pll_enable(struct dss_pll *pll);
+void dss_pll_disable(struct dss_pll *pll);
+int dss_pll_set_config(struct dss_pll *pll,
+   const struct dss_pll_clock_info *cinfo);
+
+bool dss_pll_hsdiv_calc(const struct dss_pll *pll, unsigned long clkdco,
+   unsigned long out_min, unsigned long out_max,
+   dss_hsdiv_calc_func func, void *data);
+bool dss_pll_calc(const struct dss_pll *pll, unsigned long clkin,
+   unsigned long pll_min, unsigned long pll_max,
+   dss_pll_calc_func func, void *data);
+int dss_pll_write_config_type_a(struct dss_pll *pll,
+   const struct dss_pll_clock_info *cinfo);
+int dss_pll_write_config_type_b(struct dss_pll *pll,
+   const struct dss_pll_clock_info *cinfo);
+
 #endif
diff --git a/drivers/video/fbdev/omap2/dss/pll.c 
b/drivers/video/fbdev/omap2/dss/pll.c
new file mode 100644
index ..50bc62c5d367
--- /dev/null
+++ b/drivers/video/fbdev/omap2/dss/pll.c
@@ -0,0 +1,378 @@
+/*
+ * Copyright (C) 2014 Texas Instruments Incorporated
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the 

[PATCH 22/22] OMAPDSS: features: remove unused DSI PLL features

2014-11-12 Thread Tomi Valkeinen
Now that the DSS has the common DSS PLL, we no longer use the DSI PLL
feature flags from dss_features.c.

Remove all the unused feature flags.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/dss_features.c | 38 
 drivers/video/fbdev/omap2/dss/dss_features.h | 11 
 2 files changed, 49 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dss_features.c 
b/drivers/video/fbdev/omap2/dss/dss_features.c
index 7e7fcf450342..0e3da809473c 100644
--- a/drivers/video/fbdev/omap2/dss/dss_features.c
+++ b/drivers/video/fbdev/omap2/dss/dss_features.c
@@ -72,10 +72,6 @@ static const struct dss_reg_field omap2_dss_reg_fields[] = {
[FEAT_REG_HORIZONTALACCU]   = { 9, 0 },
[FEAT_REG_VERTICALACCU] = { 25, 16 },
[FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
-   [FEAT_REG_DSIPLL_REGN]  = { 0, 0 },
-   [FEAT_REG_DSIPLL_REGM]  = { 0, 0 },
-   [FEAT_REG_DSIPLL_REGM_DISPC]= { 0, 0 },
-   [FEAT_REG_DSIPLL_REGM_DSI]  = { 0, 0 },
 };
 
 static const struct dss_reg_field omap3_dss_reg_fields[] = {
@@ -87,10 +83,6 @@ static const struct dss_reg_field omap3_dss_reg_fields[] = {
[FEAT_REG_HORIZONTALACCU]   = { 9, 0 },
[FEAT_REG_VERTICALACCU] = { 25, 16 },
[FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
-   [FEAT_REG_DSIPLL_REGN]  = { 7, 1 },
-   [FEAT_REG_DSIPLL_REGM]  = { 18, 8 },
-   [FEAT_REG_DSIPLL_REGM_DISPC]= { 22, 19 },
-   [FEAT_REG_DSIPLL_REGM_DSI]  = { 26, 23 },
 };
 
 static const struct dss_reg_field am43xx_dss_reg_fields[] = {
@@ -113,10 +105,6 @@ static const struct dss_reg_field omap4_dss_reg_fields[] = 
{
[FEAT_REG_HORIZONTALACCU]   = { 10, 0 },
[FEAT_REG_VERTICALACCU] = { 26, 16 },
[FEAT_REG_DISPC_CLK_SWITCH] = { 9, 8 },
-   [FEAT_REG_DSIPLL_REGN]  = { 8, 1 },
-   [FEAT_REG_DSIPLL_REGM]  = { 20, 9 },
-   [FEAT_REG_DSIPLL_REGM_DISPC]= { 25, 21 },
-   [FEAT_REG_DSIPLL_REGM_DSI]  = { 30, 26 },
 };
 
 static const struct dss_reg_field omap5_dss_reg_fields[] = {
@@ -128,10 +116,6 @@ static const struct dss_reg_field omap5_dss_reg_fields[] = 
{
[FEAT_REG_HORIZONTALACCU]   = { 10, 0 },
[FEAT_REG_VERTICALACCU] = { 26, 16 },
[FEAT_REG_DISPC_CLK_SWITCH] = { 9, 7 },
-   [FEAT_REG_DSIPLL_REGN]  = { 8, 1 },
-   [FEAT_REG_DSIPLL_REGM]  = { 20, 9 },
-   [FEAT_REG_DSIPLL_REGM_DISPC]= { 25, 21 },
-   [FEAT_REG_DSIPLL_REGM_DSI]  = { 30, 26 },
 };
 
 static const enum omap_display_type omap2_dss_supported_displays[] = {
@@ -437,11 +421,6 @@ static const char * const omap5_dss_clk_source_names[] = {
 static const struct dss_param_range omap2_dss_param_range[] = {
[FEAT_PARAM_DSS_FCK]= { 0, 13300 },
[FEAT_PARAM_DSS_PCD]= { 2, 255 },
-   [FEAT_PARAM_DSIPLL_REGN]= { 0, 0 },
-   [FEAT_PARAM_DSIPLL_REGM]= { 0, 0 },
-   [FEAT_PARAM_DSIPLL_REGM_HSDIV]  = { 0, 0 },
-   [FEAT_PARAM_DSIPLL_FINT]= { 0, 0 },
-   [FEAT_PARAM_DSIPLL_LPDIV]   = { 0, 0 },
[FEAT_PARAM_DOWNSCALE]  = { 1, 2 },
/*
 * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
@@ -453,10 +432,6 @@ static const struct dss_param_range 
omap2_dss_param_range[] = {
 static const struct dss_param_range omap3_dss_param_range[] = {
[FEAT_PARAM_DSS_FCK]= { 0, 17300 },
[FEAT_PARAM_DSS_PCD]= { 1, 255 },
-   [FEAT_PARAM_DSIPLL_REGN]= { 0, (1  7) - 1 },
-   [FEAT_PARAM_DSIPLL_REGM]= { 0, (1  11) - 1 },
-   [FEAT_PARAM_DSIPLL_REGM_HSDIV]  = { 0, (1  4) - 1 },
-   [FEAT_PARAM_DSIPLL_FINT]= { 75, 210 },
[FEAT_PARAM_DSIPLL_LPDIV]   = { 1, (1  13) - 1},
[FEAT_PARAM_DSI_FCK]= { 0, 17300 },
[FEAT_PARAM_DOWNSCALE]  = { 1, 4 },
@@ -473,10 +448,6 @@ static const struct dss_param_range 
am43xx_dss_param_range[] = {
 static const struct dss_param_range omap4_dss_param_range[] = {
[FEAT_PARAM_DSS_FCK]= { 0, 18600 },
[FEAT_PARAM_DSS_PCD]= { 1, 255 },
-   [FEAT_PARAM_DSIPLL_REGN]= { 0, (1  8) - 1 },
-   [FEAT_PARAM_DSIPLL_REGM]= { 0, (1  12) - 1 },
-   [FEAT_PARAM_DSIPLL_REGM_HSDIV]  = { 0, (1  5) - 1 },
-   [FEAT_PARAM_DSIPLL_FINT]= { 50, 250 },

[PATCH 20/22] OMAPDSS: HDMI: remove extra poweroff

2014-11-12 Thread Tomi Valkeinen
hdmi_pll_enable powers off the PLL as the first thing it does. Right
after that, it enables the PLL powers.

The initial power-off is pointless, so let's remove it.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi_pll.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c 
b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
index c14c3d132513..92d22252f86a 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_pll.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
@@ -171,10 +171,6 @@ int hdmi_pll_enable(struct hdmi_pll_data *pll)
struct hdmi_wp_data *wp = pll-wp;
u16 r = 0;
 
-   r = hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_ALLOFF);
-   if (r)
-   return r;
-
r = hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_BOTHON_ALLCLKS);
if (r)
return r;
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/22] OMAPDSS: HDMI: split PLL enable config

2014-11-12 Thread Tomi Valkeinen
At the moment we have one function, hdmi_pll_enable, which enables the
PLL and writes the PLL configuration to registers.

To make the HDMI PLL ahere to the DSS PLL API, split the hdmi_pll_enable
into two parts: hdmi_pll_enable which enables the PLL HW, and
hdmi_pll_set_config which writes the config.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h |  1 +
 drivers/video/fbdev/omap2/dss/hdmi4.c| 10 --
 drivers/video/fbdev/omap2/dss/hdmi5.c| 10 --
 drivers/video/fbdev/omap2/dss/hdmi_pll.c |  6 +-
 4 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 03761ecb81a6..7595274a9bcf 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -316,6 +316,7 @@ int hdmi_wp_init(struct platform_device *pdev, struct 
hdmi_wp_data *wp);
 /* HDMI PLL funcs */
 int hdmi_pll_enable(struct hdmi_pll_data *pll);
 void hdmi_pll_disable(struct hdmi_pll_data *pll);
+int hdmi_pll_set_config(struct hdmi_pll_data *pll);
 void hdmi_pll_dump(struct hdmi_pll_data *pll, struct seq_file *s);
 void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned long clkin,
unsigned long target_tmds);
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c 
b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 2094b6eae99e..98aa910241b8 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -196,13 +196,18 @@ static int hdmi_power_on_full(struct omap_dss_device 
*dssdev)
 
hdmi_pll_compute(hdmi.pll, clk_get_rate(hdmi.sys_clk), p-pixelclock);
 
-   /* config the PLL and PHY hdmi_set_pll_pwrfirst */
r = hdmi_pll_enable(hdmi.pll);
if (r) {
-   DSSDBG(Failed to lock PLL\n);
+   DSSERR(Failed to enable PLL\n);
goto err_pll_enable;
}
 
+   r = hdmi_pll_set_config(hdmi.pll);
+   if (r) {
+   DSSERR(Failed to configure PLL\n);
+   goto err_pll_cfg;
+   }
+
r = hdmi_phy_configure(hdmi.phy, hdmi.pll.info.clkdco,
hdmi.pll.info.clkout);
if (r) {
@@ -241,6 +246,7 @@ err_vid_enable:
 err_phy_cfg:
hdmi_wp_set_phy_pwr(hdmi.wp, HDMI_PHYPWRCMD_OFF);
 err_phy_pwr:
+err_pll_cfg:
hdmi_pll_disable(hdmi.pll);
 err_pll_enable:
hdmi_power_off_core(dssdev);
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c 
b/drivers/video/fbdev/omap2/dss/hdmi5.c
index fb8c14507a4d..facc4e070520 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -214,13 +214,18 @@ static int hdmi_power_on_full(struct omap_dss_device 
*dssdev)
hdmi_wp_set_irqstatus(hdmi.wp,
hdmi_wp_get_irqstatus(hdmi.wp));
 
-   /* config the PLL and PHY hdmi_set_pll_pwrfirst */
r = hdmi_pll_enable(hdmi.pll);
if (r) {
-   DSSDBG(Failed to lock PLL\n);
+   DSSERR(Failed to enable PLL\n);
goto err_pll_enable;
}
 
+   r = hdmi_pll_set_config(hdmi.pll);
+   if (r) {
+   DSSERR(Failed to configure PLL\n);
+   goto err_pll_cfg;
+   }
+
r = hdmi_phy_configure(hdmi.phy, hdmi.pll.info.clkdco,
hdmi.pll.info.clkout);
if (r) {
@@ -259,6 +264,7 @@ err_vid_enable:
hdmi_wp_set_phy_pwr(hdmi.wp, HDMI_PHYPWRCMD_OFF);
 err_phy_pwr:
 err_phy_cfg:
+err_pll_cfg:
hdmi_pll_disable(hdmi.pll);
 err_pll_enable:
hdmi_power_off_core(dssdev);
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c 
b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
index 190bede1dcb9..c14c3d132513 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_pll.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
@@ -103,7 +103,7 @@ void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned 
long clkin,
pi-clkout = clkout;
 }
 
-static int hdmi_pll_config(struct hdmi_pll_data *pll)
+int hdmi_pll_set_config(struct hdmi_pll_data *pll)
 {
u32 r;
struct hdmi_pll_info *fmt = pll-info;
@@ -179,10 +179,6 @@ int hdmi_pll_enable(struct hdmi_pll_data *pll)
if (r)
return r;
 
-   r = hdmi_pll_config(pll);
-   if (r)
-   return r;
-
return 0;
 }
 
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/22] OMAPDSS: HDMI: rewrite HDMI PLL calculation code

2014-11-12 Thread Tomi Valkeinen
The code calculating HDMI PLL parameters has always been very confusing.
Now that we are implementing a common PLL library for the DSS, it's
important that the PLL code is understandable.

This patch rewrites the calculation code, and removes a few hacks that
were used there.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h | 10 +++-
 drivers/video/fbdev/omap2/dss/hdmi4.c|  9 +--
 drivers/video/fbdev/omap2/dss/hdmi5.c|  9 +--
 drivers/video/fbdev/omap2/dss/hdmi_phy.c | 31 ---
 drivers/video/fbdev/omap2/dss/hdmi_pll.c | 95 
 5 files changed, 71 insertions(+), 83 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 4bbc9d206f4a..4b9bf0804a48 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -191,7 +191,9 @@ struct hdmi_pll_info {
u32 regmf;
u16 regm2;
u16 regsd;
-   u16 dcofreq;
+
+   unsigned long clkdco;
+   unsigned long clkout;
 };
 
 struct hdmi_audio_format {
@@ -313,11 +315,13 @@ int hdmi_wp_init(struct platform_device *pdev, struct 
hdmi_wp_data *wp);
 int hdmi_pll_enable(struct hdmi_pll_data *pll, struct hdmi_wp_data *wp);
 void hdmi_pll_disable(struct hdmi_pll_data *pll, struct hdmi_wp_data *wp);
 void hdmi_pll_dump(struct hdmi_pll_data *pll, struct seq_file *s);
-void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned long clkin, int phy);
+void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned long clkin,
+   unsigned long target_tmds);
 int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll);
 
 /* HDMI PHY funcs */
-int hdmi_phy_configure(struct hdmi_phy_data *phy, struct hdmi_config *cfg);
+int hdmi_phy_configure(struct hdmi_phy_data *phy, unsigned long hfbitclk,
+   unsigned long lfbitclk);
 void hdmi_phy_dump(struct hdmi_phy_data *phy, struct seq_file *s);
 int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy);
 int hdmi_phy_parse_lanes(struct hdmi_phy_data *phy, const u32 *lanes);
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c 
b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 9a8713ca090c..1f2fbccaff1f 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -180,7 +180,6 @@ static int hdmi_power_on_full(struct omap_dss_device 
*dssdev)
int r;
struct omap_video_timings *p;
struct omap_overlay_manager *mgr = hdmi.output.manager;
-   unsigned long phy;
struct hdmi_wp_data *wp = hdmi.wp;
 
r = hdmi_power_on_core(dssdev);
@@ -195,10 +194,7 @@ static int hdmi_power_on_full(struct omap_dss_device 
*dssdev)
 
DSSDBG(hdmi_power_on x_res= %d y_res = %d\n, p-x_res, p-y_res);
 
-   /* the functions below use kHz pixel clock. TODO: change to Hz */
-   phy = p-pixelclock / 1000;
-
-   hdmi_pll_compute(hdmi.pll, clk_get_rate(hdmi.sys_clk), phy);
+   hdmi_pll_compute(hdmi.pll, clk_get_rate(hdmi.sys_clk), p-pixelclock);
 
/* config the PLL and PHY hdmi_set_pll_pwrfirst */
r = hdmi_pll_enable(hdmi.pll, hdmi.wp);
@@ -207,7 +203,8 @@ static int hdmi_power_on_full(struct omap_dss_device 
*dssdev)
goto err_pll_enable;
}
 
-   r = hdmi_phy_configure(hdmi.phy, hdmi.cfg);
+   r = hdmi_phy_configure(hdmi.phy, hdmi.pll.info.clkdco,
+   hdmi.pll.info.clkout);
if (r) {
DSSDBG(Failed to configure PHY\n);
goto err_phy_cfg;
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c 
b/drivers/video/fbdev/omap2/dss/hdmi5.c
index c053d692ec16..e8ca9106c8af 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -198,7 +198,6 @@ static int hdmi_power_on_full(struct omap_dss_device 
*dssdev)
int r;
struct omap_video_timings *p;
struct omap_overlay_manager *mgr = hdmi.output.manager;
-   unsigned long phy;
 
r = hdmi_power_on_core(dssdev);
if (r)
@@ -208,10 +207,7 @@ static int hdmi_power_on_full(struct omap_dss_device 
*dssdev)
 
DSSDBG(hdmi_power_on x_res= %d y_res = %d\n, p-x_res, p-y_res);
 
-   /* the functions below use kHz pixel clock. TODO: change to Hz */
-   phy = p-pixelclock / 1000;
-
-   hdmi_pll_compute(hdmi.pll, clk_get_rate(hdmi.sys_clk), phy);
+   hdmi_pll_compute(hdmi.pll, clk_get_rate(hdmi.sys_clk), p-pixelclock);
 
/* disable and clear irqs */
hdmi_wp_clear_irqenable(hdmi.wp, 0x);
@@ -225,7 +221,8 @@ static int hdmi_power_on_full(struct omap_dss_device 
*dssdev)
goto err_pll_enable;
}
 
-   r = hdmi_phy_configure(hdmi.phy, hdmi.cfg);
+   r = hdmi_phy_configure(hdmi.phy, hdmi.pll.info.clkdco,
+   hdmi.pll.info.clkout);
if (r) {
DSSDBG(Failed to start PHY\n);
goto err_phy_cfg;
diff --git 

[PATCH 21/22] OMAPDSS: HDMI: use common DSS PLL support

2014-11-12 Thread Tomi Valkeinen
Now that we have the common DSS PLL support, change HDMI to use it. This
results in quite a lot of changes, but almost all of them are trivial
name changes.

The function to program the PLL settings can be removed from hdmi_pll.c,
as the common PLL API contains the same functionality.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h |  24 +---
 drivers/video/fbdev/omap2/dss/hdmi4.c|  55 +++-
 drivers/video/fbdev/omap2/dss/hdmi5.c|  56 +++-
 drivers/video/fbdev/omap2/dss/hdmi_pll.c | 225 ++-
 4 files changed, 146 insertions(+), 214 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 7595274a9bcf..3c42823e934b 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -184,18 +184,6 @@ struct hdmi_config {
enum hdmi_core_hdmi_dvi hdmi_dvi_mode;
 };
 
-/* HDMI PLL structure */
-struct hdmi_pll_info {
-   u16 regn;
-   u16 regm;
-   u32 regmf;
-   u16 regm2;
-   u16 regsd;
-
-   unsigned long clkdco;
-   unsigned long clkout;
-};
-
 struct hdmi_audio_format {
enum hdmi_stereo_channels   stereo_channels;
u8  active_chnnls_msk;
@@ -246,11 +234,11 @@ struct hdmi_wp_data {
 };
 
 struct hdmi_pll_data {
+   struct dss_pll pll;
+
void __iomem *base;
 
struct hdmi_wp_data *wp;
-
-   struct hdmi_pll_info info;
 };
 
 struct hdmi_phy_data {
@@ -314,14 +302,12 @@ void hdmi_wp_init_vid_fmt_timings(struct 
hdmi_video_format *video_fmt,
 int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp);
 
 /* HDMI PLL funcs */
-int hdmi_pll_enable(struct hdmi_pll_data *pll);
-void hdmi_pll_disable(struct hdmi_pll_data *pll);
-int hdmi_pll_set_config(struct hdmi_pll_data *pll);
 void hdmi_pll_dump(struct hdmi_pll_data *pll, struct seq_file *s);
-void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned long clkin,
-   unsigned long target_tmds);
+void hdmi_pll_compute(struct hdmi_pll_data *pll,
+   unsigned long target_tmds, struct dss_pll_clock_info *pi);
 int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll,
struct hdmi_wp_data *wp);
+void hdmi_pll_uninit(struct hdmi_pll_data *hpll);
 
 /* HDMI PHY funcs */
 int hdmi_phy_configure(struct hdmi_phy_data *phy, unsigned long hfbitclk,
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c 
b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 98aa910241b8..46dcc71ce058 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -49,7 +49,6 @@ static struct {
 
struct hdmi_config cfg;
 
-   struct clk *sys_clk;
struct regulator *vdda_hdmi_dac_reg;
 
bool core_enabled;
@@ -181,6 +180,7 @@ static int hdmi_power_on_full(struct omap_dss_device 
*dssdev)
struct omap_video_timings *p;
struct omap_overlay_manager *mgr = hdmi.output.manager;
struct hdmi_wp_data *wp = hdmi.wp;
+   struct dss_pll_clock_info hdmi_cinfo = { 0 };
 
r = hdmi_power_on_core(dssdev);
if (r)
@@ -194,22 +194,22 @@ static int hdmi_power_on_full(struct omap_dss_device 
*dssdev)
 
DSSDBG(hdmi_power_on x_res= %d y_res = %d\n, p-x_res, p-y_res);
 
-   hdmi_pll_compute(hdmi.pll, clk_get_rate(hdmi.sys_clk), p-pixelclock);
+   hdmi_pll_compute(hdmi.pll, p-pixelclock, hdmi_cinfo);
 
-   r = hdmi_pll_enable(hdmi.pll);
+   r = dss_pll_enable(hdmi.pll.pll);
if (r) {
DSSERR(Failed to enable PLL\n);
goto err_pll_enable;
}
 
-   r = hdmi_pll_set_config(hdmi.pll);
+   r = dss_pll_set_config(hdmi.pll.pll, hdmi_cinfo);
if (r) {
DSSERR(Failed to configure PLL\n);
goto err_pll_cfg;
}
 
-   r = hdmi_phy_configure(hdmi.phy, hdmi.pll.info.clkdco,
-   hdmi.pll.info.clkout);
+   r = hdmi_phy_configure(hdmi.phy, hdmi_cinfo.clkdco,
+   hdmi_cinfo.clkout[0]);
if (r) {
DSSDBG(Failed to configure PHY\n);
goto err_phy_cfg;
@@ -247,7 +247,7 @@ err_phy_cfg:
hdmi_wp_set_phy_pwr(hdmi.wp, HDMI_PHYPWRCMD_OFF);
 err_phy_pwr:
 err_pll_cfg:
-   hdmi_pll_disable(hdmi.pll);
+   dss_pll_disable(hdmi.pll.pll);
 err_pll_enable:
hdmi_power_off_core(dssdev);
return -EIO;
@@ -265,7 +265,7 @@ static void hdmi_power_off_full(struct omap_dss_device 
*dssdev)
 
hdmi_wp_set_phy_pwr(hdmi.wp, HDMI_PHYPWRCMD_OFF);
 
-   hdmi_pll_disable(hdmi.pll);
+   dss_pll_disable(hdmi.pll.pll);
 
hdmi_power_off_core(dssdev);
 }
@@ -407,21 +407,6 @@ static void hdmi_core_disable(struct omap_dss_device 
*dssdev)
mutex_unlock(hdmi.lock);
 }
 
-static int hdmi_get_clocks(struct platform_device *pdev)
-{
-   struct clk *clk;
-
-   clk = devm_clk_get(pdev-dev, sys_clk);
-  

[PATCH 17/22] OMAPDSS: HDMI: Remove HDMI PLL reset

2014-11-12 Thread Tomi Valkeinen
The SYSRESET bits in HDMI PLL do not reset the PLL itself, but only
affect the power used for the PLL.

Afaik there is no reason to use the SYSRESET bits, and we don't use it
in the other PLLs, so let's remove the HDMI PLL reset to make the PLL
code simpler and similar to other PLLs.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi_pll.c | 19 ---
 1 file changed, 19 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c 
b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
index f04d435c4c0f..0942bdc8dfa6 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_pll.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
@@ -166,21 +166,6 @@ static int hdmi_pll_config(struct hdmi_pll_data *pll)
return 0;
 }
 
-static int hdmi_pll_reset(struct hdmi_pll_data *pll)
-{
-   /* SYSRESET  controlled by power FSM */
-   REG_FLD_MOD(pll-base, PLLCTRL_PLL_CONTROL, pll_feat-sys_reset, 3, 3);
-
-   /* READ 0x0 reset is in progress */
-   if (hdmi_wait_for_bit_change(pll-base, PLLCTRL_PLL_STATUS, 0, 0, 1)
-   != 1) {
-   DSSERR(Failed to sysreset PLL\n);
-   return -ETIMEDOUT;
-   }
-
-   return 0;
-}
-
 int hdmi_pll_enable(struct hdmi_pll_data *pll, struct hdmi_wp_data *wp)
 {
u16 r = 0;
@@ -193,10 +178,6 @@ int hdmi_pll_enable(struct hdmi_pll_data *pll, struct 
hdmi_wp_data *wp)
if (r)
return r;
 
-   r = hdmi_pll_reset(pll);
-   if (r)
-   return r;
-
r = hdmi_pll_config(pll);
if (r)
return r;
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 10/20] ASoC: omap-hdmi-audio: Add platform device for OMAP HDMI audio support

2014-11-12 Thread Peter Ujfalusi
On 11/12/2014 12:49 PM, Jyri Sarha wrote:
 The platform device should only be registered from OMAPDSS HDMI
 driver. The platform driver registers and unregisters all ASoC
 components needed for OMAP HDMI audio.
 
 The hdmi audio driver implements cpu-dai component using the callbacks
 provided by OMAPDSS and registers the component under DSS HDMI
 device. Omap-pcm is registered for platform component also under DSS
 HDMI device. Dummy codec is used as as codec component. The hdmi audio
 driver implements also the card and registers it under its own
 platform device.
 
 Signed-off-by: Jyri Sarha jsa...@ti.com

Acked-by: Peter Ujfalusi peter.ujfal...@ti.com

 ---
  include/sound/omap-hdmi-audio.h  |   43 
  sound/soc/omap/Kconfig   |   15 ++
  sound/soc/omap/Makefile  |2 +
  sound/soc/omap/omap-hdmi-audio.c |  407 
 ++
  4 files changed, 467 insertions(+)
  create mode 100644 include/sound/omap-hdmi-audio.h
  create mode 100644 sound/soc/omap/omap-hdmi-audio.c
 
 diff --git a/include/sound/omap-hdmi-audio.h b/include/sound/omap-hdmi-audio.h
 new file mode 100644
 index 000..afdb416
 --- /dev/null
 +++ b/include/sound/omap-hdmi-audio.h
 @@ -0,0 +1,43 @@
 +/*
 + * hdmi-audio.c -- OMAP4+ DSS HDMI audio support library
 + *
 + * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
 + *
 + * Author: Jyri Sarha jsa...@ti.com
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * version 2 as published by the Free Software Foundation.
 + *
 + * This program is distributed in the hope that it will be useful, but
 + * WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 + * General Public License for more details.
 + *
 + */
 +
 +#include video/omapdss.h
 +
 +#ifndef __OMAP_HDMI_AUDIO_H__
 +#define __OMAP_HDMI_AUDIO_H__
 +
 +struct omap_hdmi_audio_ops {
 + int (*audio_startup)(struct device *dev,
 +  void (*abort_cb)(struct device *dev));
 + int (*audio_shutdown)(struct device *dev);
 + int (*audio_start)(struct device *dev);
 + void (*audio_stop)(struct device *dev);
 + int (*audio_config)(struct device *dev,
 + struct omap_dss_audio *dss_audio);
 +};
 +
 +/* HDMI audio initalization data */
 +struct omap_hdmi_audio_pdata {
 + struct device *dev;
 + enum omapdss_version dss_version;
 + phys_addr_t audio_dma_addr;
 +
 + const struct omap_hdmi_audio_ops *ops;
 +};
 +
 +#endif /* __OMAP_HDMI_AUDIO_H__ */
 diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
 index d44463a..2b32b3e 100644
 --- a/sound/soc/omap/Kconfig
 +++ b/sound/soc/omap/Kconfig
 @@ -15,6 +15,21 @@ config SND_OMAP_SOC_MCPDM
  config SND_OMAP_SOC_HDMI
   tristate
  
 +config SND_OMAP_SOC_HDMI_AUDIO
 + tristate HDMI audio support for OMAP4+ based SoCs
 + depends on SND_OMAP_SOC
 + help
 +   For HDMI audio to work OMAPDSS HDMI support should be
 +   enabled.
 +   The hdmi audio driver implements cpu-dai component using the
 +   callbacks provided by OMAPDSS and registers the component
 +   under DSS HDMI device. Omap-pcm is registered for platform
 +   component also under DSS HDMI device. Dummy codec is used as
 +   as codec component. The hdmi audio driver implements also
 +   the card and registers it under its own platform device.
 +   The device for the dirver is registered by OMAPDSS hdmi
 +   driver.
 +
  config SND_OMAP_SOC_N810
   tristate SoC Audio support for Nokia N810
   depends on SND_OMAP_SOC  MACH_NOKIA_N810  I2C
 diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
 index a725905..40688a6 100644
 --- a/sound/soc/omap/Makefile
 +++ b/sound/soc/omap/Makefile
 @@ -4,12 +4,14 @@ snd-soc-omap-dmic-objs := omap-dmic.o
  snd-soc-omap-mcbsp-objs := omap-mcbsp.o mcbsp.o
  snd-soc-omap-mcpdm-objs := omap-mcpdm.o
  snd-soc-omap-hdmi-objs := omap-hdmi.o
 +snd-soc-omap-hdmi-audio-objs := omap-hdmi-audio.o
  
  obj-$(CONFIG_SND_OMAP_SOC) += snd-soc-omap.o
  obj-$(CONFIG_SND_OMAP_SOC_DMIC) += snd-soc-omap-dmic.o
  obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o
  obj-$(CONFIG_SND_OMAP_SOC_MCPDM) += snd-soc-omap-mcpdm.o
  obj-$(CONFIG_SND_OMAP_SOC_HDMI) += snd-soc-omap-hdmi.o
 +obj-$(CONFIG_SND_OMAP_SOC_HDMI_AUDIO) += snd-soc-omap-hdmi-audio.o
  
  # OMAP Machine Support
  snd-soc-n810-objs := n810.o
 diff --git a/sound/soc/omap/omap-hdmi-audio.c 
 b/sound/soc/omap/omap-hdmi-audio.c
 new file mode 100644
 index 000..3f9ac7d
 --- /dev/null
 +++ b/sound/soc/omap/omap-hdmi-audio.c
 @@ -0,0 +1,407 @@
 +/*
 + * omap-hdmi-audio.c -- OMAP4+ DSS HDMI audio support library
 + *
 + * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
 + *
 + * Author: Jyri Sarha jsa...@ti.com
 + *
 + * This program is free software; you can 

Re: [PATCH v7 18/20] ASoC: omap: Remove obsolete HDMI audio code and Kconfig options

2014-11-12 Thread Peter Ujfalusi
On 11/12/2014 12:49 PM, Jyri Sarha wrote:
 Removes omap-hdmi DAI driver, omap-hdmi-card driver, the related
 Kconfig options, and Makefile entries. The HDMI DAI drivers has been
 integrated directly to OMAP4+ HDMI drivers and simple-card driver is
 used instead of omap-hdmi-card driver.
 
 Signed-off-by: Jyri Sarha jsa...@ti.com

Acked-by: Peter Ujfalusi peter.ujfal...@ti.com

 ---
  sound/soc/omap/Kconfig  |   13 --
  sound/soc/omap/Makefile |4 -
  sound/soc/omap/omap-hdmi-card.c |   87 --
  sound/soc/omap/omap-hdmi.c  |  364 
 ---
  sound/soc/omap/omap-hdmi.h  |   38 
  5 files changed, 506 deletions(-)
  delete mode 100644 sound/soc/omap/omap-hdmi-card.c
  delete mode 100644 sound/soc/omap/omap-hdmi.c
  delete mode 100644 sound/soc/omap/omap-hdmi.h
 
 diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
 index 2b32b3e..3dfcadf 100644
 --- a/sound/soc/omap/Kconfig
 +++ b/sound/soc/omap/Kconfig
 @@ -12,9 +12,6 @@ config SND_OMAP_SOC_MCBSP
  config SND_OMAP_SOC_MCPDM
   tristate
  
 -config SND_OMAP_SOC_HDMI
 - tristate
 -
  config SND_OMAP_SOC_HDMI_AUDIO
   tristate HDMI audio support for OMAP4+ based SoCs
   depends on SND_OMAP_SOC
 @@ -115,16 +112,6 @@ config SND_OMAP_SOC_OMAP_ABE_TWL6040
 - PandaBoard (4430)
 - PandaBoardES (4460)
  
 -config SND_OMAP_SOC_OMAP_HDMI
 - tristate SoC Audio support for Texas Instruments OMAP HDMI
 - depends on SND_OMAP_SOC  OMAP4_DSS_HDMI  OMAP2_DSS
 - select SND_OMAP_SOC_HDMI
 - select SND_SOC_HDMI_CODEC
 - select OMAP4_DSS_HDMI_AUDIO
 - help
 -   Say Y if you want to add support for SoC HDMI audio on Texas 
 Instruments
 -   OMAP4 chips
 -
  config SND_OMAP_SOC_OMAP3_PANDORA
   tristate SoC Audio support for OMAP3 Pandora
   depends on TWL4030_CORE  SND_OMAP_SOC  MACH_OMAP3_PANDORA
 diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
 index 40688a6..db36fbd 100644
 --- a/sound/soc/omap/Makefile
 +++ b/sound/soc/omap/Makefile
 @@ -3,14 +3,12 @@ snd-soc-omap-objs := omap-pcm.o
  snd-soc-omap-dmic-objs := omap-dmic.o
  snd-soc-omap-mcbsp-objs := omap-mcbsp.o mcbsp.o
  snd-soc-omap-mcpdm-objs := omap-mcpdm.o
 -snd-soc-omap-hdmi-objs := omap-hdmi.o
  snd-soc-omap-hdmi-audio-objs := omap-hdmi-audio.o
  
  obj-$(CONFIG_SND_OMAP_SOC) += snd-soc-omap.o
  obj-$(CONFIG_SND_OMAP_SOC_DMIC) += snd-soc-omap-dmic.o
  obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o
  obj-$(CONFIG_SND_OMAP_SOC_MCPDM) += snd-soc-omap-mcpdm.o
 -obj-$(CONFIG_SND_OMAP_SOC_HDMI) += snd-soc-omap-hdmi.o
  obj-$(CONFIG_SND_OMAP_SOC_HDMI_AUDIO) += snd-soc-omap-hdmi-audio.o
  
  # OMAP Machine Support
 @@ -22,7 +20,6 @@ snd-soc-am3517evm-objs := am3517evm.o
  snd-soc-omap-abe-twl6040-objs := omap-abe-twl6040.o
  snd-soc-omap-twl4030-objs := omap-twl4030.o
  snd-soc-omap3pandora-objs := omap3pandora.o
 -snd-soc-omap-hdmi-card-objs := omap-hdmi-card.o
  
  obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
  obj-$(CONFIG_SND_OMAP_SOC_RX51) += snd-soc-rx51.o
 @@ -32,4 +29,3 @@ obj-$(CONFIG_SND_OMAP_SOC_AM3517EVM) += snd-soc-am3517evm.o
  obj-$(CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040) += snd-soc-omap-abe-twl6040.o
  obj-$(CONFIG_SND_OMAP_SOC_OMAP_TWL4030) += snd-soc-omap-twl4030.o
  obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
 -obj-$(CONFIG_SND_OMAP_SOC_OMAP_HDMI) += snd-soc-omap-hdmi-card.o
 diff --git a/sound/soc/omap/omap-hdmi-card.c b/sound/soc/omap/omap-hdmi-card.c
 deleted file mode 100644
 index f649fe8..000
 --- a/sound/soc/omap/omap-hdmi-card.c
 +++ /dev/null
 @@ -1,87 +0,0 @@
 -/*
 - * omap-hdmi-card.c
 - *
 - * OMAP ALSA SoC machine driver for TI OMAP HDMI
 - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
 - * Author: Ricardo Neri ricardo.n...@ti.com
 - *
 - * This program is free software; you can redistribute it and/or
 - * modify it under the terms of the GNU General Public License
 - * version 2 as published by the Free Software Foundation.
 - *
 - * This program is distributed in the hope that it will be useful, but
 - * WITHOUT ANY WARRANTY; without even the implied warranty of
 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 - * General Public License for more details.
 - *
 - * You should have received a copy of the GNU General Public License
 - * along with this program; if not, write to the Free Software
 - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 - * 02110-1301 USA
 - *
 - */
 -
 -#include linux/module.h
 -#include sound/pcm.h
 -#include sound/soc.h
 -#include asm/mach-types.h
 -#include video/omapdss.h
 -
 -#define DRV_NAME omap-hdmi-audio
 -
 -static struct snd_soc_dai_link omap_hdmi_dai = {
 - .name = HDMI,
 - .stream_name = HDMI,
 - .cpu_dai_name = omap-hdmi-audio-dai,
 - .platform_name = omap-hdmi-audio-dai,
 - .codec_name = hdmi-audio-codec,
 - .codec_dai_name = hdmi-hifi,
 -};
 -
 -static struct 

Re: [PATCH 4/4] arm: dts: omap3-gta04: Add static configuration for devconf1 register

2014-11-12 Thread Tomi Valkeinen
Hi,

On 03/11/14 23:59, Marek Belisko wrote:
 gta04 board need for tvout enabled 2 bits in devconf1 register (tvbypass and 
 acbias).
 Add single pinmux entry and enable it.
 
 Signed-off-by: Marek Belisko ma...@goldelico.com
 ---
  arch/arm/boot/dts/omap3-gta04.dtsi | 22 ++
  1 file changed, 22 insertions(+)
 
 diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
 b/arch/arm/boot/dts/omap3-gta04.dtsi
 index e4d05f0..a456d37 100644
 --- a/arch/arm/boot/dts/omap3-gta04.dtsi
 +++ b/arch/arm/boot/dts/omap3-gta04.dtsi
 @@ -118,6 +118,17 @@
   };
   };
   };
 +
 + /* pinmux for devconf1 */
 + control_devconf1: pinmux@480022d8 {
 + compatible = pinctrl-single;
 + reg = 0x480022d8 4;   /* single register */
 + #address-cells = 1;
 + #size-cells = 0;
 + pinctrl-single,bit-per-mux;
 + pinctrl-single,register-width = 32;
 + pinctrl-single,function-mask = 0xfc0bd5;
 + };
  };
  
  omap3_pmx_core {
 @@ -497,3 +508,14 @@
   };
   };
  };
 +
 +control_devconf1 {
 + pinctrl-name = default;
 + pinctrl-0 =  tv_acbias_pins;
 +
 + tv_acbias_pins: pinmux_tv_acbias_pins {
 + pinctrl-single,bits = 
 + 0 0x40800 0x40800

I think it would be good to have a comment in the .dts above, mentioning
that TVOUTBYPASS and TVACEN bits are being set.

 + ;
 + };
 +};
 

OMAP3630 seems to have CONTROL_AVDAC1 and CONTROL_AVDAC2 registers. Did
you check if the SoC you use have those? It looks like they need
configuration also, if the exist.

So, I don't think tvbypass and acbias are really pinmux stuff, but it
does seem like an easy way to handle the devconf1 register, and I don't
see any issues with the setting being fixed.

However, devconf1 register seems to have bits for many devices,
including mcbsp, mmc, and even some Force MPU writes to be nonposted bit.

And, with a quick grep, I see CONTROL_DEVCONF1 touched in multiple
places in the kernel. I wonder if adding a pinmux entry for it could
cause some rather odd problems.

Tony, any idea about this? How should CONTROL_DEVCONFx registers be
accessed?

 Tomi




signature.asc
Description: OpenPGP digital signature


Re: [PATCH 0/4] Touchscreen performance related fixes

2014-11-12 Thread Johannes Pointner
Hello Vignesh,

I tried your patch version 3 on a customized board and had some
behavior I couldn't explain.
If I only use the touchscreen it works fine but if I also read values
from the ADCs then I get a lot of pen_up events even if I am still
touching the screen.
For the test I read via
# cat /sys/bus/iio/devices/iio\:device0/in_voltage5_raw
values from the ADC in an busy loop as you explained in an email
before. Did you also experience such behavior or do you know what
causes it?

Without the patches the touchscreen works fine during the iio test.

Thanks,
Hannes

2014-11-06 8:42 GMT+01:00 Vignesh R vigne...@ti.com:


 On Monday 03 November 2014 11:39 PM, Richard Cochran wrote:
 On Mon, Oct 27, 2014 at 04:38:27PM +0530, Vignesh R wrote:
 This series of patches fix TSC defects related to lag in touchscreen
 performance and cursor jump at touch release. The lag was result of
 udelay in TSC interrupt handler. Cursor jump due to false pen-up event.
 The patches implement Advisory 1.0.31 in silicon errata of am335x-evm
 to avoid false pen-up events and remove udelay.

 That advisory has two workarounds. You have chosen the second one?

 Work around one. Hence 5 wire design is not broken.


 The text of the second workaround says it only works on 4 wire setups,
 so I wonder how 5 wire designs will be affected.

 The advisory says to use
 steps 1 to 4 for ADC and 5 to 16 for TSC (assuming 4 wire TSC and 4 channel
 ADC).

 No, it doesn't say that. (sprz360f.pdf)

 The pen up event detection happens immediately after charge step. Hence,
 interchanging ADC and TSC steps makes sure that sampling of touch
 co-ordinates and pen events are done one after the other. This
 workaround was suggested by internal hardware folks. Earlier ADC steps
 intervened between sampling of co-ordinates and pen event detection
 which is not desirable.


 Further the X co-ordinate must be the last one to be sampled just
 before charge step. The first two patches implement the required changes.

 FWIW, I implemented the first workaround and removed the udelay not
 too long ago. Like Sebastian, I saw the TSC unit hang after about
 5 interrupts when running with the workaround.

 Did you test you patch for very long?

 Yes, I tested for about 20 interrupts and I didn't see any hang.
 This patch series does not just implement workaround but also does some
 minor changes, such as interchanging ADC and TSC steps etc, which makes
 TSC driver more robust. Let me know if you encounter any issues with my
 patch series.

 Regards
 Vignesh


 Thanks,
 Richard

 --
 To unsubscribe from this list: send the line unsubscribe linux-iio in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] video: omapdss: Add opa362 driver

2014-11-12 Thread Tomi Valkeinen
Hi,


On 03/11/14 23:59, Marek Belisko wrote:
 opa362 is amplifier for videoand can be connected to the tvout pads
 of the OMAP3. It has one gpio control for enable/disable of the output
 (high impedance).
 
 Signed-off-by: H. Nikolaus Schaller h...@goldelico.com
 ---
  drivers/video/fbdev/omap2/displays-new/Kconfig |   6 +
  drivers/video/fbdev/omap2/displays-new/Makefile|   1 +
  .../fbdev/omap2/displays-new/amplifier-opa362.c| 347 
 +
  3 files changed, 354 insertions(+)
  create mode 100644 drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c

This doesn't even compile:

drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c:207:28: error:
dereferencing pointer to incomplete type
  ddata-enable_gpio = pdata-enable_gpio;

And it seems to have fields for bypass and bypass which are handled in
the devconf1 patch.

 Tomi




signature.asc
Description: OpenPGP digital signature


Re: [PATCH 1/4] video: omapdss: Add opa362 driver

2014-11-12 Thread Belisko Marek
Hi Tomi,

On Wed, Nov 12, 2014 at 2:57 PM, Tomi Valkeinen tomi.valkei...@ti.com wrote:
 Hi,


 On 03/11/14 23:59, Marek Belisko wrote:
 opa362 is amplifier for videoand can be connected to the tvout pads
 of the OMAP3. It has one gpio control for enable/disable of the output
 (high impedance).

 Signed-off-by: H. Nikolaus Schaller h...@goldelico.com
 ---
  drivers/video/fbdev/omap2/displays-new/Kconfig |   6 +
  drivers/video/fbdev/omap2/displays-new/Makefile|   1 +
  .../fbdev/omap2/displays-new/amplifier-opa362.c| 347 
 +
  3 files changed, 354 insertions(+)
  create mode 100644 drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c

 This doesn't even compile:

 drivers/video/fbdev/omap2/displays-new/amplifier-opa362.c:207:28: error:
 dereferencing pointer to incomplete type
   ddata-enable_gpio = pdata-enable_gpio;
Hmm sorry about that. I must mixed something up. I'll post updated version soon.
Thanks for review.

 And it seems to have fields for bypass and bypass which are handled in
 the devconf1 patch.

  Tomi



BR,

marek

-- 
as simple and primitive as possible
-
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] Documentation: DT: Add documentation for ti,opa362 bindings

2014-11-12 Thread Tomi Valkeinen
On 03/11/14 23:59, Marek Belisko wrote:
 Signed-off-by: Marek Belisko ma...@goldelico.com
 ---
  .../devicetree/bindings/video/ti,opa362.txt| 38 
 ++
  1 file changed, 38 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/video/ti,opa362.txt
 
 diff --git a/Documentation/devicetree/bindings/video/ti,opa362.txt 
 b/Documentation/devicetree/bindings/video/ti,opa362.txt
 new file mode 100644
 index 000..d7ed11a
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/video/ti,opa362.txt
 @@ -0,0 +1,38 @@
 +OPA362 analog video amplifier
 +
 +Required properties:
 +- compatible: ti,opa362
 +- gpio: enable/disable output gpio
 +
 +Required node:
 +- Video port 0 for opa362 input
 +- Video port 1 for opa362 output
 +
 +Example:
 +
 +tv_amp: opa362 {
 +  compatible = ti,opa362;
 +  gpios = gpio1 23 0;  /* GPIO to enable video out amplifier */
 +  
 + label = opa362;

opa shouldn't have label property. label is meant for the
end-of-the-chain component, like the connector.

 +  ports {

Hmm, I think there is extra space before 'ports', maybe below also.

 Tomi




signature.asc
Description: OpenPGP digital signature


[PATCH v5 6/8] net: can: c_can: Disable pins when CAN interface is down

2014-11-12 Thread Roger Quadros
DRA7 CAN IP suffers from a problem which causes it to be prevented
from fully turning OFF (i.e. stuck in transition) if the module was
disabled while there was traffic on the CAN_RX line.

To work around this issue we select the SLEEP pin state by default
on probe and use the DEFAULT pin state on CAN up and back to the
SLEEP pin state on CAN down.

Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/net/can/c_can/c_can.c  | 21 +
 drivers/net/can/c_can/c_can.h  |  1 +
 drivers/net/can/c_can/c_can_platform.c | 20 
 3 files changed, 42 insertions(+)

diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 8e78bb4..a950eea 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -35,6 +35,7 @@
 #include linux/list.h
 #include linux/io.h
 #include linux/pm_runtime.h
+#include linux/pinctrl/consumer.h
 
 #include linux/can.h
 #include linux/can/dev.h
@@ -587,6 +588,21 @@ static int c_can_chip_config(struct net_device *dev)
return c_can_set_bittiming(dev);
 }
 
+/*
+ * Selects the pinctrl state specified in the name.
+ */
+static void c_can_pinctrl_select_state(struct c_can_priv *priv,
+ const char *name)
+{
+   if (!IS_ERR(priv-pinctrl)) {
+   struct pinctrl_state *s;
+
+   s = pinctrl_lookup_state(priv-pinctrl, name);
+   if (!IS_ERR(s))
+   pinctrl_select_state(priv-pinctrl, s);
+   }
+}
+
 static int c_can_start(struct net_device *dev)
 {
struct c_can_priv *priv = netdev_priv(dev);
@@ -603,6 +619,8 @@ static int c_can_start(struct net_device *dev)
 
priv-can.state = CAN_STATE_ERROR_ACTIVE;
 
+   /* activate pins */
+   c_can_pinctrl_select_state(priv, PINCTRL_STATE_DEFAULT);
return 0;
 }
 
@@ -611,6 +629,9 @@ static void c_can_stop(struct net_device *dev)
struct c_can_priv *priv = netdev_priv(dev);
 
c_can_irq_control(priv, false);
+
+   /* deactivate pins */
+   c_can_pinctrl_select_state(priv, PINCTRL_STATE_SLEEP);
priv-can.state = CAN_STATE_STOPPED;
 }
 
diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h
index c6715ca..3cedf48 100644
--- a/drivers/net/can/c_can/c_can.h
+++ b/drivers/net/can/c_can/c_can.h
@@ -210,6 +210,7 @@ struct c_can_priv {
u32 comm_rcv_high;
u32 rxmasked;
u32 dlc[C_CAN_MSG_OBJ_TX_NUM];
+   struct pinctrl *pinctrl;
 };
 
 struct net_device *alloc_c_can_dev(void);
diff --git a/drivers/net/can/c_can/c_can_platform.c 
b/drivers/net/can/c_can/c_can_platform.c
index b838c6b..71b9063 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -34,6 +34,7 @@
 #include linux/of_device.h
 #include linux/mfd/syscon.h
 #include linux/regmap.h
+#include linux/pinctrl/consumer.h
 
 #include linux/can/dev.h
 
@@ -230,6 +231,7 @@ static int c_can_plat_probe(struct platform_device *pdev)
struct clk *clk;
const struct c_can_driver_data *drvdata;
struct device_node *np = pdev-dev.of_node;
+   struct pinctrl *pinctrl;
 
match = of_match_device(c_can_of_table, pdev-dev);
if (match) {
@@ -241,6 +243,23 @@ static int c_can_plat_probe(struct platform_device *pdev)
return -ENODEV;
}
 
+   pinctrl = devm_pinctrl_get(pdev-dev);
+   if (!IS_ERR(pinctrl)) {
+   struct pinctrl_state *s;
+
+   /* Deactivate pins to prevent DRA7 DCAN IP from being
+* stuck in transition when module is disabled.
+* Pins are activated in c_can_start() and deactivated
+* in c_can_stop()
+*/
+   s = pinctrl_lookup_state(pinctrl, PINCTRL_STATE_SLEEP);
+   if (!IS_ERR(s))
+   pinctrl_select_state(pinctrl, s);
+   } else {
+   dev_warn(pdev-dev,
+failed to get pinctrl\n);
+   }
+
/* get the appropriate clk */
clk = devm_clk_get(pdev-dev, NULL);
if (IS_ERR(clk)) {
@@ -270,6 +289,7 @@ static int c_can_plat_probe(struct platform_device *pdev)
}
 
priv = netdev_priv(dev);
+   priv-pinctrl = pinctrl;
 
switch (drvdata-id) {
case BOSCH_C_CAN:
-- 
1.8.3.2


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 06/20] OMAPDSS: omapdss.h: Remove audio_state member of struct omap_dss_device

2014-11-12 Thread Jyri Sarha
Damn, this patch should have gone to second last for it not not to break 
bisect. I'll squash it into OMAPDSS: Remove all references to obsolete 
HDMI audio callbacks an mail v7.1 patch-set shortly.


Best regards,
Jyri

On 11/12/2014 12:49 PM, Jyri Sarha wrote:

The audio_state member is not used.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
  include/video/omapdss.h |9 -
  1 file changed, 9 deletions(-)

diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 069dfca..9f2699f 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -166,13 +166,6 @@ enum omap_dss_display_state {
OMAP_DSS_DISPLAY_ACTIVE,
  };

-enum omap_dss_audio_state {
-   OMAP_DSS_AUDIO_DISABLED = 0,
-   OMAP_DSS_AUDIO_ENABLED,
-   OMAP_DSS_AUDIO_CONFIGURED,
-   OMAP_DSS_AUDIO_PLAYING,
-};
-
  struct omap_dss_audio {
struct snd_aes_iec958 *iec;
struct snd_cea_861_aud_if *cea;
@@ -783,8 +776,6 @@ struct omap_dss_device {

enum omap_dss_display_state state;

-   enum omap_dss_audio_state audio_state;
-
/* OMAP DSS output specific fields */

struct list_head list;



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 13/19] OMAPDSS: hdmi4: Remove callbacks for the old ASoC DAI driver

2014-11-12 Thread Jyri Sarha
Removes the OMAP4 HDMI audio callbacks for the old external DAI driver.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi4.c |  113 -
 1 file changed, 113 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c 
b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 764443e..6f6764c 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -468,112 +468,6 @@ static int hdmi_read_edid(struct omap_dss_device *dssdev,
return r;
 }
 
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
-static int hdmi_audio_enable(struct omap_dss_device *dssdev)
-{
-   int r;
-
-   mutex_lock(hdmi.lock);
-
-   if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
-   r = -EPERM;
-   goto err;
-   }
-
-   r = hdmi_wp_audio_enable(hdmi.wp, true);
-   if (r)
-   goto err;
-
-   mutex_unlock(hdmi.lock);
-   return 0;
-
-err:
-   mutex_unlock(hdmi.lock);
-   return r;
-}
-
-static void hdmi_audio_disable(struct omap_dss_device *dssdev)
-{
-   hdmi_wp_audio_enable(hdmi.wp, false);
-}
-
-static int hdmi_audio_start(struct omap_dss_device *dssdev)
-{
-   return hdmi4_audio_start(hdmi.core, hdmi.wp);
-}
-
-static void hdmi_audio_stop(struct omap_dss_device *dssdev)
-{
-   hdmi4_audio_stop(hdmi.core, hdmi.wp);
-}
-
-static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
-{
-   bool r;
-
-   mutex_lock(hdmi.lock);
-
-   r = hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode);
-
-   mutex_unlock(hdmi.lock);
-   return r;
-}
-
-static int hdmi_audio_config(struct omap_dss_device *dssdev,
-   struct omap_dss_audio *audio)
-{
-   int r;
-   u32 pclk = hdmi.cfg.timings.pixelclock;
-
-   mutex_lock(hdmi.lock);
-
-   if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
-   r = -EPERM;
-   goto err;
-   }
-
-   r = hdmi4_audio_config(hdmi.core, hdmi.wp, audio, pclk);
-   if (r)
-   goto err;
-
-   mutex_unlock(hdmi.lock);
-   return 0;
-
-err:
-   mutex_unlock(hdmi.lock);
-   return r;
-}
-#else
-static int hdmi_audio_enable(struct omap_dss_device *dssdev)
-{
-   return -EPERM;
-}
-
-static void hdmi_audio_disable(struct omap_dss_device *dssdev)
-{
-}
-
-static int hdmi_audio_start(struct omap_dss_device *dssdev)
-{
-   return -EPERM;
-}
-
-static void hdmi_audio_stop(struct omap_dss_device *dssdev)
-{
-}
-
-static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
-{
-   return false;
-}
-
-static int hdmi_audio_config(struct omap_dss_device *dssdev,
-   struct omap_dss_audio *audio)
-{
-   return -EPERM;
-}
-#endif
-
 static int hdmi_set_infoframe(struct omap_dss_device *dssdev,
const struct hdmi_avi_infoframe *avi)
 {
@@ -602,13 +496,6 @@ static const struct omapdss_hdmi_ops hdmi_ops = {
.read_edid  = hdmi_read_edid,
.set_infoframe  = hdmi_set_infoframe,
.set_hdmi_mode  = hdmi_set_hdmi_mode,
-
-   .audio_enable   = hdmi_audio_enable,
-   .audio_disable  = hdmi_audio_disable,
-   .audio_start= hdmi_audio_start,
-   .audio_stop = hdmi_audio_stop,
-   .audio_supported= hdmi_audio_supported,
-   .audio_config   = hdmi_audio_config,
 };
 
 static void hdmi_init_output(struct platform_device *pdev)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 03/19] OMAPDSS: hdmi.h: Add HDMI_AUDIO_LAYOUT_6CH enum value

2014-11-12 Thread Jyri Sarha
The OMAP5 HDMI audio implementation needs HDMI_AUDIO_LAYOUT_6CH in
hdmi_core_audio_layout enum. I found the correct value from ti-linux
3.8 tree.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 262771b..1f01068 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -160,7 +160,8 @@ enum hdmi_audio_blk_strt_end_sig {
 
 enum hdmi_core_audio_layout {
HDMI_AUDIO_LAYOUT_2CH = 0,
-   HDMI_AUDIO_LAYOUT_8CH = 1
+   HDMI_AUDIO_LAYOUT_8CH = 1,
+   HDMI_AUDIO_LAYOUT_6CH = 2
 };
 
 enum hdmi_core_cts_mode {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 08/19] OMAPDSS: hdmi: Add pdev pointer for audio_pdev in HDMI DRV data

2014-11-12 Thread Jyri Sarha
This is used to store omap-hdmi-audio pdev for unregistering it.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 6bf077b..a6e08ff 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -368,6 +368,8 @@ struct omap_hdmi {
bool core_enabled;
 
struct omap_dss_device output;
+
+   struct platform_device *audio_pdev;
 };
 
 #endif
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 07/19] OMAPDSS: hdmi: Make hdmi structure public

2014-11-12 Thread Jyri Sarha
Unify the private anonymous struct in hdmi4.c and hdmi5.c, name it as
struct omap_hdmi, and make it public in hdmi.h.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h  |   21 +
 drivers/video/fbdev/omap2/dss/hdmi4.c |   31 ---
 drivers/video/fbdev/omap2/dss/hdmi5.c |   20 ++--
 3 files changed, 31 insertions(+), 41 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 9ba7c1a..6bf077b 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -349,4 +349,25 @@ static inline bool hdmi_mode_has_audio(int mode)
 {
return mode == HDMI_HDMI ? true : false;
 }
+
+/* HDMI DRV data */
+struct omap_hdmi {
+   struct mutex lock;
+   struct platform_device *pdev;
+
+   struct hdmi_wp_data wp;
+   struct hdmi_pll_datapll;
+   struct hdmi_phy_dataphy;
+   struct hdmi_core_data   core;
+
+   struct hdmi_config cfg;
+
+   struct clk *sys_clk;
+   struct regulator *vdda_reg;
+
+   bool core_enabled;
+
+   struct omap_dss_device output;
+};
+
 #endif
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c 
b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 9a8713c..764443e 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -37,25 +37,9 @@
 #include hdmi4_core.h
 #include dss.h
 #include dss_features.h
+#include hdmi.h
 
-static struct {
-   struct mutex lock;
-   struct platform_device *pdev;
-
-   struct hdmi_wp_data wp;
-   struct hdmi_pll_datapll;
-   struct hdmi_phy_dataphy;
-   struct hdmi_core_data   core;
-
-   struct hdmi_config cfg;
-
-   struct clk *sys_clk;
-   struct regulator *vdda_hdmi_dac_reg;
-
-   bool core_enabled;
-
-   struct omap_dss_device output;
-} hdmi;
+static struct omap_hdmi hdmi;
 
 static int hdmi_runtime_get(void)
 {
@@ -117,7 +101,7 @@ static int hdmi_init_regulator(void)
int r;
struct regulator *reg;
 
-   if (hdmi.vdda_hdmi_dac_reg != NULL)
+   if (hdmi.vdda_reg != NULL)
return 0;
 
reg = devm_regulator_get(hdmi.pdev-dev, vdda);
@@ -137,7 +121,7 @@ static int hdmi_init_regulator(void)
}
}
 
-   hdmi.vdda_hdmi_dac_reg = reg;
+   hdmi.vdda_reg = reg;
 
return 0;
 }
@@ -146,7 +130,7 @@ static int hdmi_power_on_core(struct omap_dss_device 
*dssdev)
 {
int r;
 
-   r = regulator_enable(hdmi.vdda_hdmi_dac_reg);
+   r = regulator_enable(hdmi.vdda_reg);
if (r)
return r;
 
@@ -162,7 +146,7 @@ static int hdmi_power_on_core(struct omap_dss_device 
*dssdev)
return 0;
 
 err_runtime_get:
-   regulator_disable(hdmi.vdda_hdmi_dac_reg);
+   regulator_disable(hdmi.vdda_reg);
 
return r;
 }
@@ -172,7 +156,7 @@ static void hdmi_power_off_core(struct omap_dss_device 
*dssdev)
hdmi.core_enabled = false;
 
hdmi_runtime_put();
-   regulator_disable(hdmi.vdda_hdmi_dac_reg);
+   regulator_disable(hdmi.vdda_reg);
 }
 
 static int hdmi_power_on_full(struct omap_dss_device *dssdev)
@@ -678,6 +662,7 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
int irq;
 
hdmi.pdev = pdev;
+   dev_set_drvdata(pdev-dev, hdmi);
 
mutex_init(hdmi.lock);
 
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c 
b/drivers/video/fbdev/omap2/dss/hdmi5.c
index 169b764..694cdee 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -43,24 +43,7 @@
 #include dss.h
 #include dss_features.h
 
-static struct {
-   struct mutex lock;
-   struct platform_device *pdev;
-
-   struct hdmi_wp_data wp;
-   struct hdmi_pll_datapll;
-   struct hdmi_phy_dataphy;
-   struct hdmi_core_data   core;
-
-   struct hdmi_config cfg;
-
-   struct clk *sys_clk;
-   struct regulator *vdda_reg;
-
-   bool core_enabled;
-
-   struct omap_dss_device output;
-} hdmi;
+static struct omap_hdmi hdmi;
 
 static int hdmi_runtime_get(void)
 {
@@ -703,6 +686,7 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
int irq;
 
hdmi.pdev = pdev;
+   dev_set_drvdata(pdev-dev, hdmi);
 
mutex_init(hdmi.lock);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 12/19] OMAPDSS: hdmi.h: Add members to hdmi drvdata for audio implementation

2014-11-12 Thread Jyri Sarha
Adds display_enabled flag and audio_abort_cb callback to struct hdmi.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 6d129f2..bfaaf2f 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -366,10 +366,12 @@ struct omap_hdmi {
struct regulator *vdda_reg;
 
bool core_enabled;
+   bool display_enabled;
 
struct omap_dss_device output;
 
struct platform_device *audio_pdev;
+   void (*audio_abort_cb)(struct device *dev);
 };
 
 #endif
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 04/19] OMAPDSS: hdmi: Remove most of OMAP[45]_DSS_HDMI_AUDIO ifdefs

2014-11-12 Thread Jyri Sarha
It does not waste too many bytes to compile all audio related core
functions always in with HDMI support. It should help readability and
in keeping the audio code in working shape. Leave the options just for
disabling and enabling the functionality in hdmi[45].c.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h|3 +--
 drivers/video/fbdev/omap2/dss/hdmi4_core.c  |5 -
 drivers/video/fbdev/omap2/dss/hdmi4_core.h  |2 --
 drivers/video/fbdev/omap2/dss/hdmi5_core.c  |6 --
 drivers/video/fbdev/omap2/dss/hdmi5_core.h  |2 --
 drivers/video/fbdev/omap2/dss/hdmi_common.c |2 --
 drivers/video/fbdev/omap2/dss/hdmi_wp.c |2 --
 7 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 1f01068..03726b5 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -335,7 +335,7 @@ int hdmi_phy_parse_lanes(struct hdmi_phy_data *phy, const 
u32 *lanes);
 int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep,
struct hdmi_phy_data *phy);
 
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) || 
defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
+/* Audio funcs */
 int hdmi_compute_acr(u32 pclk, u32 sample_freq, u32 *n, u32 *cts);
 int hdmi_wp_audio_enable(struct hdmi_wp_data *wp, bool enable);
 int hdmi_wp_audio_core_req_enable(struct hdmi_wp_data *wp, bool enable);
@@ -348,4 +348,3 @@ static inline bool hdmi_mode_has_audio(int mode)
return mode == HDMI_HDMI ? true : false;
 }
 #endif
-#endif
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.c 
b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
index 4ad39cf..3b448d9 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
@@ -31,10 +31,8 @@
 #include linux/platform_device.h
 #include linux/string.h
 #include linux/seq_file.h
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
 #include sound/asound.h
 #include sound/asoundef.h
-#endif
 
 #include hdmi4_core.h
 #include dss_features.h
@@ -530,7 +528,6 @@ void hdmi4_core_dump(struct hdmi_core_data *core, struct 
seq_file *s)
DUMPCOREAV(HDMI_CORE_AV_CEC_ADDR_ID);
 }
 
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
 static void hdmi_core_audio_config(struct hdmi_core_data *core,
struct hdmi_core_audio_config *cfg)
 {
@@ -886,8 +883,6 @@ int hdmi4_audio_get_dma_port(u32 *offset, u32 *size)
return 0;
 }
 
-#endif
-
 int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
 {
struct resource *res;
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.h 
b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
index 827909e..c1959f7 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
@@ -266,12 +266,10 @@ void hdmi4_configure(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp,
 void hdmi4_core_dump(struct hdmi_core_data *core, struct seq_file *s);
 int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core);
 
-#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
 int hdmi4_audio_start(struct hdmi_core_data *core, struct hdmi_wp_data *wp);
 void hdmi4_audio_stop(struct hdmi_core_data *core, struct hdmi_wp_data *wp);
 int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
struct omap_dss_audio *audio, u32 pclk);
 int hdmi4_audio_get_dma_port(u32 *offset, u32 *size);
-#endif
 
 #endif
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5_core.c 
b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
index 9ffa805..a711579 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
@@ -30,10 +30,8 @@
 #include linux/string.h
 #include linux/seq_file.h
 #include drm/drm_edid.h
-#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
 #include sound/asound.h
 #include sound/asoundef.h
-#endif
 
 #include hdmi5_core.h
 
@@ -644,9 +642,6 @@ void hdmi5_configure(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp,
hdmi_core_enable_interrupts(core);
 }
 
-
-#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
-
 static void hdmi5_core_audio_config(struct hdmi_core_data *core,
struct hdmi_core_audio_config *cfg)
 {
@@ -897,7 +892,6 @@ int hdmi5_audio_config(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp,
 
return 0;
 }
-#endif
 
 int hdmi5_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
 {
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5_core.h 
b/drivers/video/fbdev/omap2/dss/hdmi5_core.h
index ce7e9f3..f2f1022 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5_core.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi5_core.h
@@ -299,8 +299,6 @@ void hdmi5_configure(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp,
struct hdmi_config *cfg);
 int hdmi5_core_init(struct platform_device *pdev, struct hdmi_core_data *core);
 
-#if 

[PATCH v7.1 05/19] OMAPDSS: hdmi4_core: Remove unused hdmi4_audio_get_dma_port()

2014-11-12 Thread Jyri Sarha
hdmi4_audio_get_dma_port() is unused and and broken.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi4_core.c |9 -
 drivers/video/fbdev/omap2/dss/hdmi4_core.h |2 --
 2 files changed, 11 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.c 
b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
index 3b448d9..7eafea5 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
@@ -874,15 +874,6 @@ void hdmi4_audio_stop(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp)
hdmi_wp_audio_core_req_enable(wp, false);
 }
 
-int hdmi4_audio_get_dma_port(u32 *offset, u32 *size)
-{
-   if (!offset || !size)
-   return -EINVAL;
-   *offset = HDMI_WP_AUDIO_DATA;
-   *size = 4;
-   return 0;
-}
-
 int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
 {
struct resource *res;
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.h 
b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
index c1959f7..a069f96 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
@@ -270,6 +270,4 @@ int hdmi4_audio_start(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp);
 void hdmi4_audio_stop(struct hdmi_core_data *core, struct hdmi_wp_data *wp);
 int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
struct omap_dss_audio *audio, u32 pclk);
-int hdmi4_audio_get_dma_port(u32 *offset, u32 *size);
-
 #endif
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 01/19] OMAPDSS: hdmi_wp: Protect reserved bits in hdmi_wp_audio_config_format()

2014-11-12 Thread Jyri Sarha
Only OMAP4 DSS has non reserved bits above 6th bit in HDMI_WP_AUDIO_CFG.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi_wp.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi_wp.c 
b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
index 496327e..71b499e 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_wp.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
@@ -194,8 +194,12 @@ void hdmi_wp_audio_config_format(struct hdmi_wp_data *wp,
DSSDBG(Enter hdmi_wp_audio_config_format\n);
 
r = hdmi_read_reg(wp-base, HDMI_WP_AUDIO_CFG);
-   r = FLD_MOD(r, aud_fmt-stereo_channels, 26, 24);
-   r = FLD_MOD(r, aud_fmt-active_chnnls_msk, 23, 16);
+   if (omapdss_get_version() == OMAPDSS_VER_OMAP4430_ES1 ||
+   omapdss_get_version() == OMAPDSS_VER_OMAP4430_ES2 ||
+   omapdss_get_version() == OMAPDSS_VER_OMAP4) {
+   r = FLD_MOD(r, aud_fmt-stereo_channels, 26, 24);
+   r = FLD_MOD(r, aud_fmt-active_chnnls_msk, 23, 16);
+   }
r = FLD_MOD(r, aud_fmt-en_sig_blk_strt_end, 5, 5);
r = FLD_MOD(r, aud_fmt-type, 4, 4);
r = FLD_MOD(r, aud_fmt-justification, 3, 3);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 06/19] OMAPDSS: hdmi_wp: Add function for getting audio dma address

2014-11-12 Thread Jyri Sarha
The audio dma port is found in the hdmi_wp physical address space.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h|2 ++
 drivers/video/fbdev/omap2/dss/hdmi_wp.c |6 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index 03726b5..9ba7c1a 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -250,6 +250,7 @@ struct hdmi_core_audio_config {
 
 struct hdmi_wp_data {
void __iomem *base;
+   phys_addr_t phys_base;
 };
 
 struct hdmi_pll_data {
@@ -317,6 +318,7 @@ void hdmi_wp_video_config_timing(struct hdmi_wp_data *wp,
 void hdmi_wp_init_vid_fmt_timings(struct hdmi_video_format *video_fmt,
struct omap_video_timings *timings, struct hdmi_config *param);
 int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp);
+phys_addr_t hdmi_wp_get_audio_dma_addr(struct hdmi_wp_data *wp);
 
 /* HDMI PLL funcs */
 int hdmi_pll_enable(struct hdmi_pll_data *pll, struct hdmi_wp_data *wp);
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_wp.c 
b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
index 4ead962..c15377e 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_wp.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_wp.c
@@ -249,6 +249,7 @@ int hdmi_wp_init(struct platform_device *pdev, struct 
hdmi_wp_data *wp)
DSSERR(can't get WP mem resource\n);
return -EINVAL;
}
+   wp-phys_base = res-start;
 
wp-base = devm_ioremap_resource(pdev-dev, res);
if (IS_ERR(wp-base)) {
@@ -258,3 +259,8 @@ int hdmi_wp_init(struct platform_device *pdev, struct 
hdmi_wp_data *wp)
 
return 0;
 }
+
+phys_addr_t hdmi_wp_get_audio_dma_addr(struct hdmi_wp_data *wp)
+{
+   return wp-phys_base + HDMI_WP_AUDIO_DATA;
+}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 14/19] OMAPDSS: hdmi4: Register ASoC platform device for omap hdmi audio

2014-11-12 Thread Jyri Sarha
Implements callbacks for OMAP HDMI audio platform driver and registers
it in probe function. Unregistering is done in remove function.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi4.c |  125 +
 1 file changed, 125 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c 
b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 6f6764c..28a55b2 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -33,6 +33,7 @@
 #include linux/gpio.h
 #include linux/regulator/consumer.h
 #include video/omapdss.h
+#include sound/omap-hdmi-audio.h
 
 #include hdmi4_core.h
 #include dss.h
@@ -336,6 +337,8 @@ static int hdmi_display_enable(struct omap_dss_device 
*dssdev)
goto err0;
}
 
+   hdmi.display_enabled = true;
+
mutex_unlock(hdmi.lock);
return 0;
 
@@ -350,8 +353,13 @@ static void hdmi_display_disable(struct omap_dss_device 
*dssdev)
 
mutex_lock(hdmi.lock);
 
+   if (hdmi.audio_pdev  hdmi.audio_abort_cb)
+   hdmi.audio_abort_cb(hdmi.audio_pdev-dev);
+
hdmi_power_off_full(dssdev);
 
+   hdmi.display_enabled = false;
+
mutex_unlock(hdmi.lock);
 }
 
@@ -542,6 +550,112 @@ err:
return r;
 }
 
+/* Audio callbacks */
+static int hdmi_audio_startup(struct device *dev,
+ void (*abort_cb)(struct device *dev))
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+   int ret = 0;
+
+   mutex_lock(hd-lock);
+
+   if (!hdmi_mode_has_audio(hd-cfg) || !hd-display_enabled) {
+   ret = -EPERM;
+   goto out;
+   }
+
+   hd-audio_abort_cb = abort_cb;
+
+out:
+   mutex_unlock(hd-lock);
+
+   return ret;
+}
+
+static int hdmi_audio_shutdown(struct device *dev)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+
+   mutex_lock(hd-lock);
+   hd-audio_abort_cb = NULL;
+   mutex_unlock(hd-lock);
+
+   return 0;
+}
+
+static int hdmi_audio_start(struct device *dev)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+
+   WARN_ON(!hdmi_mode_has_audio(hd-cfg));
+   WARN_ON(!hd-display_enabled);
+
+   hdmi_wp_audio_enable(hd-wp, true);
+   hdmi4_audio_start(hd-core, hd-wp);
+
+   return 0;
+}
+
+static void hdmi_audio_stop(struct device *dev)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+
+   WARN_ON(!hdmi_mode_has_audio(hd-cfg));
+   WARN_ON(!hd-display_enabled);
+
+   hdmi4_audio_stop(hd-core, hd-wp);
+   hdmi_wp_audio_enable(hd-wp, false);
+}
+
+static int hdmi_audio_config(struct device *dev,
+struct omap_dss_audio *dss_audio)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+   int ret;
+
+   mutex_lock(hd-lock);
+
+   if (!hdmi_mode_has_audio(hd-cfg) || !hd-display_enabled) {
+   ret = -EPERM;
+   goto out;
+   }
+
+   ret = hdmi4_audio_config(hd-core, hd-wp, dss_audio,
+hd-cfg.timings.pixelclock);
+
+out:
+   mutex_unlock(hd-lock);
+
+   return ret;
+}
+
+static const struct omap_hdmi_audio_ops hdmi_audio_ops = {
+   .audio_startup = hdmi_audio_startup,
+   .audio_shutdown = hdmi_audio_shutdown,
+   .audio_start = hdmi_audio_start,
+   .audio_stop = hdmi_audio_stop,
+   .audio_config = hdmi_audio_config,
+};
+
+static int hdmi_audio_register(struct device *dev)
+{
+   struct omap_hdmi_audio_pdata pdata = {
+   .dev = dev,
+   .dss_version = omapdss_get_version(),
+   .audio_dma_addr = hdmi_wp_get_audio_dma_addr(hdmi.wp),
+   .ops = hdmi_audio_ops,
+   };
+
+   hdmi.audio_pdev = platform_device_register_data(
+   dev, omap-hdmi-audio, PLATFORM_DEVID_AUTO,
+   pdata, sizeof(pdata));
+
+   if (IS_ERR(hdmi.audio_pdev))
+   return PTR_ERR(hdmi.audio_pdev);
+
+   return 0;
+}
+
 /* HDMI HW IP initialisation */
 static int omapdss_hdmihw_probe(struct platform_device *pdev)
 {
@@ -599,6 +713,14 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 
hdmi_init_output(pdev);
 
+   r = hdmi_audio_register(pdev-dev);
+   if (r) {
+   DSSERR(Registering HDMI audio failed\n);
+   hdmi_uninit_output(pdev);
+   pm_runtime_disable(pdev-dev);
+   return r;
+   }
+
dss_debugfs_create_file(hdmi, hdmi_dump_regs);
 
return 0;
@@ -606,6 +728,9 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 
 static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
 {
+   if (hdmi.audio_pdev)
+   platform_device_unregister(hdmi.audio_pdev);
+
hdmi_uninit_output(pdev);
 
pm_runtime_disable(pdev-dev);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to 

[PATCH v7.1 15/19] OMAPDSS: hdmi5: Remove callbacks for the old ASoC DAI driver

2014-11-12 Thread Jyri Sarha
Removes the OMAP5 HDMI audio callbacks for the old external DAI driver.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi5.c |  113 -
 1 file changed, 113 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c 
b/drivers/video/fbdev/omap2/dss/hdmi5.c
index 694cdee..1b9c86a 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -492,112 +492,6 @@ static int hdmi_read_edid(struct omap_dss_device *dssdev,
return r;
 }
 
-#if defined(CONFIG_OMAP5_DSS_HDMI_AUDIO)
-static int hdmi_audio_enable(struct omap_dss_device *dssdev)
-{
-   int r;
-
-   mutex_lock(hdmi.lock);
-
-   if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
-   r = -EPERM;
-   goto err;
-   }
-
-   r = hdmi_wp_audio_enable(hdmi.wp, true);
-   if (r)
-   goto err;
-
-   mutex_unlock(hdmi.lock);
-   return 0;
-
-err:
-   mutex_unlock(hdmi.lock);
-   return r;
-}
-
-static void hdmi_audio_disable(struct omap_dss_device *dssdev)
-{
-   hdmi_wp_audio_enable(hdmi.wp, false);
-}
-
-static int hdmi_audio_start(struct omap_dss_device *dssdev)
-{
-   return hdmi_wp_audio_core_req_enable(hdmi.wp, true);
-}
-
-static void hdmi_audio_stop(struct omap_dss_device *dssdev)
-{
-   hdmi_wp_audio_core_req_enable(hdmi.wp, false);
-}
-
-static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
-{
-   bool r;
-
-   mutex_lock(hdmi.lock);
-
-   r = hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode);
-
-   mutex_unlock(hdmi.lock);
-   return r;
-}
-
-static int hdmi_audio_config(struct omap_dss_device *dssdev,
-   struct omap_dss_audio *audio)
-{
-   int r;
-   u32 pclk = hdmi.cfg.timings.pixelclock;
-
-   mutex_lock(hdmi.lock);
-
-   if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
-   r = -EPERM;
-   goto err;
-   }
-
-   r = hdmi5_audio_config(hdmi.core, hdmi.wp, audio, pclk);
-   if (r)
-   goto err;
-
-   mutex_unlock(hdmi.lock);
-   return 0;
-
-err:
-   mutex_unlock(hdmi.lock);
-   return r;
-}
-#else
-static int hdmi_audio_enable(struct omap_dss_device *dssdev)
-{
-   return -EPERM;
-}
-
-static void hdmi_audio_disable(struct omap_dss_device *dssdev)
-{
-}
-
-static int hdmi_audio_start(struct omap_dss_device *dssdev)
-{
-   return -EPERM;
-}
-
-static void hdmi_audio_stop(struct omap_dss_device *dssdev)
-{
-}
-
-static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
-{
-   return false;
-}
-
-static int hdmi_audio_config(struct omap_dss_device *dssdev,
-   struct omap_dss_audio *audio)
-{
-   return -EPERM;
-}
-#endif
-
 static int hdmi_set_infoframe(struct omap_dss_device *dssdev,
const struct hdmi_avi_infoframe *avi)
 {
@@ -626,13 +520,6 @@ static const struct omapdss_hdmi_ops hdmi_ops = {
.read_edid  = hdmi_read_edid,
.set_infoframe  = hdmi_set_infoframe,
.set_hdmi_mode  = hdmi_set_hdmi_mode,
-
-   .audio_enable   = hdmi_audio_enable,
-   .audio_disable  = hdmi_audio_disable,
-   .audio_start= hdmi_audio_start,
-   .audio_stop = hdmi_audio_stop,
-   .audio_supported= hdmi_audio_supported,
-   .audio_config   = hdmi_audio_config,
 };
 
 static void hdmi_init_output(struct platform_device *pdev)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 19/19] OMAPDSS: hdmi5: Change hdmi_wp idlemode to to no_idle for audio playback

2014-11-12 Thread Jyri Sarha
Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h  |1 +
 drivers/video/fbdev/omap2/dss/hdmi5.c |7 +++
 2 files changed, 8 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index bfaaf2f..f991dbf 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -372,6 +372,7 @@ struct omap_hdmi {
 
struct platform_device *audio_pdev;
void (*audio_abort_cb)(struct device *dev);
+   int wp_idlemode;
 };
 
 #endif
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c 
b/drivers/video/fbdev/omap2/dss/hdmi5.c
index feb76e2..c91685e 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -614,6 +614,10 @@ static int hdmi_audio_start(struct device *dev)
WARN_ON(!hdmi_mode_has_audio(hd-cfg));
WARN_ON(!hd-display_enabled);
 
+   /* No-idle while playing audio, store the old value */
+   hd-wp_idlemode = REG_GET(hdmi.wp.base, HDMI_WP_SYSCONFIG, 3, 2);
+   REG_FLD_MOD(hdmi.wp.base, HDMI_WP_SYSCONFIG, 1, 3, 2);
+
hdmi_wp_audio_enable(hd-wp, true);
hdmi_wp_audio_core_req_enable(hd-wp, true);
 
@@ -629,6 +633,9 @@ static void hdmi_audio_stop(struct device *dev)
 
hdmi_wp_audio_core_req_enable(hd-wp, false);
hdmi_wp_audio_enable(hd-wp, false);
+
+   /* Playback stopped, restore original idlemode */
+   REG_FLD_MOD(hdmi.wp.base, HDMI_WP_SYSCONFIG, hd-wp_idlemode, 3, 2);
 }
 
 static int hdmi_audio_config(struct device *dev,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 18/19] OMAPDSS: Remove all references to obsolete HDMI audio callbacks

2014-11-12 Thread Jyri Sarha
In new model these callbacks are obsolete since the ASoC component
drivers are integrated into the HDMI drivers and no callbacks are
needed anymore.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 .../fbdev/omap2/displays-new/connector-hdmi.c  |   99 
 .../fbdev/omap2/displays-new/encoder-tpd12s015.c   |   56 ---
 include/video/omapdss.h|   40 
 3 files changed, 195 deletions(-)

diff --git a/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c 
b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c
index 7b25967..219f14f 100644
--- a/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c
+++ b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c
@@ -170,98 +170,6 @@ static bool hdmic_detect(struct omap_dss_device *dssdev)
return in-ops.hdmi-detect(in);
 }
 
-static int hdmic_audio_enable(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-   int r;
-
-   /* enable audio only if the display is active */
-   if (!omapdss_device_is_enabled(dssdev))
-   return -EPERM;
-
-   r = in-ops.hdmi-audio_enable(in);
-   if (r)
-   return r;
-
-   dssdev-audio_state = OMAP_DSS_AUDIO_ENABLED;
-
-   return 0;
-}
-
-static void hdmic_audio_disable(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-
-   in-ops.hdmi-audio_disable(in);
-
-   dssdev-audio_state = OMAP_DSS_AUDIO_DISABLED;
-}
-
-static int hdmic_audio_start(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-   int r;
-
-   /*
-* No need to check the panel state. It was checked when trasitioning
-* to AUDIO_ENABLED.
-*/
-   if (dssdev-audio_state != OMAP_DSS_AUDIO_ENABLED)
-   return -EPERM;
-
-   r = in-ops.hdmi-audio_start(in);
-   if (r)
-   return r;
-
-   dssdev-audio_state = OMAP_DSS_AUDIO_PLAYING;
-
-   return 0;
-}
-
-static void hdmic_audio_stop(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-
-   in-ops.hdmi-audio_stop(in);
-
-   dssdev-audio_state = OMAP_DSS_AUDIO_ENABLED;
-}
-
-static bool hdmic_audio_supported(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-
-   if (!omapdss_device_is_enabled(dssdev))
-   return false;
-
-   return in-ops.hdmi-audio_supported(in);
-}
-
-static int hdmic_audio_config(struct omap_dss_device *dssdev,
-   struct omap_dss_audio *audio)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-   int r;
-
-   /* config audio only if the display is active */
-   if (!omapdss_device_is_enabled(dssdev))
-   return -EPERM;
-
-   r = in-ops.hdmi-audio_config(in, audio);
-   if (r)
-   return r;
-
-   dssdev-audio_state = OMAP_DSS_AUDIO_CONFIGURED;
-
-   return 0;
-}
-
 static int hdmic_set_hdmi_mode(struct omap_dss_device *dssdev, bool hdmi_mode)
 {
struct panel_drv_data *ddata = to_panel_data(dssdev);
@@ -296,13 +204,6 @@ static struct omap_dss_driver hdmic_driver = {
.detect = hdmic_detect,
.set_hdmi_mode  = hdmic_set_hdmi_mode,
.set_hdmi_infoframe = hdmic_set_infoframe,
-
-   .audio_enable   = hdmic_audio_enable,
-   .audio_disable  = hdmic_audio_disable,
-   .audio_start= hdmic_audio_start,
-   .audio_stop = hdmic_audio_stop,
-   .audio_supported= hdmic_audio_supported,
-   .audio_config   = hdmic_audio_config,
 };
 
 static int hdmic_probe_pdata(struct platform_device *pdev)
diff --git a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c 
b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
index c4abd56..6fc8b9d 100644
--- a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
+++ b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
@@ -193,55 +193,6 @@ static bool tpd_detect(struct omap_dss_device *dssdev)
return gpio_get_value_cansleep(ddata-hpd_gpio);
 }
 
-static int tpd_audio_enable(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-
-   return in-ops.hdmi-audio_enable(in);
-}
-
-static void tpd_audio_disable(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   struct omap_dss_device *in = ddata-in;
-
-   in-ops.hdmi-audio_disable(in);
-}
-
-static int 

[PATCH v7.1 16/19] OMAPDSS: hdmi5: Register ASoC platform device for omap hdmi audio

2014-11-12 Thread Jyri Sarha
Implements callbacks for OMAP HDMI audio platform driver and registers
it in probe function. Unregistering is done in remove function.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi5.c |  125 +
 1 file changed, 125 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c 
b/drivers/video/fbdev/omap2/dss/hdmi5.c
index 1b9c86a..feb76e2 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -38,6 +38,7 @@
 #include linux/gpio.h
 #include linux/regulator/consumer.h
 #include video/omapdss.h
+#include sound/omap-hdmi-audio.h
 
 #include hdmi5_core.h
 #include dss.h
@@ -360,6 +361,8 @@ static int hdmi_display_enable(struct omap_dss_device 
*dssdev)
goto err0;
}
 
+   hdmi.display_enabled = true;
+
mutex_unlock(hdmi.lock);
return 0;
 
@@ -374,8 +377,13 @@ static void hdmi_display_disable(struct omap_dss_device 
*dssdev)
 
mutex_lock(hdmi.lock);
 
+   if (hdmi.audio_pdev  hdmi.audio_abort_cb)
+   hdmi.audio_abort_cb(hdmi.audio_pdev-dev);
+
hdmi_power_off_full(dssdev);
 
+   hdmi.display_enabled = false;
+
mutex_unlock(hdmi.lock);
 }
 
@@ -566,6 +574,112 @@ err:
return r;
 }
 
+/* Audio callbacks */
+static int hdmi_audio_startup(struct device *dev,
+ void (*abort_cb)(struct device *dev))
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+   int ret = 0;
+
+   mutex_lock(hd-lock);
+
+   if (!hdmi_mode_has_audio(hd-cfg) || !hd-display_enabled) {
+   ret = -EPERM;
+   goto out;
+   }
+
+   hd-audio_abort_cb = abort_cb;
+
+out:
+   mutex_unlock(hd-lock);
+
+   return ret;
+}
+
+static int hdmi_audio_shutdown(struct device *dev)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+
+   mutex_lock(hd-lock);
+   hd-audio_abort_cb = NULL;
+   mutex_unlock(hd-lock);
+
+   return 0;
+}
+
+static int hdmi_audio_start(struct device *dev)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+
+   WARN_ON(!hdmi_mode_has_audio(hd-cfg));
+   WARN_ON(!hd-display_enabled);
+
+   hdmi_wp_audio_enable(hd-wp, true);
+   hdmi_wp_audio_core_req_enable(hd-wp, true);
+
+   return 0;
+}
+
+static void hdmi_audio_stop(struct device *dev)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+
+   WARN_ON(!hdmi_mode_has_audio(hd-cfg));
+   WARN_ON(!hd-display_enabled);
+
+   hdmi_wp_audio_core_req_enable(hd-wp, false);
+   hdmi_wp_audio_enable(hd-wp, false);
+}
+
+static int hdmi_audio_config(struct device *dev,
+struct omap_dss_audio *dss_audio)
+{
+   struct omap_hdmi *hd = dev_get_drvdata(dev);
+   int ret;
+
+   mutex_lock(hd-lock);
+
+   if (!hdmi_mode_has_audio(hd-cfg) || !hd-display_enabled) {
+   ret = -EPERM;
+   goto out;
+   }
+
+   ret = hdmi5_audio_config(hd-core, hd-wp, dss_audio,
+hd-cfg.timings.pixelclock);
+
+out:
+   mutex_unlock(hd-lock);
+
+   return ret;
+}
+
+static const struct omap_hdmi_audio_ops hdmi_audio_ops = {
+   .audio_startup = hdmi_audio_startup,
+   .audio_shutdown = hdmi_audio_shutdown,
+   .audio_start = hdmi_audio_start,
+   .audio_stop = hdmi_audio_stop,
+   .audio_config = hdmi_audio_config,
+};
+
+static int hdmi_audio_register(struct device *dev)
+{
+   struct omap_hdmi_audio_pdata pdata = {
+   .dev = dev,
+   .dss_version = omapdss_get_version(),
+   .audio_dma_addr = hdmi_wp_get_audio_dma_addr(hdmi.wp),
+   .ops = hdmi_audio_ops,
+   };
+
+   hdmi.audio_pdev = platform_device_register_data(
+   dev, omap-hdmi-audio, PLATFORM_DEVID_AUTO,
+   pdata, sizeof(pdata));
+
+   if (IS_ERR(hdmi.audio_pdev))
+   return PTR_ERR(hdmi.audio_pdev);
+
+   return 0;
+}
+
 /* HDMI HW IP initialisation */
 static int omapdss_hdmihw_probe(struct platform_device *pdev)
 {
@@ -623,6 +737,14 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 
hdmi_init_output(pdev);
 
+   r = hdmi_audio_register(pdev-dev);
+   if (r) {
+   DSSERR(Registering HDMI audio failed %d\n, r);
+   hdmi_uninit_output(pdev);
+   pm_runtime_disable(pdev-dev);
+   return r;
+   }
+
dss_debugfs_create_file(hdmi, hdmi_dump_regs);
 
return 0;
@@ -630,6 +752,9 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 
 static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
 {
+   if (hdmi.audio_pdev)
+   platform_device_unregister(hdmi.audio_pdev);
+
hdmi_uninit_output(pdev);
 
pm_runtime_disable(pdev-dev);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a 

[PATCH v7.1 09/19] ASoC: omap-hdmi-audio: Add platform device for OMAP HDMI audio support

2014-11-12 Thread Jyri Sarha
The platform device should only be registered from OMAPDSS HDMI
driver. The platform driver registers and unregisters all ASoC
components needed for OMAP HDMI audio.

The hdmi audio driver implements cpu-dai component using the callbacks
provided by OMAPDSS and registers the component under DSS HDMI
device. Omap-pcm is registered for platform component also under DSS
HDMI device. Dummy codec is used as as codec component. The hdmi audio
driver implements also the card and registers it under its own
platform device.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 include/sound/omap-hdmi-audio.h  |   43 
 sound/soc/omap/Kconfig   |   15 ++
 sound/soc/omap/Makefile  |2 +
 sound/soc/omap/omap-hdmi-audio.c |  407 ++
 4 files changed, 467 insertions(+)
 create mode 100644 include/sound/omap-hdmi-audio.h
 create mode 100644 sound/soc/omap/omap-hdmi-audio.c

diff --git a/include/sound/omap-hdmi-audio.h b/include/sound/omap-hdmi-audio.h
new file mode 100644
index 000..afdb416
--- /dev/null
+++ b/include/sound/omap-hdmi-audio.h
@@ -0,0 +1,43 @@
+/*
+ * hdmi-audio.c -- OMAP4+ DSS HDMI audio support library
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Author: Jyri Sarha jsa...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#include video/omapdss.h
+
+#ifndef __OMAP_HDMI_AUDIO_H__
+#define __OMAP_HDMI_AUDIO_H__
+
+struct omap_hdmi_audio_ops {
+   int (*audio_startup)(struct device *dev,
+void (*abort_cb)(struct device *dev));
+   int (*audio_shutdown)(struct device *dev);
+   int (*audio_start)(struct device *dev);
+   void (*audio_stop)(struct device *dev);
+   int (*audio_config)(struct device *dev,
+   struct omap_dss_audio *dss_audio);
+};
+
+/* HDMI audio initalization data */
+struct omap_hdmi_audio_pdata {
+   struct device *dev;
+   enum omapdss_version dss_version;
+   phys_addr_t audio_dma_addr;
+
+   const struct omap_hdmi_audio_ops *ops;
+};
+
+#endif /* __OMAP_HDMI_AUDIO_H__ */
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index d44463a..2b32b3e 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -15,6 +15,21 @@ config SND_OMAP_SOC_MCPDM
 config SND_OMAP_SOC_HDMI
tristate
 
+config SND_OMAP_SOC_HDMI_AUDIO
+   tristate HDMI audio support for OMAP4+ based SoCs
+   depends on SND_OMAP_SOC
+   help
+ For HDMI audio to work OMAPDSS HDMI support should be
+ enabled.
+ The hdmi audio driver implements cpu-dai component using the
+ callbacks provided by OMAPDSS and registers the component
+ under DSS HDMI device. Omap-pcm is registered for platform
+ component also under DSS HDMI device. Dummy codec is used as
+ as codec component. The hdmi audio driver implements also
+ the card and registers it under its own platform device.
+ The device for the dirver is registered by OMAPDSS hdmi
+ driver.
+
 config SND_OMAP_SOC_N810
tristate SoC Audio support for Nokia N810
depends on SND_OMAP_SOC  MACH_NOKIA_N810  I2C
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index a725905..40688a6 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -4,12 +4,14 @@ snd-soc-omap-dmic-objs := omap-dmic.o
 snd-soc-omap-mcbsp-objs := omap-mcbsp.o mcbsp.o
 snd-soc-omap-mcpdm-objs := omap-mcpdm.o
 snd-soc-omap-hdmi-objs := omap-hdmi.o
+snd-soc-omap-hdmi-audio-objs := omap-hdmi-audio.o
 
 obj-$(CONFIG_SND_OMAP_SOC) += snd-soc-omap.o
 obj-$(CONFIG_SND_OMAP_SOC_DMIC) += snd-soc-omap-dmic.o
 obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o
 obj-$(CONFIG_SND_OMAP_SOC_MCPDM) += snd-soc-omap-mcpdm.o
 obj-$(CONFIG_SND_OMAP_SOC_HDMI) += snd-soc-omap-hdmi.o
+obj-$(CONFIG_SND_OMAP_SOC_HDMI_AUDIO) += snd-soc-omap-hdmi-audio.o
 
 # OMAP Machine Support
 snd-soc-n810-objs := n810.o
diff --git a/sound/soc/omap/omap-hdmi-audio.c b/sound/soc/omap/omap-hdmi-audio.c
new file mode 100644
index 000..3f9ac7d
--- /dev/null
+++ b/sound/soc/omap/omap-hdmi-audio.c
@@ -0,0 +1,407 @@
+/*
+ * omap-hdmi-audio.c -- OMAP4+ DSS HDMI audio support library
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Author: Jyri Sarha jsa...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is 

[PATCH v7.1 17/19] ASoC: omap: Remove obsolete HDMI audio code and Kconfig options

2014-11-12 Thread Jyri Sarha
Removes omap-hdmi DAI driver, omap-hdmi-card driver, the related
Kconfig options, and Makefile entries. The HDMI DAI drivers has been
integrated directly to OMAP4+ HDMI drivers and simple-card driver is
used instead of omap-hdmi-card driver.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 sound/soc/omap/Kconfig  |   13 --
 sound/soc/omap/Makefile |4 -
 sound/soc/omap/omap-hdmi-card.c |   87 --
 sound/soc/omap/omap-hdmi.c  |  364 ---
 sound/soc/omap/omap-hdmi.h  |   38 
 5 files changed, 506 deletions(-)
 delete mode 100644 sound/soc/omap/omap-hdmi-card.c
 delete mode 100644 sound/soc/omap/omap-hdmi.c
 delete mode 100644 sound/soc/omap/omap-hdmi.h

diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 2b32b3e..3dfcadf 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -12,9 +12,6 @@ config SND_OMAP_SOC_MCBSP
 config SND_OMAP_SOC_MCPDM
tristate
 
-config SND_OMAP_SOC_HDMI
-   tristate
-
 config SND_OMAP_SOC_HDMI_AUDIO
tristate HDMI audio support for OMAP4+ based SoCs
depends on SND_OMAP_SOC
@@ -115,16 +112,6 @@ config SND_OMAP_SOC_OMAP_ABE_TWL6040
  - PandaBoard (4430)
  - PandaBoardES (4460)
 
-config SND_OMAP_SOC_OMAP_HDMI
-   tristate SoC Audio support for Texas Instruments OMAP HDMI
-   depends on SND_OMAP_SOC  OMAP4_DSS_HDMI  OMAP2_DSS
-   select SND_OMAP_SOC_HDMI
-   select SND_SOC_HDMI_CODEC
-   select OMAP4_DSS_HDMI_AUDIO
-   help
- Say Y if you want to add support for SoC HDMI audio on Texas 
Instruments
- OMAP4 chips
-
 config SND_OMAP_SOC_OMAP3_PANDORA
tristate SoC Audio support for OMAP3 Pandora
depends on TWL4030_CORE  SND_OMAP_SOC  MACH_OMAP3_PANDORA
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 40688a6..db36fbd 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -3,14 +3,12 @@ snd-soc-omap-objs := omap-pcm.o
 snd-soc-omap-dmic-objs := omap-dmic.o
 snd-soc-omap-mcbsp-objs := omap-mcbsp.o mcbsp.o
 snd-soc-omap-mcpdm-objs := omap-mcpdm.o
-snd-soc-omap-hdmi-objs := omap-hdmi.o
 snd-soc-omap-hdmi-audio-objs := omap-hdmi-audio.o
 
 obj-$(CONFIG_SND_OMAP_SOC) += snd-soc-omap.o
 obj-$(CONFIG_SND_OMAP_SOC_DMIC) += snd-soc-omap-dmic.o
 obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o
 obj-$(CONFIG_SND_OMAP_SOC_MCPDM) += snd-soc-omap-mcpdm.o
-obj-$(CONFIG_SND_OMAP_SOC_HDMI) += snd-soc-omap-hdmi.o
 obj-$(CONFIG_SND_OMAP_SOC_HDMI_AUDIO) += snd-soc-omap-hdmi-audio.o
 
 # OMAP Machine Support
@@ -22,7 +20,6 @@ snd-soc-am3517evm-objs := am3517evm.o
 snd-soc-omap-abe-twl6040-objs := omap-abe-twl6040.o
 snd-soc-omap-twl4030-objs := omap-twl4030.o
 snd-soc-omap3pandora-objs := omap3pandora.o
-snd-soc-omap-hdmi-card-objs := omap-hdmi-card.o
 
 obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
 obj-$(CONFIG_SND_OMAP_SOC_RX51) += snd-soc-rx51.o
@@ -32,4 +29,3 @@ obj-$(CONFIG_SND_OMAP_SOC_AM3517EVM) += snd-soc-am3517evm.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040) += snd-soc-omap-abe-twl6040.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP_TWL4030) += snd-soc-omap-twl4030.o
 obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
-obj-$(CONFIG_SND_OMAP_SOC_OMAP_HDMI) += snd-soc-omap-hdmi-card.o
diff --git a/sound/soc/omap/omap-hdmi-card.c b/sound/soc/omap/omap-hdmi-card.c
deleted file mode 100644
index f649fe8..000
--- a/sound/soc/omap/omap-hdmi-card.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * omap-hdmi-card.c
- *
- * OMAP ALSA SoC machine driver for TI OMAP HDMI
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- * Author: Ricardo Neri ricardo.n...@ti.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include linux/module.h
-#include sound/pcm.h
-#include sound/soc.h
-#include asm/mach-types.h
-#include video/omapdss.h
-
-#define DRV_NAME omap-hdmi-audio
-
-static struct snd_soc_dai_link omap_hdmi_dai = {
-   .name = HDMI,
-   .stream_name = HDMI,
-   .cpu_dai_name = omap-hdmi-audio-dai,
-   .platform_name = omap-hdmi-audio-dai,
-   .codec_name = hdmi-audio-codec,
-   .codec_dai_name = hdmi-hifi,
-};
-
-static struct snd_soc_card snd_soc_omap_hdmi = {
-   .name = OMAPHDMI,
-   .owner = THIS_MODULE,
-   .dai_link = omap_hdmi_dai,
-   .num_links = 1,
-};
-
-static int 

[PATCH v7.1 11/19] OMAPDSS: hdmi: Make hdmi_mode_has_audio() more user friedly

2014-11-12 Thread Jyri Sarha
Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h 
b/drivers/video/fbdev/omap2/dss/hdmi.h
index a6e08ff..6d129f2 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -345,9 +345,9 @@ void hdmi_wp_audio_config_format(struct hdmi_wp_data *wp,
struct hdmi_audio_format *aud_fmt);
 void hdmi_wp_audio_config_dma(struct hdmi_wp_data *wp,
struct hdmi_audio_dma *aud_dma);
-static inline bool hdmi_mode_has_audio(int mode)
+static inline bool hdmi_mode_has_audio(struct hdmi_config *cfg)
 {
-   return mode == HDMI_HDMI ? true : false;
+   return cfg-hdmi_dvi_mode == HDMI_HDMI ? true : false;
 }
 
 /* HDMI DRV data */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 10/19] OMAPDSS: Kconfig: Remove HDMI audio booleans from Kconfig

2014-11-12 Thread Jyri Sarha
The booleans are not used anymore. Just select SND_OMAP_SOC_HDMI_AUDIO
to enable OMAP HDMI audio support.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/Kconfig |7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/Kconfig 
b/drivers/video/fbdev/omap2/dss/Kconfig
index 3d5eb6c..d1fa730 100644
--- a/drivers/video/fbdev/omap2/dss/Kconfig
+++ b/drivers/video/fbdev/omap2/dss/Kconfig
@@ -74,9 +74,6 @@ config OMAP4_DSS_HDMI
help
  HDMI support for OMAP4 based SoCs.
 
-config OMAP4_DSS_HDMI_AUDIO
-   bool
-
 config OMAP5_DSS_HDMI
bool HDMI support for OMAP5
default n
@@ -86,10 +83,6 @@ config OMAP5_DSS_HDMI
  Definition Multimedia Interface. See http://www.hdmi.org/ for HDMI
  specification.
 
-config OMAP5_DSS_HDMI_AUDIO
-   depends on OMAP5_DSS_HDMI
-   bool
-
 config OMAP2_DSS_SDI
bool SDI support
 default n
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 02/19] OMAPDSS: hdmi5_core: Initialize mandatory sample_order parameter

2014-11-12 Thread Jyri Sarha
The hdmi_wp_audio_config_format() expects sample_order of struct
hdmi_audio_format to be initialized. The only allowed value is
HDMI_AUDIO_SAMPLE_LEFT_FIRST.

Signed-off-by: Jyri Sarha jsa...@ti.com
---
 drivers/video/fbdev/omap2/dss/hdmi5_core.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/video/fbdev/omap2/dss/hdmi5_core.c 
b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
index 83acbf7..9ffa805 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
@@ -879,6 +879,9 @@ int hdmi5_audio_config(struct hdmi_core_data *core, struct 
hdmi_wp_data *wp,
/* only LPCM atm */
audio_format.type = HDMI_AUDIO_TYPE_LPCM;
 
+   /* only allowed option */
+   audio_format.sample_order = HDMI_AUDIO_SAMPLE_LEFT_FIRST;
+
/* disable start/stop signals of IEC 60958 blocks */
audio_format.en_sig_blk_strt_end = HDMI_AUDIO_BLOCK_SIG_STARTEND_ON;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7.1 00/19] Rework OMAP4+ HDMI audio support

2014-11-12 Thread Jyri Sarha
The patches are based on:
git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git for-next

The base, the patches, and couple of additional not-to-be-merged
omap2plus_defconfig patches can be found here:
https://github.com/jsarha/linux.git omap-hdmi-audio

It would make the most sense to get these in trough fbdev tree. So it
would be nice to get acked-bys (if the patches are Ok) for ASoC side
changes from appropriate maintainers.

Changes since v7:
- Squash: 
  - OMAPDSS: omapdss.h: Remove audio_state member of struct omap_dss_device
  - into OMAPDSS: Remove all references to obsolete HDMI audio callbacks

Changes since v6:
- ASoC: omap-hdmi-audio: Add platform device for OMAP HDMI audio support
  - Fix Kconfig help text
  - Remove #include sound/simple_card.h
  - Use snd-soc-dummy codec instead of hdmi-audio-codec
- Add: OMAPDSS: hdmi_wp: Protect reserved bits in hdmi_wp_audio_config_format()
- Add: OMAPDSS: hdmi5_core: Initialize mandatory sample_order parameter
- Add: OMAPDSS: omapdss.h: Remove audio_state member of struct omap_dss_device
- OMAPDSS: hdmi4: Register ASoC platform device for omap hdmi audio
  - Register omap-hdmi-audio with PLATFORM_DEVID_AUTO
- OMAPDSS: hdmi5: Register ASoC platform device for omap hdmi audio
  - Register omap-hdmi-audio with PLATFORM_DEVID_AUTO
- Add: OMAPDSS: hdmi5: Change hdmi_wp idlemode to to no_idle for audio 
playback

Jyri Sarha (19):
  OMAPDSS: hdmi_wp: Protect reserved bits in
hdmi_wp_audio_config_format()
  OMAPDSS: hdmi5_core: Initialize mandatory sample_order parameter
  OMAPDSS: hdmi.h: Add HDMI_AUDIO_LAYOUT_6CH enum value
  OMAPDSS: hdmi: Remove most of OMAP[45]_DSS_HDMI_AUDIO ifdefs
  OMAPDSS: hdmi4_core: Remove unused hdmi4_audio_get_dma_port()
  OMAPDSS: hdmi_wp: Add function for getting audio dma address
  OMAPDSS: hdmi: Make hdmi structure public
  OMAPDSS: hdmi: Add pdev pointer for audio_pdev in HDMI DRV data
  ASoC: omap-hdmi-audio: Add platform device for OMAP HDMI audio
support
  OMAPDSS: Kconfig: Remove HDMI audio booleans from Kconfig
  OMAPDSS: hdmi: Make hdmi_mode_has_audio() more user friedly
  OMAPDSS: hdmi.h: Add members to hdmi drvdata for audio implementation
  OMAPDSS: hdmi4: Remove callbacks for the old ASoC DAI driver
  OMAPDSS: hdmi4: Register ASoC platform device for omap hdmi audio
  OMAPDSS: hdmi5: Remove callbacks for the old ASoC DAI driver
  OMAPDSS: hdmi5: Register ASoC platform device for omap hdmi audio
  ASoC: omap: Remove obsolete HDMI audio code and Kconfig options
  OMAPDSS: Remove all references to obsolete HDMI audio callbacks
  OMAPDSS: hdmi5: Change hdmi_wp idlemode to to no_idle for audio
playback

 .../fbdev/omap2/displays-new/connector-hdmi.c  |   99 -
 .../fbdev/omap2/displays-new/encoder-tpd12s015.c   |   56 ---
 drivers/video/fbdev/omap2/dss/Kconfig  |7 -
 drivers/video/fbdev/omap2/dss/hdmi.h   |   38 +-
 drivers/video/fbdev/omap2/dss/hdmi4.c  |  269 +++--
 drivers/video/fbdev/omap2/dss/hdmi4_core.c |   14 -
 drivers/video/fbdev/omap2/dss/hdmi4_core.h |4 -
 drivers/video/fbdev/omap2/dss/hdmi5.c  |  265 ++---
 drivers/video/fbdev/omap2/dss/hdmi5_core.c |9 +-
 drivers/video/fbdev/omap2/dss/hdmi5_core.h |2 -
 drivers/video/fbdev/omap2/dss/hdmi_common.c|2 -
 drivers/video/fbdev/omap2/dss/hdmi_wp.c|   16 +-
 include/sound/omap-hdmi-audio.h|   43 +++
 include/video/omapdss.h|   40 --
 sound/soc/omap/Kconfig |   26 +-
 sound/soc/omap/Makefile|6 +-
 sound/soc/omap/omap-hdmi-audio.c   |  407 
 sound/soc/omap/omap-hdmi-card.c|   87 -
 sound/soc/omap/omap-hdmi.c |  364 -
 sound/soc/omap/omap-hdmi.h |   38 --
 20 files changed, 781 insertions(+), 1011 deletions(-)
 create mode 100644 include/sound/omap-hdmi-audio.h
 create mode 100644 sound/soc/omap/omap-hdmi-audio.c
 delete mode 100644 sound/soc/omap/omap-hdmi-card.c
 delete mode 100644 sound/soc/omap/omap-hdmi.c
 delete mode 100644 sound/soc/omap/omap-hdmi.h

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: dwc3: gadget: Fix broken gadget on system suspend/resume

2014-11-12 Thread Roger Quadros
On TI SoCs (e.g. DRA7) we don't support the DWC3 hibernation feature.
We need to stop the gadget controller while system suspend
else it results in L3 Bus errors on resume with broken
USB gadget on J6-evm.

[   55.718226] WARNING: CPU: 0 PID: 0 at drivers/bus/omap_l3_noc.c:147 
l3_interrupt_handler+0x224/0x31c()
[   55.718232] 4400.ocp:L3 Custom Error: MASTER USB3 TARGET GPMC (Idle): 
Data Access in User mode during Functional access
[   55.718263] Modules linked in: usb_f_ss_lb g_zero libcomposite configfs 
xhci_hcd btwilink bluetooth dwc3 6lowpan_iphc m25p80 dwc3_omap omap_remoteproc
[   55.718271] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
3.14.19-02011-g3ece3ca-dirty #658
[   55.718290] [c0016090] (unwind_backtrace) from [c0012060] 
(show_stack+0x10/0x14)
[   55.718302] [c0012060] (show_stack) from [c062a2e4] 
(dump_stack+0x78/0x94)
[   55.718315] [c062a2e4] (dump_stack) from [c0043bc4] 
(warn_slowpath_common+0x6c/0x90)
[   55.718325] [c0043bc4] (warn_slowpath_common) from [c0043c7c] 
(warn_slowpath_fmt+0x30/0x40)
[   55.718336] [c0043c7c] (warn_slowpath_fmt) from [c030fb24] 
(l3_interrupt_handler+0x224/0x31c)
[   55.718348] [c030fb24] (l3_interrupt_handler) from [c0093010] 
(handle_irq_event_percpu+0x5c/0x23c)
[   55.718358] [c0093010] (handle_irq_event_percpu) from [c009322c] 
(handle_irq_event+0x3c/0x5c)
[   55.718367] [c009322c] (handle_irq_event) from [c0096160] 
(handle_fasteoi_irq+0x98/0x158)
[   55.718377] [c0096160] (handle_fasteoi_irq) from [c00929dc] 
(generic_handle_irq+0x20/0x30)
[   55.718385] [c00929dc] (generic_handle_irq) from [c000eea8] 
(handle_IRQ+0x4c/0xb0)
[   55.718393] [c000eea8] (handle_IRQ) from [c0008638] 
(gic_handle_irq+0x28/0x5c)
[   55.718402] [c0008638] (gic_handle_irq) from [c0630964] 
(__irq_svc+0x44/0x5c)
[   55.718406] Exception stack(0xc09c1f68 to 0xc09c1fb0)
[   55.718412] 1f60:   0001 0001   
c09c 
[   55.718418] 1f80: c09c c09c c0a7a1e4 c09c8938 c09c89b4  
6093 c09c1fb0
[   55.718423] 1fa0: c008a2e4 c00926cc 6013 
[   55.718433] [c0630964] (__irq_svc) from [c00926cc] 
(cpu_startup_entry+0x100/0x1f4)
[   55.718444] [c00926cc] (cpu_startup_entry) from [c0901ac4] 
(start_kernel+0x324/0x388)

Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/usb/dwc3/gadget.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 3818b26..bc15b54 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2741,7 +2741,13 @@ int dwc3_gadget_prepare(struct dwc3 *dwc)
 {
if (dwc-pullups_connected) {
dwc3_gadget_disable_irq(dwc);
-   dwc3_gadget_run_stop(dwc, true, true);
+   if (dwc-has_hibernation) {
+   dwc3_gadget_run_stop(dwc, true, true);
+   } else {
+   dwc3_gadget_run_stop(dwc, false, true);
+   /* remember to connect back on resume */
+   dwc-pullups_connected = true;
+   }
}
 
return 0;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] arm: dts: omap3-gta04: Add static configuration for devconf1 register

2014-11-12 Thread Tony Lindgren
* Tomi Valkeinen tomi.valkei...@ti.com [141112 04:56]:
 Hi,
 
 On 03/11/14 23:59, Marek Belisko wrote:
  gta04 board need for tvout enabled 2 bits in devconf1 register (tvbypass 
  and acbias).
  Add single pinmux entry and enable it.
  
  Signed-off-by: Marek Belisko ma...@goldelico.com
  ---
   arch/arm/boot/dts/omap3-gta04.dtsi | 22 ++
   1 file changed, 22 insertions(+)
  
  diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi 
  b/arch/arm/boot/dts/omap3-gta04.dtsi
  index e4d05f0..a456d37 100644
  --- a/arch/arm/boot/dts/omap3-gta04.dtsi
  +++ b/arch/arm/boot/dts/omap3-gta04.dtsi
  @@ -118,6 +118,17 @@
  };
  };
  };
  +
  +   /* pinmux for devconf1 */
  +   control_devconf1: pinmux@480022d8 {
  +   compatible = pinctrl-single;
  +   reg = 0x480022d8 4;   /* single register */
  +   #address-cells = 1;
  +   #size-cells = 0;
  +   pinctrl-single,bit-per-mux;
  +   pinctrl-single,register-width = 32;
  +   pinctrl-single,function-mask = 0xfc0bd5;
  +   };
   };
   
   omap3_pmx_core {
  @@ -497,3 +508,14 @@
  };
  };
   };
  +
  +control_devconf1 {
  +   pinctrl-name = default;
  +   pinctrl-0 =  tv_acbias_pins;
  +
  +   tv_acbias_pins: pinmux_tv_acbias_pins {
  +   pinctrl-single,bits = 
  +   0 0x40800 0x40800
 
 I think it would be good to have a comment in the .dts above, mentioning
 that TVOUTBYPASS and TVACEN bits are being set.
 
  +   ;
  +   };
  +};
  
 
 OMAP3630 seems to have CONTROL_AVDAC1 and CONTROL_AVDAC2 registers. Did
 you check if the SoC you use have those? It looks like they need
 configuration also, if the exist.

Those look like AVDAC specific control registers that are not mux
registers. So those should be accessed the existing SCM (System Control
Mmodule) syscon area by the DSS code. For examples, see what
pbias-regulator.c is doing for some other registers in the syscon area.
 
 So, I don't think tvbypass and acbias are really pinmux stuff, but it
 does seem like an easy way to handle the devconf1 register, and I don't
 see any issues with the setting being fixed.

The CONTROL_DEVCONF registers seem to be all related to muxing signals
and configuring ping signal levels. So I think the pinctrl-single is
OK to use with these.
 
 However, devconf1 register seems to have bits for many devices,
 including mcbsp, mmc, and even some Force MPU writes to be nonposted bit.

Yes theForce MPU writes to be nonposted debug bit is an odd one
there :) But we're not using that luckily anywhere..
 
 And, with a quick grep, I see CONTROL_DEVCONF1 touched in multiple
 places in the kernel. I wonder if adding a pinmux entry for it could
 cause some rather odd problems.

They can all use pinctrl-single no problem.
 
 Tony, any idea about this? How should CONTROL_DEVCONFx registers be
 accessed?

If they are pinctrl related like the CONTROL_DEVCONF registers, then
pincatrl-single is OK. However, for any registers in the SCM that are
not just routing signals, then the syscon mapping should be used. And
we should have a separate driver implementing some standard Linux
generic framework driver. For example a regulator or clock driver.

Anyways, I'll drop this $subject patch for now and set up a new branch
for the .dts changes.

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: dwc3: gadget: Fix broken gadget on system suspend/resume

2014-11-12 Thread Felipe Balbi
On Wed, Nov 12, 2014 at 04:58:16PM +0200, Roger Quadros wrote:
 On TI SoCs (e.g. DRA7) we don't support the DWC3 hibernation feature.
 We need to stop the gadget controller while system suspend
 else it results in L3 Bus errors on resume with broken
 USB gadget on J6-evm.
 
 [   55.718226] WARNING: CPU: 0 PID: 0 at drivers/bus/omap_l3_noc.c:147 
 l3_interrupt_handler+0x224/0x31c()
 [   55.718232] 4400.ocp:L3 Custom Error: MASTER USB3 TARGET GPMC (Idle): 
 Data Access in User mode during Functional access
 [   55.718263] Modules linked in: usb_f_ss_lb g_zero libcomposite configfs 
 xhci_hcd btwilink bluetooth dwc3 6lowpan_iphc m25p80 dwc3_omap omap_remoteproc
 [   55.718271] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
 3.14.19-02011-g3ece3ca-dirty #658
 [   55.718290] [c0016090] (unwind_backtrace) from [c0012060] 
 (show_stack+0x10/0x14)
 [   55.718302] [c0012060] (show_stack) from [c062a2e4] 
 (dump_stack+0x78/0x94)
 [   55.718315] [c062a2e4] (dump_stack) from [c0043bc4] 
 (warn_slowpath_common+0x6c/0x90)
 [   55.718325] [c0043bc4] (warn_slowpath_common) from [c0043c7c] 
 (warn_slowpath_fmt+0x30/0x40)
 [   55.718336] [c0043c7c] (warn_slowpath_fmt) from [c030fb24] 
 (l3_interrupt_handler+0x224/0x31c)
 [   55.718348] [c030fb24] (l3_interrupt_handler) from [c0093010] 
 (handle_irq_event_percpu+0x5c/0x23c)
 [   55.718358] [c0093010] (handle_irq_event_percpu) from [c009322c] 
 (handle_irq_event+0x3c/0x5c)
 [   55.718367] [c009322c] (handle_irq_event) from [c0096160] 
 (handle_fasteoi_irq+0x98/0x158)
 [   55.718377] [c0096160] (handle_fasteoi_irq) from [c00929dc] 
 (generic_handle_irq+0x20/0x30)
 [   55.718385] [c00929dc] (generic_handle_irq) from [c000eea8] 
 (handle_IRQ+0x4c/0xb0)
 [   55.718393] [c000eea8] (handle_IRQ) from [c0008638] 
 (gic_handle_irq+0x28/0x5c)
 [   55.718402] [c0008638] (gic_handle_irq) from [c0630964] 
 (__irq_svc+0x44/0x5c)
 [   55.718406] Exception stack(0xc09c1f68 to 0xc09c1fb0)
 [   55.718412] 1f60:   0001 0001   
 c09c 
 [   55.718418] 1f80: c09c c09c c0a7a1e4 c09c8938 c09c89b4  
 6093 c09c1fb0
 [   55.718423] 1fa0: c008a2e4 c00926cc 6013 
 [   55.718433] [c0630964] (__irq_svc) from [c00926cc] 
 (cpu_startup_entry+0x100/0x1f4)
 [   55.718444] [c00926cc] (cpu_startup_entry) from [c0901ac4] 
 (start_kernel+0x324/0x388)
 
 Signed-off-by: Roger Quadros rog...@ti.com
 ---
  drivers/usb/dwc3/gadget.c | 8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
 index 3818b26..bc15b54 100644
 --- a/drivers/usb/dwc3/gadget.c
 +++ b/drivers/usb/dwc3/gadget.c
 @@ -2741,7 +2741,13 @@ int dwc3_gadget_prepare(struct dwc3 *dwc)

there is no more dwc3_gadget_prepare(), please rebase on 'next'.

  {
   if (dwc-pullups_connected) {
   dwc3_gadget_disable_irq(dwc);
 - dwc3_gadget_run_stop(dwc, true, true);
 + if (dwc-has_hibernation) {
 + dwc3_gadget_run_stop(dwc, true, true);
 + } else {
 + dwc3_gadget_run_stop(dwc, false, true);
 + /* remember to connect back on resume */
 + dwc-pullups_connected = true;
 + }

Another thing you probably want to do is make sure there is nothing
pending on our request list because if there is, then we need to wait
for any in-flight transfers to complete before disconnecting.

I also wonder if current code isn't really fragile... I mean, when you
clear run_stop bit, you should notify the gadget by means of
-disconnect() and so on... But since we can't test this with mainline,
then it's difficult to tell.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCHv6 1/5] Documentation: dt: add common bindings for hwspinlock

2014-11-12 Thread Ohad Ben-Cohen
Hi Suman,

On Fri, Sep 12, 2014 at 11:24 PM, Suman Anna s-a...@ti.com wrote:
 This patch adds the generic common bindings used to represent
 a hwlock device and use/request locks in a device-tree build.

...

 Cc: Rob Herring robh...@kernel.org
 Signed-off-by: Suman Anna s-a...@ti.com
 ---
  .../devicetree/bindings/hwlock/hwlock.txt  | 55 
 ++
  1 file changed, 55 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/hwlock/hwlock.txt

Please ask a DT maintainer to ACK this - otherwise I can't send this to Linus.

Thanks,
Ohad.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv6 2/5] Documentation: dt: add the omap hwspinlock bindings document

2014-11-12 Thread Ohad Ben-Cohen
Hi Suman,

On Fri, Sep 12, 2014 at 11:24 PM, Suman Anna s-a...@ti.com wrote:
 HwSpinlock IP is present only on OMAP4 and other newer SoCs,
 which are all device-tree boot only. This patch adds the
 DT bindings information for OMAP hwspinlock module.

 Cc: Rob Herring robh...@kernel.org
 Signed-off-by: Suman Anna s-a...@ti.com
 ---
  .../devicetree/bindings/hwlock/omap-hwspinlock.txt | 24 
 ++

I need an ACK from a DT maintainer here as well, please try to get it.

Thanks,
Ohad.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/2] bus: omap_l3_noc: Add resume hook to restore mask registers

2014-11-12 Thread Tony Lindgren
* Keerthy j-keer...@ti.com [141110 10:25]:
 l3_noc module loses context during both DS0 and RTC+DDR in self refresh modes.
 This causes the previously masked l3 interrupts to trigger and the software
 book keeping assumes the interrupts are masked and does nothing to mask.
 This software/hardware out of sync leads to back to back l3 interrupts
 and eventually causes a hang. Hence adding resume hook to restore the
 mask registers based on the book keeping variables

Applying both into omap-for-v3.19/drivers-v2 branch thanks.

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: OMAP2+: clock: remove unused function prototype

2014-11-12 Thread Tony Lindgren
* Johan Hovold jo...@kernel.org [14 07:58]:
 Remove unused function prototype that was left by commit 149c09d3a61d
 (ARM: AM33xx: remove old clock data and link in new clock init code)
 which removed the definition.

Applying into omap-for-v3.19/fixes-not-urgent thanks.

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: dts: dra7: fix DSS PLL clock mux registers

2014-11-12 Thread Tony Lindgren
* Tomi Valkeinen tomi.valkei...@ti.com [141013 01:52]:
 The clock nodes for DSS VIDEO1/2 and HDMI have wrong register addresses.
 This patch fixes the addresses so that they point to
 CM_CLKSEL_VIDEO1_PLL_SYS, CM_CLKSEL_VIDEO2_PLL_SYS and
 CM_CLKSEL_HDMI_PLL_SYS.
 
 Reported-by: Somnath Mukherjee somn...@ti.com
 Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com

Applying into omap-for-v3.19/fixes-not-urgent thanks.

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: dts: dra7: fix DSS PLL clock mux registers

2014-11-12 Thread Tony Lindgren
* Tony Lindgren t...@atomide.com [141112 07:26]:
 * Tomi Valkeinen tomi.valkei...@ti.com [141013 01:52]:
  The clock nodes for DSS VIDEO1/2 and HDMI have wrong register addresses.
  This patch fixes the addresses so that they point to
  CM_CLKSEL_VIDEO1_PLL_SYS, CM_CLKSEL_VIDEO2_PLL_SYS and
  CM_CLKSEL_HDMI_PLL_SYS.
  
  Reported-by: Somnath Mukherjee somn...@ti.com
  Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
 
 Applying into omap-for-v3.19/fixes-not-urgent thanks.

Actually this one would be good to have an ack from Tero
as he may need to fix his scripts generating these entries.

So dropping for now.

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: dts: DRA7: wdt: Fix compatible property for watchdog node

2014-11-12 Thread Tony Lindgren
* Lokesh Vutla lokeshvu...@ti.com [14 21:27]:
 OMAP wdt driver supports only ti,omap3-wdt compatible. In DRA7 dt
 wdt compatible property is defined as ti,omap4-wdt by mistake instead of
 ti,omap3-wdt. Correcting the typo.
 
 Fixes: 6e58b8f1daaf1a (ARM: dts: DRA7: Add the dts files for dra7 SoC and 
 dra7-evm board)
 Signed-off-by: Lokesh Vutla lokeshvu...@ti.com

Thanks applying into omap-for-v3.19/fixes-not-urgent as this is
a feature that clearly never worked on dra7xx with mainline kernel.

Regards,

Tony

 ---
  arch/arm/boot/dts/dra7.dtsi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
 index 9cc9843..666e796 100644
 --- a/arch/arm/boot/dts/dra7.dtsi
 +++ b/arch/arm/boot/dts/dra7.dtsi
 @@ -653,7 +653,7 @@
   };
  
   wdt2: wdt@4ae14000 {
 - compatible = ti,omap4-wdt;
 + compatible = ti,omap3-wdt;
   reg = 0x4ae14000 0x80;
   interrupts = GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH;
   ti,hwmods = wd_timer2;
 -- 
 1.9.1
 
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: dwc3: gadget: Fix broken gadget on system suspend/resume

2014-11-12 Thread Roger Quadros
On 11/12/2014 05:08 PM, Felipe Balbi wrote:
 On Wed, Nov 12, 2014 at 04:58:16PM +0200, Roger Quadros wrote:
 On TI SoCs (e.g. DRA7) we don't support the DWC3 hibernation feature.
 We need to stop the gadget controller while system suspend
 else it results in L3 Bus errors on resume with broken
 USB gadget on J6-evm.

 [   55.718226] WARNING: CPU: 0 PID: 0 at drivers/bus/omap_l3_noc.c:147 
 l3_interrupt_handler+0x224/0x31c()
 [   55.718232] 4400.ocp:L3 Custom Error: MASTER USB3 TARGET GPMC (Idle): 
 Data Access in User mode during Functional access
 [   55.718263] Modules linked in: usb_f_ss_lb g_zero libcomposite configfs 
 xhci_hcd btwilink bluetooth dwc3 6lowpan_iphc m25p80 dwc3_omap 
 omap_remoteproc
 [   55.718271] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
 3.14.19-02011-g3ece3ca-dirty #658
 [   55.718290] [c0016090] (unwind_backtrace) from [c0012060] 
 (show_stack+0x10/0x14)
 [   55.718302] [c0012060] (show_stack) from [c062a2e4] 
 (dump_stack+0x78/0x94)
 [   55.718315] [c062a2e4] (dump_stack) from [c0043bc4] 
 (warn_slowpath_common+0x6c/0x90)
 [   55.718325] [c0043bc4] (warn_slowpath_common) from [c0043c7c] 
 (warn_slowpath_fmt+0x30/0x40)
 [   55.718336] [c0043c7c] (warn_slowpath_fmt) from [c030fb24] 
 (l3_interrupt_handler+0x224/0x31c)
 [   55.718348] [c030fb24] (l3_interrupt_handler) from [c0093010] 
 (handle_irq_event_percpu+0x5c/0x23c)
 [   55.718358] [c0093010] (handle_irq_event_percpu) from [c009322c] 
 (handle_irq_event+0x3c/0x5c)
 [   55.718367] [c009322c] (handle_irq_event) from [c0096160] 
 (handle_fasteoi_irq+0x98/0x158)
 [   55.718377] [c0096160] (handle_fasteoi_irq) from [c00929dc] 
 (generic_handle_irq+0x20/0x30)
 [   55.718385] [c00929dc] (generic_handle_irq) from [c000eea8] 
 (handle_IRQ+0x4c/0xb0)
 [   55.718393] [c000eea8] (handle_IRQ) from [c0008638] 
 (gic_handle_irq+0x28/0x5c)
 [   55.718402] [c0008638] (gic_handle_irq) from [c0630964] 
 (__irq_svc+0x44/0x5c)
 [   55.718406] Exception stack(0xc09c1f68 to 0xc09c1fb0)
 [   55.718412] 1f60:   0001 0001   
 c09c 
 [   55.718418] 1f80: c09c c09c c0a7a1e4 c09c8938 c09c89b4  
 6093 c09c1fb0
 [   55.718423] 1fa0: c008a2e4 c00926cc 6013 
 [   55.718433] [c0630964] (__irq_svc) from [c00926cc] 
 (cpu_startup_entry+0x100/0x1f4)
 [   55.718444] [c00926cc] (cpu_startup_entry) from [c0901ac4] 
 (start_kernel+0x324/0x388)

 Signed-off-by: Roger Quadros rog...@ti.com
 ---
  drivers/usb/dwc3/gadget.c | 8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)

 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
 index 3818b26..bc15b54 100644
 --- a/drivers/usb/dwc3/gadget.c
 +++ b/drivers/usb/dwc3/gadget.c
 @@ -2741,7 +2741,13 @@ int dwc3_gadget_prepare(struct dwc3 *dwc)
 
 there is no more dwc3_gadget_prepare(), please rebase on 'next'.

right.

 
  {
  if (dwc-pullups_connected) {
  dwc3_gadget_disable_irq(dwc);
 -dwc3_gadget_run_stop(dwc, true, true);
 +if (dwc-has_hibernation) {
 +dwc3_gadget_run_stop(dwc, true, true);
 +} else {
 +dwc3_gadget_run_stop(dwc, false, true);
 +/* remember to connect back on resume */
 +dwc-pullups_connected = true;
 +}
 
 Another thing you probably want to do is make sure there is nothing
 pending on our request list because if there is, then we need to wait
 for any in-flight transfers to complete before disconnecting.

shouldn't that check be done in dwc3_gadget_run_stop()?

 
 I also wonder if current code isn't really fragile... I mean, when you
 clear run_stop bit, you should notify the gadget by means of
 -disconnect() and so on... But since we can't test this with mainline,
 then it's difficult to tell.
 
that is true.

cheers,
-roger
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: dwc3: gadget: Fix broken gadget on system suspend/resume

2014-11-12 Thread Felipe Balbi
Hi,

On Wed, Nov 12, 2014 at 05:32:00PM +0200, Roger Quadros wrote:
 On 11/12/2014 05:08 PM, Felipe Balbi wrote:
  On Wed, Nov 12, 2014 at 04:58:16PM +0200, Roger Quadros wrote:
  On TI SoCs (e.g. DRA7) we don't support the DWC3 hibernation feature.
  We need to stop the gadget controller while system suspend
  else it results in L3 Bus errors on resume with broken
  USB gadget on J6-evm.
 
  [   55.718226] WARNING: CPU: 0 PID: 0 at drivers/bus/omap_l3_noc.c:147 
  l3_interrupt_handler+0x224/0x31c()
  [   55.718232] 4400.ocp:L3 Custom Error: MASTER USB3 TARGET GPMC 
  (Idle): Data Access in User mode during Functional access
  [   55.718263] Modules linked in: usb_f_ss_lb g_zero libcomposite configfs 
  xhci_hcd btwilink bluetooth dwc3 6lowpan_iphc m25p80 dwc3_omap 
  omap_remoteproc
  [   55.718271] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
  3.14.19-02011-g3ece3ca-dirty #658
  [   55.718290] [c0016090] (unwind_backtrace) from [c0012060] 
  (show_stack+0x10/0x14)
  [   55.718302] [c0012060] (show_stack) from [c062a2e4] 
  (dump_stack+0x78/0x94)
  [   55.718315] [c062a2e4] (dump_stack) from [c0043bc4] 
  (warn_slowpath_common+0x6c/0x90)
  [   55.718325] [c0043bc4] (warn_slowpath_common) from [c0043c7c] 
  (warn_slowpath_fmt+0x30/0x40)
  [   55.718336] [c0043c7c] (warn_slowpath_fmt) from [c030fb24] 
  (l3_interrupt_handler+0x224/0x31c)
  [   55.718348] [c030fb24] (l3_interrupt_handler) from [c0093010] 
  (handle_irq_event_percpu+0x5c/0x23c)
  [   55.718358] [c0093010] (handle_irq_event_percpu) from [c009322c] 
  (handle_irq_event+0x3c/0x5c)
  [   55.718367] [c009322c] (handle_irq_event) from [c0096160] 
  (handle_fasteoi_irq+0x98/0x158)
  [   55.718377] [c0096160] (handle_fasteoi_irq) from [c00929dc] 
  (generic_handle_irq+0x20/0x30)
  [   55.718385] [c00929dc] (generic_handle_irq) from [c000eea8] 
  (handle_IRQ+0x4c/0xb0)
  [   55.718393] [c000eea8] (handle_IRQ) from [c0008638] 
  (gic_handle_irq+0x28/0x5c)
  [   55.718402] [c0008638] (gic_handle_irq) from [c0630964] 
  (__irq_svc+0x44/0x5c)
  [   55.718406] Exception stack(0xc09c1f68 to 0xc09c1fb0)
  [   55.718412] 1f60:   0001 0001   
  c09c 
  [   55.718418] 1f80: c09c c09c c0a7a1e4 c09c8938 c09c89b4  
  6093 c09c1fb0
  [   55.718423] 1fa0: c008a2e4 c00926cc 6013 
  [   55.718433] [c0630964] (__irq_svc) from [c00926cc] 
  (cpu_startup_entry+0x100/0x1f4)
  [   55.718444] [c00926cc] (cpu_startup_entry) from [c0901ac4] 
  (start_kernel+0x324/0x388)
 
  Signed-off-by: Roger Quadros rog...@ti.com
  ---
   drivers/usb/dwc3/gadget.c | 8 +++-
   1 file changed, 7 insertions(+), 1 deletion(-)
 
  diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
  index 3818b26..bc15b54 100644
  --- a/drivers/usb/dwc3/gadget.c
  +++ b/drivers/usb/dwc3/gadget.c
  @@ -2741,7 +2741,13 @@ int dwc3_gadget_prepare(struct dwc3 *dwc)
  
  there is no more dwc3_gadget_prepare(), please rebase on 'next'.
 
 right.
 
  
   {
 if (dwc-pullups_connected) {
 dwc3_gadget_disable_irq(dwc);
  -  dwc3_gadget_run_stop(dwc, true, true);
  +  if (dwc-has_hibernation) {
  +  dwc3_gadget_run_stop(dwc, true, true);
  +  } else {
  +  dwc3_gadget_run_stop(dwc, false, true);
  +  /* remember to connect back on resume */
  +  dwc-pullups_connected = true;
  +  }
  
  Another thing you probably want to do is make sure there is nothing
  pending on our request list because if there is, then we need to wait
  for any in-flight transfers to complete before disconnecting.
 
 shouldn't that check be done in dwc3_gadget_run_stop()?

no, gadget drivers only disconnect pullups when they know there's
nothing pending. And sometimes, we actually want to break such transfers
to see how the thing would behave. Only suspend/resume needs to make
transfers complete before hand.

  I also wonder if current code isn't really fragile... I mean, when you
  clear run_stop bit, you should notify the gadget by means of
  -disconnect() and so on... But since we can't test this with mainline,
  then it's difficult to tell.
  
 that is true.

Not sure what to do with this patch :-p

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH] usb: dwc3: gadget: Fix broken gadget on system suspend/resume

2014-11-12 Thread Roger Quadros
On 11/12/2014 05:36 PM, Felipe Balbi wrote:
 Hi,
 
 On Wed, Nov 12, 2014 at 05:32:00PM +0200, Roger Quadros wrote:
 On 11/12/2014 05:08 PM, Felipe Balbi wrote:
 On Wed, Nov 12, 2014 at 04:58:16PM +0200, Roger Quadros wrote:
 On TI SoCs (e.g. DRA7) we don't support the DWC3 hibernation feature.
 We need to stop the gadget controller while system suspend
 else it results in L3 Bus errors on resume with broken
 USB gadget on J6-evm.

 [   55.718226] WARNING: CPU: 0 PID: 0 at drivers/bus/omap_l3_noc.c:147 
 l3_interrupt_handler+0x224/0x31c()
 [   55.718232] 4400.ocp:L3 Custom Error: MASTER USB3 TARGET GPMC 
 (Idle): Data Access in User mode during Functional access
 [   55.718263] Modules linked in: usb_f_ss_lb g_zero libcomposite configfs 
 xhci_hcd btwilink bluetooth dwc3 6lowpan_iphc m25p80 dwc3_omap 
 omap_remoteproc
 [   55.718271] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
 3.14.19-02011-g3ece3ca-dirty #658
 [   55.718290] [c0016090] (unwind_backtrace) from [c0012060] 
 (show_stack+0x10/0x14)
 [   55.718302] [c0012060] (show_stack) from [c062a2e4] 
 (dump_stack+0x78/0x94)
 [   55.718315] [c062a2e4] (dump_stack) from [c0043bc4] 
 (warn_slowpath_common+0x6c/0x90)
 [   55.718325] [c0043bc4] (warn_slowpath_common) from [c0043c7c] 
 (warn_slowpath_fmt+0x30/0x40)
 [   55.718336] [c0043c7c] (warn_slowpath_fmt) from [c030fb24] 
 (l3_interrupt_handler+0x224/0x31c)
 [   55.718348] [c030fb24] (l3_interrupt_handler) from [c0093010] 
 (handle_irq_event_percpu+0x5c/0x23c)
 [   55.718358] [c0093010] (handle_irq_event_percpu) from [c009322c] 
 (handle_irq_event+0x3c/0x5c)
 [   55.718367] [c009322c] (handle_irq_event) from [c0096160] 
 (handle_fasteoi_irq+0x98/0x158)
 [   55.718377] [c0096160] (handle_fasteoi_irq) from [c00929dc] 
 (generic_handle_irq+0x20/0x30)
 [   55.718385] [c00929dc] (generic_handle_irq) from [c000eea8] 
 (handle_IRQ+0x4c/0xb0)
 [   55.718393] [c000eea8] (handle_IRQ) from [c0008638] 
 (gic_handle_irq+0x28/0x5c)
 [   55.718402] [c0008638] (gic_handle_irq) from [c0630964] 
 (__irq_svc+0x44/0x5c)
 [   55.718406] Exception stack(0xc09c1f68 to 0xc09c1fb0)
 [   55.718412] 1f60:   0001 0001   
 c09c 
 [   55.718418] 1f80: c09c c09c c0a7a1e4 c09c8938 c09c89b4  
 6093 c09c1fb0
 [   55.718423] 1fa0: c008a2e4 c00926cc 6013 
 [   55.718433] [c0630964] (__irq_svc) from [c00926cc] 
 (cpu_startup_entry+0x100/0x1f4)
 [   55.718444] [c00926cc] (cpu_startup_entry) from [c0901ac4] 
 (start_kernel+0x324/0x388)

 Signed-off-by: Roger Quadros rog...@ti.com
 ---
  drivers/usb/dwc3/gadget.c | 8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)

 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
 index 3818b26..bc15b54 100644
 --- a/drivers/usb/dwc3/gadget.c
 +++ b/drivers/usb/dwc3/gadget.c
 @@ -2741,7 +2741,13 @@ int dwc3_gadget_prepare(struct dwc3 *dwc)

 there is no more dwc3_gadget_prepare(), please rebase on 'next'.

 right.


  {
if (dwc-pullups_connected) {
dwc3_gadget_disable_irq(dwc);
 -  dwc3_gadget_run_stop(dwc, true, true);
 +  if (dwc-has_hibernation) {
 +  dwc3_gadget_run_stop(dwc, true, true);
 +  } else {
 +  dwc3_gadget_run_stop(dwc, false, true);
 +  /* remember to connect back on resume */
 +  dwc-pullups_connected = true;
 +  }

 Another thing you probably want to do is make sure there is nothing
 pending on our request list because if there is, then we need to wait
 for any in-flight transfers to complete before disconnecting.

 shouldn't that check be done in dwc3_gadget_run_stop()?
 
 no, gadget drivers only disconnect pullups when they know there's
 nothing pending. And sometimes, we actually want to break such transfers
 to see how the thing would behave. Only suspend/resume needs to make
 transfers complete before hand.
 
 I also wonder if current code isn't really fragile... I mean, when you
 clear run_stop bit, you should notify the gadget by means of
 -disconnect() and so on... But since we can't test this with mainline,
 then it's difficult to tell.

 that is true.
 
 Not sure what to do with this patch :-p
 
:). Maybe we can wait till we have suspend/resume working in mainline.

cheers,
-roger
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mfd: twl4030-power: Fix poweroff with PM configuration enabled

2014-11-12 Thread Grazvydas Ignotas
On Tue, Nov 4, 2014 at 5:42 PM, Tony Lindgren t...@atomide.com wrote:
 * Igor Grinberg grinb...@compulab.co.il [141104 05:22]:
 Hi Tony,

 On 11/02/14 20:07, Tony Lindgren wrote:
  Commit e7cd1d1eb16f (mfd: twl4030-power: Add generic reset
  configuration) enabled configuring the PM features for twl4030.
 
  This caused poweroff command to fail on devices that have the
  BCI charger on twl4030 wired, or have power wired for VBUS.
  Instead of powering off, the device reboots. This is because
  voltage is detected on charger or VBUS with the default bits
  enabled for the power transition registers.
 
  To fix the issue, let's just clear VBUS and CHG bits as we want
  poweroff command to keep the system powered off.

 What about devices that really need to start once VBUS or CHG is connected?

 More handling can be added for some cases. With this patch the
 poweron bits will clear to defaults if power is completely removed.
 So start-up with VBUS and CHG works in that case.

 However, if you have a battery connected, and you poweroff, with
 this patch the device won't power up with VBUS or CHG connected.

 Note that most battery operated devices are not using the charger
 on twl4030 because it has issues charging a completely empty
 battery AFAIK. So most battery powered devices have been using an
 external USB charger chip that's not affected by this patch.

Pandora does, as well as GTA04 AFAIK, but that's not most devices I
guess.. At least pandora was booting up on charger connect up until
now. I don't know why shutdown used to work for Russell in legacy boot
and it changed for DT, the device would always start up when there was
AC power here.


Grazvydas


 We could consider exporting a function for the charger driver to
 configure the poweron mask. And we could also consider passing a
 mask in ti,use_poweroff = 0xff.

 It seems to me that forcing these bits on power off can break that kind of
 devices and these settings should really be board specific.
 What do you think?

 There's a patch series for [RFC,01/16] kernel: Add support for
 poweroff handler call chain that should help with that. For sure
 the poweroff handling needs to be board specific as some systems
 may need to use a GPIO to shut off a regulator powering something
 before powering off the SoC.

 Regards,

 Tony
 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: dwc3: gadget: Fix broken gadget on system suspend/resume

2014-11-12 Thread Felipe Balbi
On Wed, Nov 12, 2014 at 05:40:59PM +0200, Roger Quadros wrote:
 On 11/12/2014 05:36 PM, Felipe Balbi wrote:
  Hi,
  
  On Wed, Nov 12, 2014 at 05:32:00PM +0200, Roger Quadros wrote:
  On 11/12/2014 05:08 PM, Felipe Balbi wrote:
  On Wed, Nov 12, 2014 at 04:58:16PM +0200, Roger Quadros wrote:
  On TI SoCs (e.g. DRA7) we don't support the DWC3 hibernation feature.
  We need to stop the gadget controller while system suspend
  else it results in L3 Bus errors on resume with broken
  USB gadget on J6-evm.
 
  [   55.718226] WARNING: CPU: 0 PID: 0 at drivers/bus/omap_l3_noc.c:147 
  l3_interrupt_handler+0x224/0x31c()
  [   55.718232] 4400.ocp:L3 Custom Error: MASTER USB3 TARGET GPMC 
  (Idle): Data Access in User mode during Functional access
  [   55.718263] Modules linked in: usb_f_ss_lb g_zero libcomposite 
  configfs xhci_hcd btwilink bluetooth dwc3 6lowpan_iphc m25p80 dwc3_omap 
  omap_remoteproc
  [   55.718271] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
  3.14.19-02011-g3ece3ca-dirty #658
  [   55.718290] [c0016090] (unwind_backtrace) from [c0012060] 
  (show_stack+0x10/0x14)
  [   55.718302] [c0012060] (show_stack) from [c062a2e4] 
  (dump_stack+0x78/0x94)
  [   55.718315] [c062a2e4] (dump_stack) from [c0043bc4] 
  (warn_slowpath_common+0x6c/0x90)
  [   55.718325] [c0043bc4] (warn_slowpath_common) from [c0043c7c] 
  (warn_slowpath_fmt+0x30/0x40)
  [   55.718336] [c0043c7c] (warn_slowpath_fmt) from [c030fb24] 
  (l3_interrupt_handler+0x224/0x31c)
  [   55.718348] [c030fb24] (l3_interrupt_handler) from [c0093010] 
  (handle_irq_event_percpu+0x5c/0x23c)
  [   55.718358] [c0093010] (handle_irq_event_percpu) from [c009322c] 
  (handle_irq_event+0x3c/0x5c)
  [   55.718367] [c009322c] (handle_irq_event) from [c0096160] 
  (handle_fasteoi_irq+0x98/0x158)
  [   55.718377] [c0096160] (handle_fasteoi_irq) from [c00929dc] 
  (generic_handle_irq+0x20/0x30)
  [   55.718385] [c00929dc] (generic_handle_irq) from [c000eea8] 
  (handle_IRQ+0x4c/0xb0)
  [   55.718393] [c000eea8] (handle_IRQ) from [c0008638] 
  (gic_handle_irq+0x28/0x5c)
  [   55.718402] [c0008638] (gic_handle_irq) from [c0630964] 
  (__irq_svc+0x44/0x5c)
  [   55.718406] Exception stack(0xc09c1f68 to 0xc09c1fb0)
  [   55.718412] 1f60:   0001 0001  
   c09c 
  [   55.718418] 1f80: c09c c09c c0a7a1e4 c09c8938 c09c89b4 
   6093 c09c1fb0
  [   55.718423] 1fa0: c008a2e4 c00926cc 6013 
  [   55.718433] [c0630964] (__irq_svc) from [c00926cc] 
  (cpu_startup_entry+0x100/0x1f4)
  [   55.718444] [c00926cc] (cpu_startup_entry) from [c0901ac4] 
  (start_kernel+0x324/0x388)
 
  Signed-off-by: Roger Quadros rog...@ti.com
  ---
   drivers/usb/dwc3/gadget.c | 8 +++-
   1 file changed, 7 insertions(+), 1 deletion(-)
 
  diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
  index 3818b26..bc15b54 100644
  --- a/drivers/usb/dwc3/gadget.c
  +++ b/drivers/usb/dwc3/gadget.c
  @@ -2741,7 +2741,13 @@ int dwc3_gadget_prepare(struct dwc3 *dwc)
 
  there is no more dwc3_gadget_prepare(), please rebase on 'next'.
 
  right.
 
 
   {
   if (dwc-pullups_connected) {
   dwc3_gadget_disable_irq(dwc);
  -dwc3_gadget_run_stop(dwc, true, true);
  +if (dwc-has_hibernation) {
  +dwc3_gadget_run_stop(dwc, true, true);
  +} else {
  +dwc3_gadget_run_stop(dwc, false, true);
  +/* remember to connect back on resume */
  +dwc-pullups_connected = true;
  +}
 
  Another thing you probably want to do is make sure there is nothing
  pending on our request list because if there is, then we need to wait
  for any in-flight transfers to complete before disconnecting.
 
  shouldn't that check be done in dwc3_gadget_run_stop()?
  
  no, gadget drivers only disconnect pullups when they know there's
  nothing pending. And sometimes, we actually want to break such transfers
  to see how the thing would behave. Only suspend/resume needs to make
  transfers complete before hand.
  
  I also wonder if current code isn't really fragile... I mean, when you
  clear run_stop bit, you should notify the gadget by means of
  -disconnect() and so on... But since we can't test this with mainline,
  then it's difficult to tell.
 
  that is true.
  
  Not sure what to do with this patch :-p
  
 :). Maybe we can wait till we have suspend/resume working in mainline.

Perhaps... hopefully we won't forget about this :-)

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH] mfd: twl4030-power: Fix poweroff with PM configuration enabled

2014-11-12 Thread Tony Lindgren
* Grazvydas Ignotas nota...@gmail.com [141112 07:46]:
 On Tue, Nov 4, 2014 at 5:42 PM, Tony Lindgren t...@atomide.com wrote:
  * Igor Grinberg grinb...@compulab.co.il [141104 05:22]:
  Hi Tony,
 
  On 11/02/14 20:07, Tony Lindgren wrote:
   Commit e7cd1d1eb16f (mfd: twl4030-power: Add generic reset
   configuration) enabled configuring the PM features for twl4030.
  
   This caused poweroff command to fail on devices that have the
   BCI charger on twl4030 wired, or have power wired for VBUS.
   Instead of powering off, the device reboots. This is because
   voltage is detected on charger or VBUS with the default bits
   enabled for the power transition registers.
  
   To fix the issue, let's just clear VBUS and CHG bits as we want
   poweroff command to keep the system powered off.
 
  What about devices that really need to start once VBUS or CHG is connected?
 
  More handling can be added for some cases. With this patch the
  poweron bits will clear to defaults if power is completely removed.
  So start-up with VBUS and CHG works in that case.
 
  However, if you have a battery connected, and you poweroff, with
  this patch the device won't power up with VBUS or CHG connected.
 
  Note that most battery operated devices are not using the charger
  on twl4030 because it has issues charging a completely empty
  battery AFAIK. So most battery powered devices have been using an
  external USB charger chip that's not affected by this patch.
 
 Pandora does, as well as GTA04 AFAIK, but that's not most devices I
 guess.. At least pandora was booting up on charger connect up until
 now. I don't know why shutdown used to work for Russell in legacy boot
 and it changed for DT, the device would always start up when there was
 AC power here.

I think Pandora should still start up fine on charger connect except
after you do a poweroff first?

And my guess is Pandora would not stay powered off earlier after you
did poweroff but would start up again immediately instead.

If something has changed with the default start up events, then
it must be some separate issue. This is because we configure the start
up events only in twl4030_power_off() when poweroff is called, so those
are not touched during the init time.

BTW, the reason why things changed for device tree based booting is
because we're now configuring the PMIC for PM features while for
legacy booting that was only done for n900.

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/2] bus: omap_l3_noc: Add resume hook to restore mask registers

2014-11-12 Thread Keerthy

On Wednesday 12 November 2014 08:47 PM, Tony Lindgren wrote:

* Keerthy j-keer...@ti.com [141110 10:25]:

l3_noc module loses context during both DS0 and RTC+DDR in self refresh modes.
This causes the previously masked l3 interrupts to trigger and the software
book keeping assumes the interrupts are masked and does nothing to mask.
This software/hardware out of sync leads to back to back l3 interrupts
and eventually causes a hang. Hence adding resume hook to restore the
mask registers based on the book keeping variables

Applying both into omap-for-v3.19/drivers-v2 branch thanks.


Thanks Tony.



Tony


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv6 1/5] Documentation: dt: add common bindings for hwspinlock

2014-11-12 Thread Suman Anna
Kumar, Mark, Rob,

On 11/12/2014 09:14 AM, Ohad Ben-Cohen wrote:
 Hi Suman,
 
 On Fri, Sep 12, 2014 at 11:24 PM, Suman Anna s-a...@ti.com wrote:
 This patch adds the generic common bindings used to represent
 a hwlock device and use/request locks in a device-tree build.

 ...

 Cc: Rob Herring robh...@kernel.org
 Signed-off-by: Suman Anna s-a...@ti.com
 ---
  .../devicetree/bindings/hwlock/hwlock.txt  | 55 
 ++
  1 file changed, 55 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/hwlock/hwlock.txt
 
 Please ask a DT maintainer to ACK this - otherwise I can't send this to Linus.
 

Can one of you ack this patch and the next patch [1] so that Ohad can
pick up the series for 3.19? This series has been in works for quite
some time now and was reviewed by each of you at some point of time
(thanks!!), the cover letter [2] has the history of the changes.

regards
Suman

[1] https://patchwork.kernel.org/patch/4898001/
[2] http://marc.info/?l=linux-omapm=141055365213895w=2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mtd: nand: omap: Fix NAND enumeration on 3430 LDP

2014-11-12 Thread Tony Lindgren
* pekon pe...@pek-sem.com [141109 11:31]:
 On Saturday 08 November 2014 04:18 AM, Tony Lindgren wrote:
 
 Right. I doubt anybody has bch8 rootfs on LDP.. And considering u-boot
 must be ham1 to boot at all, that's what we should change for the
 devices that do not have not standardized on bch8.
 
 My view on this is slightly different:
 - Lately, everyone seems to have migrated to BCH8.
 
 - Also HAM1 does not have strength to fix bitflips in aging NAND. So if
 someone already has OMAP3-LDP deployed on field then its NAND would have
 already aged to such an extend that HAM1 may not be sufficient.

OK so it makes sense to keep it as BCH8 then. Would be nice to get
the writing u-boot from kernel issue fixed somehow though as people
are hitting that for sure.
 
 My question is..
 Moving back to HAM1 should be decided based on statistics rather than rule
 of breaking backward compatibility. So please review:
 (1) How many user of OMAP3-Zoom or other old boards complaining about using
 BCH8 in mainline kernel? OR

0

 (2) How many users of OMAP3 legacy boards are migrating to newer kernel?

Quite a few for sure, but are probably also using rootfs on MMC instead.
 
 At-least I have not, rather most of the OMAP3 users I interacted via TI's
 E2E forum wanted to migrate to BCH8 or even BCH16, as HAM1 was not
 sufficient for their usage.
 
 So whatever you decide on this topic, please be cautious that you don't
 re-invent work for yourself, as I did. It took me lot of time and testing
 effort on multiple boards to migrate HAM1 to BCH8, And add BCH16 for newer
 devices.

Right no objections to using BCH8 for rootfs, except it stopped working
over past year or so.

And it seems the settings should be partition specific because of u-boot
requiring HAM1.

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL 1/3] omap device tree changes for v3.19

2014-11-12 Thread Tony Lindgren
The following changes since commit cac7f2429872d3733dc3f9915857b1691da2eb2f:

  Linux 3.18-rc2 (2014-10-26 16:48:41 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap 
tags/omap-for-v3.19/dt-part1

for you to fetch changes up to 065bd7fe50de5e6d0fd5034cbc87120a558a1219:

  ARM: dts: DRA7: Add aliases for all serial ports (2014-11-12 07:04:37 -0800)


Device tree related changes for omaps:

- Fix currently harmless but wrong sizes for various GPMC connected
  devices

- Set up timings for several GPMC connected devices to get rid of
  bootloader dependencies in later patches

- Enable various drivers for dra7xx

- Prepare Igep boards to support new variants

- Add intial support for BeagleBoard-X15


Dmitry Lifshitz (1):
  ARM: dts: sbc-t3x: add DVI display data

Enric Balletbo i Serra (11):
  ARM: dts: omap3-igep00x0: Fix UART2 pins that aren't common.
  ARM: dts: omap3-igep00x0: Move NAND configuration to a common place.
  ARM: dts: omap3-igep0030: Specify IGEP COM revision in device tree.
  ARM: dts: omap3-igep0020: Specify IGEPv2 revision in device tree.
  ARM: dts: omap3-igep00x0: Move outside common file the on board Wifi 
module.
  ARM: dts: omap3-igep0030-common: Introduce igep0030 common dtsi file.
  ARM: dts: omap3-igep0030-rev-g: Support IGEP COM MODULE Rev. G
  ARM: dts: omap3-igep0020-common: Introduce igep0020 common dtsi file.
  ARM: dts: omap3-igep0020-rev-f: Support IGEPv2 Rev. F
  ARM: dts: omap3-igep00x0: Remove i2c2 node.
  ARM: OMAP2+: igep00x0: Add pdata-quirks for the btwilink device.

Felipe Balbi (1):
  ARM: dts: dra7: add labels to DWC3 nodes

George Cherian (1):
  ARM: dts: dra72-evm: Enable USB support for dra72-evm.

Marek Belisko (1):
  ARM: dts: omap3-gta04: Use omap specific pinctrl defines

Mugunthan V N (3):
  ARM: dts: dra7: Add CPSW and MDIO module nodes for dra7
  ARM: dts: dra7-evm: Enable CPSW and MDIO for dra7xx EVM
  ARM: dts: dra72x-evm: Enable CPSW and MDIO

Nishanth Menon (6):
  ARM: dts: dra72-evm: Provide explicit pinmux for TPS PMIC
  ARM: dts: dra72-evm: Add power button node
  ARM: dts: dra72-evm: Add MMC nodes
  ARM: dts: dra7-evm: Keep all VDD rails always-on
  ARM: dts: Add am57xx-beagle-x15
  ARM: dts: DRA7: Add aliases for all serial ports

Roger Quadros (3):
  ARM: dts: dra72-evm: Add NAND support
  ARM: dts: DRA7: Move USB_OTG 4 to dra74x.dtsi
  ARM: dts: dra72-evm: Add regulator information to USB2 PHYs

Sebastian Andrzej Siewior (2):
  ARM: dts: am33xx: add DMA properties for UART
  ARM: dts: dra7: add DMA properties for UART

Suman Anna (2):
  ARM: dts: DRA7: Add interrupts property to mailbox nodes
  ARM: dts: OMAP2+: Add #mbox-cells property to all mailbox nodes

Tony Lindgren (6):
  ARM: dts: Fix bootloader version dependencies by muxing n900 smc91x pins
  ARM: dts: Fix wrong GPMC size mappings for omaps
  ARM: dts: Add smc91x GPMC configuration for 2430sdp
  ARM: dts: Add GPMC timings for omap zoom serial port
  ARM: dts: Use better omap GPMC timings for LAN9220
  ARM: dts: Fix missing GPMC NAND device width for omap3 boards

 arch/arm/boot/dts/Makefile   |   3 +
 arch/arm/boot/dts/am335x-evm.dts |   4 +-
 arch/arm/boot/dts/am335x-igep0033.dtsi   |   4 +-
 arch/arm/boot/dts/am33xx.dtsi|   7 +
 arch/arm/boot/dts/am4372.dtsi|   1 +
 arch/arm/boot/dts/am43x-epos-evm.dts |   4 +-
 arch/arm/boot/dts/am57xx-beagle-x15.dts  | 405 +++
 arch/arm/boot/dts/dra7-evm.dts   | 111 
 arch/arm/boot/dts/dra7.dtsi  | 167 +--
 arch/arm/boot/dts/dra72-evm.dts  | 296 
 arch/arm/boot/dts/dra74x.dtsi|  22 ++
 arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi|  41 +--
 arch/arm/boot/dts/omap-zoom-common.dtsi  |  62 +++-
 arch/arm/boot/dts/omap2420-n8x0-common.dtsi  |   4 +-
 arch/arm/boot/dts/omap2420.dtsi  |   1 +
 arch/arm/boot/dts/omap2430-sdp.dts   |  28 +-
 arch/arm/boot/dts/omap2430.dtsi  |   1 +
 arch/arm/boot/dts/omap3-cm-t3517.dts |  11 +
 arch/arm/boot/dts/omap3-cm-t3530.dts |  11 +
 arch/arm/boot/dts/omap3-cm-t3730.dts |  24 ++
 arch/arm/boot/dts/omap3-cm-t3x.dtsi  |  39 +++
 arch/arm/boot/dts/omap3-devkit8000.dts   |   4 +-
 arch/arm/boot/dts/omap3-evm-37xx.dts |   5 +-
 arch/arm/boot/dts/omap3-gta04.dtsi   |  86 +++---
 arch/arm/boot/dts/omap3-igep.dtsi| 103 ---
 arch/arm/boot/dts/omap3-igep0020-common.dtsi | 246 
 arch/arm/boot/dts/omap3-igep0020-rev-f.dts   |  45 +++
 arch/arm/boot/dts/omap3-igep0020.dts | 285 

[GIT PULL 2/3] omap gpmc changes for v3.19

2014-11-12 Thread Tony Lindgren
The following changes since commit 24f284af1a64a1a073b064428cafb447aff19a21:

  ARM: dts: Fix missing GPMC NAND device width for omap3 boards (2014-11-03 
17:42:16 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap 
tags/omap-for-v3.19/gpmc-timings

for you to fetch changes up to 6f8782a7a1c826e1c013d6b7d5504af6bcc079e6:

  ARM: OMAP2+: Remove unnecesary include in GPMC driver (2014-11-06 10:51:06 
-0800)


GPMC (General Purpose Memory Controller) changes for omaps. These
changes allow us to drop dependencies to bootloader timings now
that the known device tree entries have been fixed. So we can now
require proper timings to be configured and get rid of the legacy
smsc91x code.

Note that this branch has a dependency to the related device tree
branch sent in a separate pull request as timings are now required.


Javier Martinez Canillas (1):
  ARM: OMAP2+: Remove unnecesary include in GPMC driver

Roger Quadros (5):
  ARM: OMAP2+: gpmc: Print error message in set_gpmc_timing_reg()
  ARM: OMAP2+: gpmc: Error out if timings fail in gpmc_probe_generic_child()
  ARM: OMAP2+: gpmc: Always enable A26-A11 for non NAND devices
  ARM: OMAP2+: gpmc: Keep Chip Select disabled while configuring it
  ARM: OMAP2+: gpmc: Sanity check GPMC fck on probe

Tony Lindgren (5):
  ARM: OMAP2+: Fix support for multiple devices on a GPMC chip select
  ARM: OMAP2+: Show bootloader GPMC timings to allow configuring the .dts 
file
  ARM: OMAP2+: Require proper GPMC timings for devices
  ARM: OMAP2+: Drop legacy code for gpmc-smc91x.c
  Merge branch 'for-v3.19/gpmc-omap' of github.com:rogerq/linux into 
omap-for-v3.19/gpmc

 arch/arm/mach-omap2/Makefile |   3 -
 arch/arm/mach-omap2/board-3430sdp.c  |  28 ---
 arch/arm/mach-omap2/board-rx51-peripherals.c |  29 ---
 arch/arm/mach-omap2/gpmc-smc91x.c| 186 -
 arch/arm/mach-omap2/gpmc-smc91x.h|  42 
 arch/arm/mach-omap2/gpmc.c   | 295 +--
 6 files changed, 237 insertions(+), 346 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/gpmc-smc91x.c
 delete mode 100644 arch/arm/mach-omap2/gpmc-smc91x.h
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL 3/3] omap clean-up for v3.19

2014-11-12 Thread Tony Lindgren
The following changes since commit 2dde3bccbf905548a17b8d440053f86454af54a9:

  Merge branch 'for-v3.19/gpmc-omap' of github.com:rogerq/linux into 
omap-for-v3.19/gpmc (2014-11-03 17:45:36 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap 
tags/omap-for-v3.19/cleanup-part1

for you to fetch changes up to 1b383f44aabc8b69b8bc0d32b914f3d3cece9e04:

  ARM: OMAP2+: Drop board file for 3430sdp (2014-11-03 17:50:55 -0800)


Drop few unused omap board files. The support for ti81xx is known to
be incomplete and broken, and the 3430sdp is only used in few automated
boot test systems AFAIK and those have been booting in device tree only
mode for quite some time now.

Note that this branch has a dependency to the related device tree
changes and GPMC changes sent in a separate pull request.


Tony Lindgren (2):
  ARM: OMAP2+: Drop board file for ti8168evm
  ARM: OMAP2+: Drop board file for 3430sdp

 arch/arm/mach-omap2/Kconfig   |  16 -
 arch/arm/mach-omap2/Makefile  |   3 -
 arch/arm/mach-omap2/board-3430sdp.c   | 604 --
 arch/arm/mach-omap2/board-ti8168evm.c |  62 
 4 files changed, 685 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/board-3430sdp.c
 delete mode 100644 arch/arm/mach-omap2/board-ti8168evm.c
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv6 4/5] hwspinlock/core: add common OF helpers

2014-11-12 Thread Ohad Ben-Cohen
Hi Suman,

On Fri, Sep 12, 2014 at 11:24 PM, Suman Anna s-a...@ti.com wrote:
 +int of_hwspin_lock_get_id(struct device_node *np, int index)
 +{
 +   struct hwspinlock_device *bank;
 +   struct of_phandle_args args;
 +   int id;
 +   int ret;
 +
 +   ret = of_parse_phandle_with_args(np, hwlocks, #hwlock-cells, 
 index,
 +args);
 +   if (ret)
 +   return ret;
 +
 +   mutex_lock(hwspinlock_tree_lock);
 +   list_for_each_entry(bank, hwspinlock_devices, list)
 +   if (bank-dev-of_node == args.np)
 +   break;
 +   mutex_unlock(hwspinlock_tree_lock);
 +   if (bank-list == hwspinlock_devices) {
 +   ret = -EPROBE_DEFER;
 +   goto out;
 +   }

Is this the validation you mentioned which requires the existence of
hwspinlock/core: maintain a list of registered hwspinlock banks ?

I'm not convinced this is needed for several reasons:
- the user isn't using the lock yet at this point, and may only need
the id in order to communicate it to a remote processor
- if the user will try to use the lock prematurely,
hwspin_lock_request_specific should stop her
- moreover, hwspin_lock_request_specific must be the one who validates
the id, since in heterogeneous systems the user may get the id from a
remote processor and not via of_hwspin_lock_get_id

 hwspinlock/core: maintain a list of registered hwspinlock banks
adds complexity which must be very strongly justified.

If we're not sure there is a strong justification for it, we better
not merge it.

 +EXPORT_SYMBOL_GPL(of_hwspin_lock_get_base_id);
...
 +EXPORT_SYMBOL_GPL(of_hwspin_lock_get_num_locks);

Do we really must expose these two helpers globally?

Can we instead make these static inline methods and embed them in
hwspinlock_internal.h ?

Thanks,
Ohad.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv6 5/5] hwspinlock/omap: add support for dt nodes

2014-11-12 Thread Ohad Ben-Cohen
Hi Suman,

On Fri, Sep 12, 2014 at 11:24 PM, Suman Anna s-a...@ti.com wrote:
  static int omap_hwspinlock_probe(struct platform_device *pdev)
  {
 -   struct hwspinlock_pdata *pdata = pdev-dev.platform_data;
 +   struct device_node *node = pdev-dev.of_node;
 struct hwspinlock_device *bank;
 struct hwspinlock *hwlock;
 struct resource *res;
 void __iomem *io_base;
 -   int num_locks, i, ret;
 +   int num_locks, i, ret, base_id;

 -   if (!pdata)
 +   if (!node)
 return -ENODEV;

 +   ret = of_hwspin_lock_get_base_id(node);
 +   if (ret  0  ret != -EINVAL)
 +   return -ENODEV;
 +   base_id = (ret  0 ? ret : 0);

Does this mean you allow nodes not to have the base_id property? How
do we protect against multiple nodes not having a base_id property
then?

Implicitly assuming a base_id value (zero in this case) may not be always safe.

Thanks,
Ohad.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv6 4/5] hwspinlock/core: add common OF helpers

2014-11-12 Thread Suman Anna
Hi Ohad,

Thanks for the review.

On 11/12/2014 01:08 PM, Ohad Ben-Cohen wrote:
 Hi Suman,
 
 On Fri, Sep 12, 2014 at 11:24 PM, Suman Anna s-a...@ti.com wrote:
 +int of_hwspin_lock_get_id(struct device_node *np, int index)
 +{
 +   struct hwspinlock_device *bank;
 +   struct of_phandle_args args;
 +   int id;
 +   int ret;
 +
 +   ret = of_parse_phandle_with_args(np, hwlocks, #hwlock-cells, 
 index,
 +args);
 +   if (ret)
 +   return ret;
 +
 +   mutex_lock(hwspinlock_tree_lock);
 +   list_for_each_entry(bank, hwspinlock_devices, list)
 +   if (bank-dev-of_node == args.np)
 +   break;
 +   mutex_unlock(hwspinlock_tree_lock);
 +   if (bank-list == hwspinlock_devices) {
 +   ret = -EPROBE_DEFER;
 +   goto out;
 +   }
 
 Is this the validation you mentioned which requires the existence of
 hwspinlock/core: maintain a list of registered hwspinlock banks ?

Well, not exactly. The validation is on the following segment,

+   id = of_hwspin_lock_simple_xlate(bank, args);
+   if (id  0 || id = bank-num_locks) {
+   ret = -EINVAL;
+   goto out;
+   }

That said, it is also needed to provide the support for deferred probing
without changing the return code conventions on the existing API.

 
 I'm not convinced this is needed for several reasons:
 - the user isn't using the lock yet at this point, and may only need
 the id in order to communicate it to a remote processor

Yes, and wouldn't that require that the id is validated? It just cannot
return any return value, and expect it will be verified somewhere else
or in a following API call. Not doing the validation unnecessarily
complicates the system usage of a lock as you are sharing an invalid
lock to a remote processor and then you have two validation failure
paths on different processors.

 - if the user will try to use the lock prematurely,
 hwspin_lock_request_specific should stop her
 - moreover, hwspin_lock_request_specific must be the one who validates
 the id, since in heterogeneous systems the user may get the id from a
 remote processor and not via of_hwspin_lock_get_id
 
  hwspinlock/core: maintain a list of registered hwspinlock banks
 adds complexity which must be very strongly justified.
 
 If we're not sure there is a strong justification for it, we better
 not merge it.
 
 +EXPORT_SYMBOL_GPL(of_hwspin_lock_get_base_id);
 ...
 +EXPORT_SYMBOL_GPL(of_hwspin_lock_get_num_locks);
 
 Do we really must expose these two helpers globally?
 
 Can we instead make these static inline methods and embed them in
 hwspinlock_internal.h ?

Actually, not a bad idea, I will move it, thanks. All the client drivers
would need it, and they already have to include the internal header.

regards
Suman
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv6 5/5] hwspinlock/omap: add support for dt nodes

2014-11-12 Thread Suman Anna
Hi Ohad,

On 11/12/2014 01:14 PM, Ohad Ben-Cohen wrote:
 Hi Suman,
 
 On Fri, Sep 12, 2014 at 11:24 PM, Suman Anna s-a...@ti.com wrote:
  static int omap_hwspinlock_probe(struct platform_device *pdev)
  {
 -   struct hwspinlock_pdata *pdata = pdev-dev.platform_data;
 +   struct device_node *node = pdev-dev.of_node;
 struct hwspinlock_device *bank;
 struct hwspinlock *hwlock;
 struct resource *res;
 void __iomem *io_base;
 -   int num_locks, i, ret;
 +   int num_locks, i, ret, base_id;

 -   if (!pdata)
 +   if (!node)
 return -ENODEV;

 +   ret = of_hwspin_lock_get_base_id(node);
 +   if (ret  0  ret != -EINVAL)
 +   return -ENODEV;
 +   base_id = (ret  0 ? ret : 0);
 
 Does this mean you allow nodes not to have the base_id property? How
 do we protect against multiple nodes not having a base_id property
 then?
 
 Implicitly assuming a base_id value (zero in this case) may not be always 
 safe.

None of the OMAPs have multiple IP instances, and as such the base-id is
an optional property. I have made this change to make sure we atleast
attempt to use the value if mentioned in DT and not hard-coding the
value to begin with (going by the optional property semantics). If and
when multiple instances get added and a secondary node doesn't add the
property, the node will not be registered with the core due to an
overlap failure. Here is the previous version [1] for reference.

regards
Suman

[1] https://patchwork.kernel.org/patch/4096881/
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mfd: twl4030-power: Fix poweroff with PM configuration enabled

2014-11-12 Thread Dr. H. Nikolaus Schaller

Am 12.11.2014 um 16:45 schrieb Grazvydas Ignotas nota...@gmail.com:

 On Tue, Nov 4, 2014 at 5:42 PM, Tony Lindgren t...@atomide.com wrote:
 * Igor Grinberg grinb...@compulab.co.il [141104 05:22]:
 Hi Tony,
 
 On 11/02/14 20:07, Tony Lindgren wrote:
 Commit e7cd1d1eb16f (mfd: twl4030-power: Add generic reset
 configuration) enabled configuring the PM features for twl4030.
 
 This caused poweroff command to fail on devices that have the
 BCI charger on twl4030 wired, or have power wired for VBUS.
 Instead of powering off, the device reboots. This is because
 voltage is detected on charger or VBUS with the default bits
 enabled for the power transition registers.
 
 To fix the issue, let's just clear VBUS and CHG bits as we want
 poweroff command to keep the system powered off.
 
 What about devices that really need to start once VBUS or CHG is connected?
 
 More handling can be added for some cases. With this patch the
 poweron bits will clear to defaults if power is completely removed.
 So start-up with VBUS and CHG works in that case.
 
 However, if you have a battery connected, and you poweroff, with
 this patch the device won't power up with VBUS or CHG connected.
 
 Note that most battery operated devices are not using the charger
 on twl4030 because it has issues charging a completely empty
 battery AFAIK. So most battery powered devices have been using an
 external USB charger chip that's not affected by this patch.
 
 Pandora does, as well as GTA04 AFAIK,

Yes. The trick is that the power level that turns on the device is a little 
higher
and the battery provides enough energy for approx. 30 seconds until it drained
to a level where it turns off. Depending on general setup (WIFI must remain
powered off after boot) this is enough to boot into Linux and start full 
charging.
Another trick is to modify MLO and U-Boot to raise the charging current.

 but that's not most devices“ I

Indeed.

 guess.. At least pandora was booting up on charger connect up until
 now.

Same for GTA04.

 I don't know why shutdown used to work for Russell in legacy boot
 and it changed for DT, the device would always start up when there was
 AC power here.
 
 
 Grazvydas
 
 
 We could consider exporting a function for the charger driver to
 configure the poweron mask. And we could also consider passing a
 mask in ti,use_poweroff = 0xff.

Yes, exporting these masks would be fine - if a board needs a non-default
setup.

 
 It seems to me that forcing these bits on power off can break that kind of
 devices and these settings should really be board specific.
 What do you think?
 
 There's a patch series for [RFC,01/16] kernel: Add support for
 poweroff handler call chain that should help with that. For sure
 the poweroff handling needs to be board specific as some systems
 may need to use a GPIO to shut off a regulator powering something
 before powering off the SoC.
 
 Regards,
 
 Tony
 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

BR,
Nikolaus

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   >