[PATCH v3] drm/bridge/tc358775: Fixes bus formats read

2021-01-16 Thread Vinay Simha BN
- state->output_bus_cfg.format, memcpy and
  unsigned int used
- atomic_check removed
- video data input and output formats added
- bus formats read from drm_bridge_state.output_bus_cfg.format
  and .atomic_get_input_bus_fmts() instead of connector

Reviewed-by: Laurent Pinchart 
Signed-off-by: Vinay Simha BN 

---
v1:
 * Laurent Pinchart review comments incorporated
   drm_bridge_state.output_bus_cfg.format
   instead of connector
v2:
 * Laurent Pinchart review comments incorporated
   atomic_check removed
   ivideo data input and output formats added

v3:
 * Laurent Pinchart review comments incorporated
   output_bus_fmt removed and using state->output_bus_cfg.format
   unsigned int i used
   memcpy used for input_fmts
---
 drivers/gpu/drm/bridge/tc358775.c | 71 +++
 1 file changed, 54 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
index 2272adcc5b4a..a8998dd447ae 100644
--- a/drivers/gpu/drm/bridge/tc358775.c
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -273,6 +273,19 @@ struct tc_data {
u8  bpc;
 };
 
+static const u32 tc_lvds_in_bus_fmts[] = {
+   MEDIA_BUS_FMT_RGB565_1X16,
+   MEDIA_BUS_FMT_RGB666_1X18,
+   MEDIA_BUS_FMT_RGB666_1X24_CPADHI,
+   MEDIA_BUS_FMT_RBG888_1X24,
+};
+
+static const u32 tc_lvds_out_bus_fmts[] = {
+   MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
+   MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+   MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
+};
+
 static inline struct tc_data *bridge_to_tc(struct drm_bridge *b)
 {
return container_of(b, struct tc_data, bridge);
@@ -359,19 +372,6 @@ static void d2l_write(struct i2c_client *i2c, u16 addr, 
u32 val)
ret, addr);
 }
 
-/* helper function to access bus_formats */
-static struct drm_connector *get_connector(struct drm_encoder *encoder)
-{
-   struct drm_device *dev = encoder->dev;
-   struct drm_connector *connector;
-
-   list_for_each_entry(connector, >mode_config.connector_list, head)
-   if (connector->encoder == encoder)
-   return connector;
-
-   return NULL;
-}
-
 static void tc_bridge_enable(struct drm_bridge *bridge)
 {
struct tc_data *tc = bridge_to_tc(bridge);
@@ -380,7 +380,8 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
u32 val = 0;
u16 dsiclk, clkdiv, byteclk, t1, t2, t3, vsdelay;
struct drm_display_mode *mode;
-   struct drm_connector *connector = get_connector(bridge->encoder);
+   struct drm_bridge_state *state =
+   drm_priv_to_bridge_state(bridge->base.state);
 
mode = >encoder->crtc->state->adjusted_mode;
 
@@ -451,14 +452,13 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
d2l_write(tc->i2c, LVPHY0, LV_PHY0_PRBS_ON(4) | LV_PHY0_ND(6));
 
dev_dbg(tc->dev, "bus_formats %04x bpc %d\n",
-   connector->display_info.bus_formats[0],
+   state->output_bus_cfg.format,
tc->bpc);
/*
 * Default hardware register settings of tc358775 configured
 * with MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA jeida-24 format
 */
-   if (connector->display_info.bus_formats[0] ==
-   MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
+   if (state->output_bus_cfg.format == MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
/* VESA-24 */
d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R0, LVI_R1, LVI_R2, 
LVI_R3));
d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R4, LVI_R7, LVI_R5, 
LVI_G0));
@@ -590,6 +590,39 @@ static int tc358775_parse_dt(struct device_node *np, 
struct tc_data *tc)
return 0;
 }
 
+static u32 *
+tc_bridge_get_input_bus_fmts(struct drm_bridge *bridge,
+struct drm_bridge_state *bridge_state,
+struct drm_crtc_state *crtc_state,
+struct drm_connector_state *conn_state,
+u32 output_fmt,
+unsigned int *num_input_fmts)
+{
+   u32 *input_fmts = NULL;
+   unsigned int i;
+
+   *num_input_fmts = 0;
+
+   for (i = 0 ; i < ARRAY_SIZE(tc_lvds_out_bus_fmts) ; ++i) {
+   if (output_fmt == tc_lvds_out_bus_fmts[i])
+   break;
+   }
+
+   if (i == ARRAY_SIZE(tc_lvds_out_bus_fmts))
+   return NULL;
+
+   *num_input_fmts = ARRAY_SIZE(tc_lvds_in_bus_fmts);
+
+   input_fmts = kcalloc(*num_input_fmts, ARRAY_SIZE(tc_lvds_in_bus_fmts),
+GFP_KERNEL);
+   if (!input_fmts)
+   return NULL;
+
+   memcpy(input_fmts, tc_lvds_in_bus_fmts, sizeof(*input_fmts));
+
+   return input_fmts;
+}
+
 static int tc_bridge_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
 {
@@ -639,6 +672,10 @@ 

[PATCH RESEND v2] drm/bridge/tc358775: Fixes bus formats read

2020-10-22 Thread Vinay Simha BN
- atomic_check removed
- video data input and output formats added
- bus formats read from drm_bridge_state.output_bus_cfg.format
  and .atomic_get_input_bus_fmts() instead of connector

Signed-off-by: Vinay Simha BN 

---
v1:
 * Laurent Pinchart review comments incorporated
   drm_bridge_state.output_bus_cfg.format
   instead of connector
v2:
 * Laurent Pinchart review comments incorporated
   atomic_check removed
   video data input and output formats added
---
 drivers/gpu/drm/bridge/tc358775.c | 75 ++-
 1 file changed, 58 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
index 2272adc..cc27570 100644
--- a/drivers/gpu/drm/bridge/tc358775.c
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -271,6 +271,20 @@ struct tc_data {
struct gpio_desc*stby_gpio;
u8  lvds_link; /* single-link or dual-link */
u8  bpc;
+   u32 output_bus_fmt;
+};
+
+static const u32 tc_lvds_in_bus_fmts[] = {
+   MEDIA_BUS_FMT_RGB565_1X16,
+   MEDIA_BUS_FMT_RGB666_1X18,
+   MEDIA_BUS_FMT_RGB666_1X24_CPADHI,
+   MEDIA_BUS_FMT_RBG888_1X24,
+};
+
+static const u32 tc_lvds_out_bus_fmts[] = {
+   MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
+   MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+   MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
 };
 
 static inline struct tc_data *bridge_to_tc(struct drm_bridge *b)
@@ -359,19 +373,6 @@ static void d2l_write(struct i2c_client *i2c, u16 addr, 
u32 val)
ret, addr);
 }
 
-/* helper function to access bus_formats */
-static struct drm_connector *get_connector(struct drm_encoder *encoder)
-{
-   struct drm_device *dev = encoder->dev;
-   struct drm_connector *connector;
-
-   list_for_each_entry(connector, >mode_config.connector_list, head)
-   if (connector->encoder == encoder)
-   return connector;
-
-   return NULL;
-}
-
 static void tc_bridge_enable(struct drm_bridge *bridge)
 {
struct tc_data *tc = bridge_to_tc(bridge);
@@ -380,7 +381,10 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
u32 val = 0;
u16 dsiclk, clkdiv, byteclk, t1, t2, t3, vsdelay;
struct drm_display_mode *mode;
-   struct drm_connector *connector = get_connector(bridge->encoder);
+   struct drm_bridge_state *state =
+   drm_priv_to_bridge_state(bridge->base.state);
+
+   tc->output_bus_fmt = state->output_bus_cfg.format;
 
mode = >encoder->crtc->state->adjusted_mode;
 
@@ -451,14 +455,13 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
d2l_write(tc->i2c, LVPHY0, LV_PHY0_PRBS_ON(4) | LV_PHY0_ND(6));
 
dev_dbg(tc->dev, "bus_formats %04x bpc %d\n",
-   connector->display_info.bus_formats[0],
+   tc->output_bus_fmt,
tc->bpc);
/*
 * Default hardware register settings of tc358775 configured
 * with MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA jeida-24 format
 */
-   if (connector->display_info.bus_formats[0] ==
-   MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
+   if (tc->output_bus_fmt == MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
/* VESA-24 */
d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R0, LVI_R1, LVI_R2, 
LVI_R3));
d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R4, LVI_R7, LVI_R5, 
LVI_G0));
@@ -590,6 +593,40 @@ static int tc358775_parse_dt(struct device_node *np, 
struct tc_data *tc)
return 0;
 }
 
+static u32 *
+tc_bridge_get_input_bus_fmts(struct drm_bridge *bridge,
+struct drm_bridge_state *bridge_state,
+struct drm_crtc_state *crtc_state,
+struct drm_connector_state *conn_state,
+u32 output_fmt,
+unsigned int *num_input_fmts)
+{
+   u32 *input_fmts = NULL;
+   u8 i;
+
+   *num_input_fmts = 0;
+
+   for (i = 0 ; i < ARRAY_SIZE(tc_lvds_out_bus_fmts) ; ++i) {
+   if (output_fmt == tc_lvds_out_bus_fmts[i])
+   break;
+   }
+
+   if (i == ARRAY_SIZE(tc_lvds_out_bus_fmts))
+   return NULL;
+
+   *num_input_fmts = ARRAY_SIZE(tc_lvds_in_bus_fmts);
+
+   input_fmts = kcalloc(*num_input_fmts, ARRAY_SIZE(tc_lvds_in_bus_fmts),
+GFP_KERNEL);
+   if (!input_fmts)
+   return NULL;
+
+   for (i = 0; i < ARRAY_SIZE(tc_lvds_in_bus_fmts); ++i)
+   input_fmts[i] = tc_lvds_in_bus_fmts[i];
+
+   return input_fmts;
+}
+
 static int tc_bridge_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
 {
@@ -639,6 +676,10 @@ static int tc_bridge_attach(struct drm_bridge *bridge,
 }
 
 static const

[PATCH] drm/bridge/tc358775: Fix semicolon

2020-08-27 Thread Vinay Simha BN
Remove unneded semicolon

Reported-by: kernel test robot 
Signed-off-by: Vinay Simha BN 
---
 drivers/gpu/drm/bridge/tc358775.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
index d951cdc..2272adc 100644
--- a/drivers/gpu/drm/bridge/tc358775.c
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -485,7 +485,7 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
val |= TC358775_LVCFG_PCLKDIV(DIVIDE_BY_6);
} else {
val |= TC358775_LVCFG_PCLKDIV(DIVIDE_BY_3);
-   };
+   }
d2l_write(tc->i2c, LVCFG, val);
 }
 
-- 
2.1.2



Re: [PATCH] drm/bridge/tc358775: Fixes bus formats read

2020-08-25 Thread Vinay Simha B N
laurent,

Please review or give some feedback.

On Thu, Aug 13, 2020 at 9:09 PM Vinay Simha B N  wrote:
>
> laurent,
>
> The code sequence was a problem. *num_inputs_fmts =
> ARRAY_SIZE(tc_lvds_in_bus_fmts); should come first and then allocate
> the kcalloc.
>
> input_fmts = kcalloc(*num_input_fmts, ARRAY_SIZE(tc_lvds_in_bus_fmts),
>  GFP_KERNEL);
> ..
> for (i = 0; i < ARRAY_SIZE(tc_lvds_in_bus_fmts); ++i)
> input_fmts[i] = tc_lvds_in_bus_fmts[i];
>
> *num_inputs_fmts = ARRAY_SIZE(tc_lvds_in_bus_fmts);
>
> So, internally in the drm pipeline get set the input format based on
> the output formats?
>
> On Wed, Aug 12, 2020 at 10:45 PM Vinay Simha B N  wrote:
> >
> > laurent,
> >
> > if i add the .atomic_get_input_bus_fmts =
> > tc_bridge_get_input_bus_fmts, with the implementation suggested,
> > system does not boot fully, the reason is, we capture all the
> > supported input formats, but not sure where to set the final input
> > format. Please suggest.
> >
> > for (i = 0; i < ARRAY_SIZE(tc_lvds_in_bus_fmts); ++i)
> > input_fmts[i] = tc_lvds_in_bus_fmts[i];
> >
> > *num_input_fmts = ARRAY_SIZE(tc_lvds_in_bus_fmts);
> >
> > On Wed, Aug 12, 2020 at 8:25 PM Vinay Simha B N  wrote:
> > >
> > > laurent,
> > >
> > > Video data input format :  RGB666 loosely packed 24 bits per pixel
> > > Can we use MEDIA_BUS_FMT_RGB666_1X24_CPADHI? There was no information
> > > wrt CPADHI or for loosely packed
> > >
> > > static const u32 tc_lvds_in_bus_fmts[] = {
> > > MEDIA_BUS_FMT_RGB565_1X16,
> > > MEDIA_BUS_FMT_RGB666_1X18,
> > > MEDIA_BUS_FMT_RGB666_1X24_CPADHI,
> > > MEDIA_BUS_FMT_RBG888_1X24,
> > > };
> > >
> > > for (i = 0; i < ARRAY_SIZE(tc_lvds_in_bus_fmts); ++i)
> > > input_fmts[i] = tc_lvds_in_bus_fmts[i];
> > > >> This will have all the available input formats, but finally which 
> > > >> video data input format chosen?
> > > Since dsi->format = MIPI_DSI_FMT_RGB888 is used does it chooses
> > > MEDIA_BUS_FMT_RBG888_1X24 by the drm pipeline
> > >
> > > On Wed, Aug 12, 2020 at 6:48 PM Laurent Pinchart
> > >  wrote:
> > > >
> > > > Hi Vinay,
> > > >
> > > > On Wed, Aug 12, 2020 at 06:07:52PM +0530, Vinay Simha B N wrote:
> > > > > On Wed, Aug 12, 2020 at 3:24 PM Laurent Pinchart wrote:
> > > > > > On Wed, Aug 12, 2020 at 12:55:50PM +0530, Vinay Simha BN wrote:
> > > > > > > - bus formats read from drm_bridge_state.output_bus_cfg.format
> > > > > > >   and .atomic_get_input_bus_fmts() instead of connector
> > > > > > >
> > > > > > > Signed-off-by: Vinay Simha BN 
> > > > > > >
> > > > > > > ---
> > > > > > >  v1:
> > > > > > >  * Laurent Pinchart review comments incorporated
> > > > > > >drm_bridge_state.output_bus_cfg.format
> > > > > > >instead of connector
> > > > > > > ---
> > > > > > >  drivers/gpu/drm/bridge/tc358775.c | 76 
> > > > > > > ++-
> > > > > > >  1 file changed, 59 insertions(+), 17 deletions(-)
> > > > > > >
> > > > > > > diff --git a/drivers/gpu/drm/bridge/tc358775.c 
> > > > > > > b/drivers/gpu/drm/bridge/tc358775.c
> > > > > > > index 7da15cd..5d8714a 100644
> > > > > > > --- a/drivers/gpu/drm/bridge/tc358775.c
> > > > > > > +++ b/drivers/gpu/drm/bridge/tc358775.c
> > > > > > > @@ -271,6 +271,13 @@ struct tc_data {
> > > > > > >   struct gpio_desc*stby_gpio;
> > > > > > >   u8  lvds_link; /* single-link or 
> > > > > > > dual-link */
> > > > > > >   u8  bpc;
> > > > > > > + u32 output_bus_fmt;
> > > > > > > +};
> > > > > > > +
> > > > > > > +static const u32 tc_lvds_out_bus_fmts[] = {
> > > > > > > + MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
> > > > > > > + MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
> > > > > > > + MEDIA_BUS_

Re: [PATCH] drm/bridge/tc358775: Fix for PTR_ERR

2020-08-23 Thread Vinay Simha B N
Thanks Sam.

On Sun, Aug 23, 2020 at 8:35 PM Sam Ravnborg  wrote:
>
> On Sun, Aug 16, 2020 at 11:20:41AM +0530, Vinay Simha BN wrote:
> > passing zero to 'PTR_ERR'
> >
> > Reported-by: kernel test robot 
> > Signed-off-by: Vinay Simha BN 
>
> Applied to drm-misc-next - thanks.
>
> Sam
>
> > ---
> >  drivers/gpu/drm/bridge/tc358775.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/tc358775.c 
> > b/drivers/gpu/drm/bridge/tc358775.c
> > index 7da15cd..d951cdc 100644
> > --- a/drivers/gpu/drm/bridge/tc358775.c
> > +++ b/drivers/gpu/drm/bridge/tc358775.c
> > @@ -684,7 +684,7 @@ static int tc_probe(struct i2c_client *client, const 
> > struct i2c_device_id *id)
> >
> >   tc->vdd = devm_regulator_get(dev, "vdd-supply");
> >   if (IS_ERR(tc->vdd)) {
> > - ret = PTR_ERR(tc->vddio);
> > + ret = PTR_ERR(tc->vdd);
> >   dev_err(dev, "vdd-supply not found\n");
> >   return ret;
> >   }
> > --
> > 2.7.4
> >
> > ___
> > dri-devel mailing list
> > dri-de...@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
regards,
vinaysimha


[PATCH] drm/bridge/tc358775: Fix for PTR_ERR

2020-08-15 Thread Vinay Simha BN
passing zero to 'PTR_ERR'

Reported-by: kernel test robot 
Signed-off-by: Vinay Simha BN 
---
 drivers/gpu/drm/bridge/tc358775.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
index 7da15cd..d951cdc 100644
--- a/drivers/gpu/drm/bridge/tc358775.c
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -684,7 +684,7 @@ static int tc_probe(struct i2c_client *client, const struct 
i2c_device_id *id)
 
tc->vdd = devm_regulator_get(dev, "vdd-supply");
if (IS_ERR(tc->vdd)) {
-   ret = PTR_ERR(tc->vddio);
+   ret = PTR_ERR(tc->vdd);
dev_err(dev, "vdd-supply not found\n");
return ret;
}
-- 
2.7.4



Re: [PATCH] drm/bridge/tc358775: Fixes bus formats read

2020-08-13 Thread Vinay Simha B N
laurent,

The code sequence was a problem. *num_inputs_fmts =
ARRAY_SIZE(tc_lvds_in_bus_fmts); should come first and then allocate
the kcalloc.

input_fmts = kcalloc(*num_input_fmts, ARRAY_SIZE(tc_lvds_in_bus_fmts),
 GFP_KERNEL);
..
for (i = 0; i < ARRAY_SIZE(tc_lvds_in_bus_fmts); ++i)
input_fmts[i] = tc_lvds_in_bus_fmts[i];

*num_inputs_fmts = ARRAY_SIZE(tc_lvds_in_bus_fmts);

So, internally in the drm pipeline get set the input format based on
the output formats?

On Wed, Aug 12, 2020 at 10:45 PM Vinay Simha B N  wrote:
>
> laurent,
>
> if i add the .atomic_get_input_bus_fmts =
> tc_bridge_get_input_bus_fmts, with the implementation suggested,
> system does not boot fully, the reason is, we capture all the
> supported input formats, but not sure where to set the final input
> format. Please suggest.
>
> for (i = 0; i < ARRAY_SIZE(tc_lvds_in_bus_fmts); ++i)
> input_fmts[i] = tc_lvds_in_bus_fmts[i];
>
> *num_input_fmts = ARRAY_SIZE(tc_lvds_in_bus_fmts);
>
> On Wed, Aug 12, 2020 at 8:25 PM Vinay Simha B N  wrote:
> >
> > laurent,
> >
> > Video data input format :  RGB666 loosely packed 24 bits per pixel
> > Can we use MEDIA_BUS_FMT_RGB666_1X24_CPADHI? There was no information
> > wrt CPADHI or for loosely packed
> >
> > static const u32 tc_lvds_in_bus_fmts[] = {
> > MEDIA_BUS_FMT_RGB565_1X16,
> > MEDIA_BUS_FMT_RGB666_1X18,
> > MEDIA_BUS_FMT_RGB666_1X24_CPADHI,
> > MEDIA_BUS_FMT_RBG888_1X24,
> > };
> >
> > for (i = 0; i < ARRAY_SIZE(tc_lvds_in_bus_fmts); ++i)
> > input_fmts[i] = tc_lvds_in_bus_fmts[i];
> > >> This will have all the available input formats, but finally which video 
> > >> data input format chosen?
> > Since dsi->format = MIPI_DSI_FMT_RGB888 is used does it chooses
> > MEDIA_BUS_FMT_RBG888_1X24 by the drm pipeline
> >
> > On Wed, Aug 12, 2020 at 6:48 PM Laurent Pinchart
> >  wrote:
> > >
> > > Hi Vinay,
> > >
> > > On Wed, Aug 12, 2020 at 06:07:52PM +0530, Vinay Simha B N wrote:
> > > > On Wed, Aug 12, 2020 at 3:24 PM Laurent Pinchart wrote:
> > > > > On Wed, Aug 12, 2020 at 12:55:50PM +0530, Vinay Simha BN wrote:
> > > > > > - bus formats read from drm_bridge_state.output_bus_cfg.format
> > > > > >   and .atomic_get_input_bus_fmts() instead of connector
> > > > > >
> > > > > > Signed-off-by: Vinay Simha BN 
> > > > > >
> > > > > > ---
> > > > > >  v1:
> > > > > >  * Laurent Pinchart review comments incorporated
> > > > > >drm_bridge_state.output_bus_cfg.format
> > > > > >instead of connector
> > > > > > ---
> > > > > >  drivers/gpu/drm/bridge/tc358775.c | 76 
> > > > > > ++-
> > > > > >  1 file changed, 59 insertions(+), 17 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/bridge/tc358775.c 
> > > > > > b/drivers/gpu/drm/bridge/tc358775.c
> > > > > > index 7da15cd..5d8714a 100644
> > > > > > --- a/drivers/gpu/drm/bridge/tc358775.c
> > > > > > +++ b/drivers/gpu/drm/bridge/tc358775.c
> > > > > > @@ -271,6 +271,13 @@ struct tc_data {
> > > > > >   struct gpio_desc*stby_gpio;
> > > > > >   u8  lvds_link; /* single-link or 
> > > > > > dual-link */
> > > > > >   u8  bpc;
> > > > > > + u32 output_bus_fmt;
> > > > > > +};
> > > > > > +
> > > > > > +static const u32 tc_lvds_out_bus_fmts[] = {
> > > > > > + MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
> > > > > > + MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
> > > > > > + MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
> > > > > >  };
> > > > > >
> > > > > >  static inline struct tc_data *bridge_to_tc(struct drm_bridge *b)
> > > > > > @@ -359,19 +366,6 @@ static void d2l_write(struct i2c_client *i2c, 
> > > > > > u16 addr, u32 val)
> > > > > >   ret, addr);
> > > > > >  }
> > > > > >
> > > > > > -/* helper function to access bus_formats */
> > > > > > -static struct drm_conn

[PATCH v2] drm/bridge/tc358775: Fixes bus formats read

2020-08-13 Thread Vinay Simha BN
- atomic_check removed
- video data input and output formats added
- bus formats read from drm_bridge_state.output_bus_cfg.format
  and .atomic_get_input_bus_fmts() instead of connector

Signed-off-by: Vinay Simha BN 

---
v1:
 * Laurent Pinchart review comments incorporated
   drm_bridge_state.output_bus_cfg.format
   instead of connector
v2:
 * Laurent Pinchart review comments incorporated
   atomic_check removed
   video data input and output formats added
---
 drivers/gpu/drm/bridge/tc358775.c | 75 ++-
 1 file changed, 58 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
index 7da15cd..58f87ec 100644
--- a/drivers/gpu/drm/bridge/tc358775.c
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -271,6 +271,20 @@ struct tc_data {
struct gpio_desc*stby_gpio;
u8  lvds_link; /* single-link or dual-link */
u8  bpc;
+   u32 output_bus_fmt;
+};
+
+static const u32 tc_lvds_in_bus_fmts[] = {
+   MEDIA_BUS_FMT_RGB565_1X16,
+   MEDIA_BUS_FMT_RGB666_1X18,
+   MEDIA_BUS_FMT_RGB666_1X24_CPADHI,
+   MEDIA_BUS_FMT_RBG888_1X24,
+};
+
+static const u32 tc_lvds_out_bus_fmts[] = {
+   MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
+   MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+   MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
 };
 
 static inline struct tc_data *bridge_to_tc(struct drm_bridge *b)
@@ -359,19 +373,6 @@ static void d2l_write(struct i2c_client *i2c, u16 addr, 
u32 val)
ret, addr);
 }
 
-/* helper function to access bus_formats */
-static struct drm_connector *get_connector(struct drm_encoder *encoder)
-{
-   struct drm_device *dev = encoder->dev;
-   struct drm_connector *connector;
-
-   list_for_each_entry(connector, >mode_config.connector_list, head)
-   if (connector->encoder == encoder)
-   return connector;
-
-   return NULL;
-}
-
 static void tc_bridge_enable(struct drm_bridge *bridge)
 {
struct tc_data *tc = bridge_to_tc(bridge);
@@ -380,7 +381,10 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
u32 val = 0;
u16 dsiclk, clkdiv, byteclk, t1, t2, t3, vsdelay;
struct drm_display_mode *mode;
-   struct drm_connector *connector = get_connector(bridge->encoder);
+   struct drm_bridge_state *state =
+   drm_priv_to_bridge_state(bridge->base.state);
+
+   tc->output_bus_fmt = state->output_bus_cfg.format;
 
mode = >encoder->crtc->state->adjusted_mode;
 
@@ -451,14 +455,13 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
d2l_write(tc->i2c, LVPHY0, LV_PHY0_PRBS_ON(4) | LV_PHY0_ND(6));
 
dev_dbg(tc->dev, "bus_formats %04x bpc %d\n",
-   connector->display_info.bus_formats[0],
+   tc->output_bus_fmt,
tc->bpc);
/*
 * Default hardware register settings of tc358775 configured
 * with MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA jeida-24 format
 */
-   if (connector->display_info.bus_formats[0] ==
-   MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
+   if (tc->output_bus_fmt == MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
/* VESA-24 */
d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R0, LVI_R1, LVI_R2, 
LVI_R3));
d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R4, LVI_R7, LVI_R5, 
LVI_G0));
@@ -590,6 +593,40 @@ static int tc358775_parse_dt(struct device_node *np, 
struct tc_data *tc)
return 0;
 }
 
+static u32 *
+tc_bridge_get_input_bus_fmts(struct drm_bridge *bridge,
+struct drm_bridge_state *bridge_state,
+struct drm_crtc_state *crtc_state,
+struct drm_connector_state *conn_state,
+u32 output_fmt,
+unsigned int *num_input_fmts)
+{
+   u32 *input_fmts = NULL;
+   u8 i;
+
+   *num_input_fmts = 0;
+
+   for (i = 0 ; i < ARRAY_SIZE(tc_lvds_out_bus_fmts) ; ++i) {
+   if (output_fmt == tc_lvds_out_bus_fmts[i])
+   break;
+   }
+
+   if (i == ARRAY_SIZE(tc_lvds_out_bus_fmts))
+   return NULL;
+
+   *num_input_fmts = ARRAY_SIZE(tc_lvds_in_bus_fmts);
+
+   input_fmts = kcalloc(*num_input_fmts, ARRAY_SIZE(tc_lvds_in_bus_fmts),
+GFP_KERNEL);
+   if (!input_fmts)
+   return NULL;
+
+   for (i = 0; i < ARRAY_SIZE(tc_lvds_in_bus_fmts); ++i)
+   input_fmts[i] = tc_lvds_in_bus_fmts[i];
+
+   return input_fmts;
+}
+
 static int tc_bridge_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
 {
@@ -639,6 +676,10 @@ static int tc_bridge_attach(struct drm_bridge *bridge,
 }
 
 static const

Re: [PATCH] drm/bridge/tc358775: Fixes bus formats read

2020-08-12 Thread Vinay Simha B N
laurent,

if i add the .atomic_get_input_bus_fmts =
tc_bridge_get_input_bus_fmts, with the implementation suggested,
system does not boot fully, the reason is, we capture all the
supported input formats, but not sure where to set the final input
format. Please suggest.

for (i = 0; i < ARRAY_SIZE(tc_lvds_in_bus_fmts); ++i)
input_fmts[i] = tc_lvds_in_bus_fmts[i];

*num_input_fmts = ARRAY_SIZE(tc_lvds_in_bus_fmts);

On Wed, Aug 12, 2020 at 8:25 PM Vinay Simha B N  wrote:
>
> laurent,
>
> Video data input format :  RGB666 loosely packed 24 bits per pixel
> Can we use MEDIA_BUS_FMT_RGB666_1X24_CPADHI? There was no information
> wrt CPADHI or for loosely packed
>
> static const u32 tc_lvds_in_bus_fmts[] = {
> MEDIA_BUS_FMT_RGB565_1X16,
> MEDIA_BUS_FMT_RGB666_1X18,
> MEDIA_BUS_FMT_RGB666_1X24_CPADHI,
> MEDIA_BUS_FMT_RBG888_1X24,
> };
>
> for (i = 0; i < ARRAY_SIZE(tc_lvds_in_bus_fmts); ++i)
> input_fmts[i] = tc_lvds_in_bus_fmts[i];
> >> This will have all the available input formats, but finally which video 
> >> data input format chosen?
> Since dsi->format = MIPI_DSI_FMT_RGB888 is used does it chooses
> MEDIA_BUS_FMT_RBG888_1X24 by the drm pipeline
>
> On Wed, Aug 12, 2020 at 6:48 PM Laurent Pinchart
>  wrote:
> >
> > Hi Vinay,
> >
> > On Wed, Aug 12, 2020 at 06:07:52PM +0530, Vinay Simha B N wrote:
> > > On Wed, Aug 12, 2020 at 3:24 PM Laurent Pinchart wrote:
> > > > On Wed, Aug 12, 2020 at 12:55:50PM +0530, Vinay Simha BN wrote:
> > > > > - bus formats read from drm_bridge_state.output_bus_cfg.format
> > > > >   and .atomic_get_input_bus_fmts() instead of connector
> > > > >
> > > > > Signed-off-by: Vinay Simha BN 
> > > > >
> > > > > ---
> > > > >  v1:
> > > > >  * Laurent Pinchart review comments incorporated
> > > > >drm_bridge_state.output_bus_cfg.format
> > > > >instead of connector
> > > > > ---
> > > > >  drivers/gpu/drm/bridge/tc358775.c | 76 
> > > > > ++-
> > > > >  1 file changed, 59 insertions(+), 17 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/bridge/tc358775.c 
> > > > > b/drivers/gpu/drm/bridge/tc358775.c
> > > > > index 7da15cd..5d8714a 100644
> > > > > --- a/drivers/gpu/drm/bridge/tc358775.c
> > > > > +++ b/drivers/gpu/drm/bridge/tc358775.c
> > > > > @@ -271,6 +271,13 @@ struct tc_data {
> > > > >   struct gpio_desc*stby_gpio;
> > > > >   u8  lvds_link; /* single-link or dual-link 
> > > > > */
> > > > >   u8  bpc;
> > > > > + u32 output_bus_fmt;
> > > > > +};
> > > > > +
> > > > > +static const u32 tc_lvds_out_bus_fmts[] = {
> > > > > + MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
> > > > > + MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
> > > > > + MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
> > > > >  };
> > > > >
> > > > >  static inline struct tc_data *bridge_to_tc(struct drm_bridge *b)
> > > > > @@ -359,19 +366,6 @@ static void d2l_write(struct i2c_client *i2c, 
> > > > > u16 addr, u32 val)
> > > > >   ret, addr);
> > > > >  }
> > > > >
> > > > > -/* helper function to access bus_formats */
> > > > > -static struct drm_connector *get_connector(struct drm_encoder 
> > > > > *encoder)
> > > > > -{
> > > > > - struct drm_device *dev = encoder->dev;
> > > > > - struct drm_connector *connector;
> > > > > -
> > > > > - list_for_each_entry(connector, 
> > > > > >mode_config.connector_list, head)
> > > > > - if (connector->encoder == encoder)
> > > > > - return connector;
> > > > > -
> > > > > - return NULL;
> > > > > -}
> > > > > -
> > > > >  static void tc_bridge_enable(struct drm_bridge *bridge)
> > > > >  {
> > > > >   struct tc_data *tc = bridge_to_tc(bridge);
> > > > > @@ -380,7 +374,6 @@ static void tc_bridge_enable(struct drm_bridge 
> > > > > *bridge)
> > > > >   u32 val = 0;
>

Re: [PATCH] drm/bridge/tc358775: Fixes bus formats read

2020-08-12 Thread Vinay Simha B N
laurent,

Video data input format :  RGB666 loosely packed 24 bits per pixel
Can we use MEDIA_BUS_FMT_RGB666_1X24_CPADHI? There was no information
wrt CPADHI or for loosely packed

static const u32 tc_lvds_in_bus_fmts[] = {
MEDIA_BUS_FMT_RGB565_1X16,
MEDIA_BUS_FMT_RGB666_1X18,
MEDIA_BUS_FMT_RGB666_1X24_CPADHI,
MEDIA_BUS_FMT_RBG888_1X24,
};

for (i = 0; i < ARRAY_SIZE(tc_lvds_in_bus_fmts); ++i)
input_fmts[i] = tc_lvds_in_bus_fmts[i];
>> This will have all the available input formats, but finally which video data 
>> input format chosen?
Since dsi->format = MIPI_DSI_FMT_RGB888 is used does it chooses
MEDIA_BUS_FMT_RBG888_1X24 by the drm pipeline

On Wed, Aug 12, 2020 at 6:48 PM Laurent Pinchart
 wrote:
>
> Hi Vinay,
>
> On Wed, Aug 12, 2020 at 06:07:52PM +0530, Vinay Simha B N wrote:
> > On Wed, Aug 12, 2020 at 3:24 PM Laurent Pinchart wrote:
> > > On Wed, Aug 12, 2020 at 12:55:50PM +0530, Vinay Simha BN wrote:
> > > > - bus formats read from drm_bridge_state.output_bus_cfg.format
> > > >   and .atomic_get_input_bus_fmts() instead of connector
> > > >
> > > > Signed-off-by: Vinay Simha BN 
> > > >
> > > > ---
> > > >  v1:
> > > >  * Laurent Pinchart review comments incorporated
> > > >drm_bridge_state.output_bus_cfg.format
> > > >instead of connector
> > > > ---
> > > >  drivers/gpu/drm/bridge/tc358775.c | 76 
> > > > ++-
> > > >  1 file changed, 59 insertions(+), 17 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/bridge/tc358775.c 
> > > > b/drivers/gpu/drm/bridge/tc358775.c
> > > > index 7da15cd..5d8714a 100644
> > > > --- a/drivers/gpu/drm/bridge/tc358775.c
> > > > +++ b/drivers/gpu/drm/bridge/tc358775.c
> > > > @@ -271,6 +271,13 @@ struct tc_data {
> > > >   struct gpio_desc*stby_gpio;
> > > >   u8  lvds_link; /* single-link or dual-link */
> > > >   u8  bpc;
> > > > + u32 output_bus_fmt;
> > > > +};
> > > > +
> > > > +static const u32 tc_lvds_out_bus_fmts[] = {
> > > > + MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
> > > > + MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
> > > > + MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
> > > >  };
> > > >
> > > >  static inline struct tc_data *bridge_to_tc(struct drm_bridge *b)
> > > > @@ -359,19 +366,6 @@ static void d2l_write(struct i2c_client *i2c, u16 
> > > > addr, u32 val)
> > > >   ret, addr);
> > > >  }
> > > >
> > > > -/* helper function to access bus_formats */
> > > > -static struct drm_connector *get_connector(struct drm_encoder *encoder)
> > > > -{
> > > > - struct drm_device *dev = encoder->dev;
> > > > - struct drm_connector *connector;
> > > > -
> > > > - list_for_each_entry(connector, >mode_config.connector_list, 
> > > > head)
> > > > - if (connector->encoder == encoder)
> > > > - return connector;
> > > > -
> > > > - return NULL;
> > > > -}
> > > > -
> > > >  static void tc_bridge_enable(struct drm_bridge *bridge)
> > > >  {
> > > >   struct tc_data *tc = bridge_to_tc(bridge);
> > > > @@ -380,7 +374,6 @@ static void tc_bridge_enable(struct drm_bridge 
> > > > *bridge)
> > > >   u32 val = 0;
> > > >   u16 dsiclk, clkdiv, byteclk, t1, t2, t3, vsdelay;
> > > >   struct drm_display_mode *mode;
> > > > - struct drm_connector *connector = get_connector(bridge->encoder);
> > > >
> > > >   mode = >encoder->crtc->state->adjusted_mode;
> > > >
> > > > @@ -451,14 +444,13 @@ static void tc_bridge_enable(struct drm_bridge 
> > > > *bridge)
> > > >   d2l_write(tc->i2c, LVPHY0, LV_PHY0_PRBS_ON(4) | LV_PHY0_ND(6));
> > > >
> > > >   dev_dbg(tc->dev, "bus_formats %04x bpc %d\n",
> > > > - connector->display_info.bus_formats[0],
> > > > + tc->output_bus_fmt,
> > > >   tc->bpc);
> > > >   /*
> > > >* Default hardware register settings of tc358775 configured
> > > >   

Re: [PATCH] drm/bridge/tc358775: Fixes bus formats read

2020-08-12 Thread Vinay Simha B N
laurent,

please see the reply inline below.

On Wed, Aug 12, 2020 at 3:24 PM Laurent Pinchart
 wrote:
>
> Hi Vinay,
>
> Thank you for the patch.
>
> On Wed, Aug 12, 2020 at 12:55:50PM +0530, Vinay Simha BN wrote:
> > - bus formats read from drm_bridge_state.output_bus_cfg.format
> >   and .atomic_get_input_bus_fmts() instead of connector
> >
> > Signed-off-by: Vinay Simha BN 
> >
> > ---
> >  v1:
> >  * Laurent Pinchart review comments incorporated
> >drm_bridge_state.output_bus_cfg.format
> >instead of connector
> > ---
> >  drivers/gpu/drm/bridge/tc358775.c | 76 
> > ++-
> >  1 file changed, 59 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/tc358775.c 
> > b/drivers/gpu/drm/bridge/tc358775.c
> > index 7da15cd..5d8714a 100644
> > --- a/drivers/gpu/drm/bridge/tc358775.c
> > +++ b/drivers/gpu/drm/bridge/tc358775.c
> > @@ -271,6 +271,13 @@ struct tc_data {
> >   struct gpio_desc*stby_gpio;
> >   u8  lvds_link; /* single-link or dual-link */
> >   u8  bpc;
> > + u32 output_bus_fmt;
> > +};
> > +
> > +static const u32 tc_lvds_out_bus_fmts[] = {
> > + MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
> > + MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
> > + MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
> >  };
> >
> >  static inline struct tc_data *bridge_to_tc(struct drm_bridge *b)
> > @@ -359,19 +366,6 @@ static void d2l_write(struct i2c_client *i2c, u16 
> > addr, u32 val)
> >   ret, addr);
> >  }
> >
> > -/* helper function to access bus_formats */
> > -static struct drm_connector *get_connector(struct drm_encoder *encoder)
> > -{
> > - struct drm_device *dev = encoder->dev;
> > - struct drm_connector *connector;
> > -
> > - list_for_each_entry(connector, >mode_config.connector_list, head)
> > - if (connector->encoder == encoder)
> > - return connector;
> > -
> > - return NULL;
> > -}
> > -
> >  static void tc_bridge_enable(struct drm_bridge *bridge)
> >  {
> >   struct tc_data *tc = bridge_to_tc(bridge);
> > @@ -380,7 +374,6 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
> >   u32 val = 0;
> >   u16 dsiclk, clkdiv, byteclk, t1, t2, t3, vsdelay;
> >   struct drm_display_mode *mode;
> > - struct drm_connector *connector = get_connector(bridge->encoder);
> >
> >   mode = >encoder->crtc->state->adjusted_mode;
> >
> > @@ -451,14 +444,13 @@ static void tc_bridge_enable(struct drm_bridge 
> > *bridge)
> >   d2l_write(tc->i2c, LVPHY0, LV_PHY0_PRBS_ON(4) | LV_PHY0_ND(6));
> >
> >   dev_dbg(tc->dev, "bus_formats %04x bpc %d\n",
> > - connector->display_info.bus_formats[0],
> > + tc->output_bus_fmt,
> >   tc->bpc);
> >   /*
> >* Default hardware register settings of tc358775 configured
> >* with MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA jeida-24 format
> >*/
> > - if (connector->display_info.bus_formats[0] ==
> > - MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
> > + if (tc->output_bus_fmt == MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
> >   /* VESA-24 */
> >   d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R0, LVI_R1, LVI_R2, 
> > LVI_R3));
> >   d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R4, LVI_R7, LVI_R5, 
> > LVI_G0));
> > @@ -590,6 +582,51 @@ static int tc358775_parse_dt(struct device_node *np, 
> > struct tc_data *tc)
> >   return 0;
> >  }
> >
> > +static int tc_bridge_atomic_check(struct drm_bridge *bridge,
> > +   struct drm_bridge_state *bridge_state,
> > +   struct drm_crtc_state *crtc_state,
> > +   struct drm_connector_state *conn_state)
> > +{
> > + struct tc_data *tc = bridge_to_tc(bridge);
> > +
> > + tc->output_bus_fmt = bridge_state->output_bus_cfg.format;
>
> .atomic_check() isn't allowed to modify the device state, neither the
> hardware state nor the software state in drm_bridge or tc_data. You can
> instead access the bridge state directly in tc_bridge_enable(), with
>
> struct drm_bridge_state *state =
> drm_priv_to_bridge_state(bridge->base.state);
>
Currently the driver is picking

Re: [PATCH v8 2/2] display/drm/bridge: TC358775 DSI/LVDS driver

2020-08-12 Thread Vinay Simha B N
sam/laurent,

[PATCH] drm/bridge/tc358775: Fixes bus formats read

is on top of drm-misc-next.


On Wed, Aug 12, 2020 at 7:50 AM Vinay Simha B N  wrote:
>
> Sam,
>
> I will look into this and send the patch ASAP.
>
> On Wed, Aug 12, 2020 at 12:47 AM Sam Ravnborg  wrote:
>>
>> Hi Vinay.
>>
>> > >
>> > > If Laurent or others identify further things to improve we can take
>> > > it in-tree.
>> >
>> > Just one thing, please see below.
>> >
>> > > > > >> +   d2l_write(tc->i2c, VTIM1, vtime1);
>> > > > > >> +   d2l_write(tc->i2c, HTIM2, htime2);
>> > > > > >> +   d2l_write(tc->i2c, VTIM2, vtime2);
>> > > > > >> +
>> > > > > >> +   d2l_write(tc->i2c, VFUEN, VFUEN_EN);
>> > > > > >> +   d2l_write(tc->i2c, SYSRST, SYS_RST_LCD);
>> > > > > >> +   d2l_write(tc->i2c, LVPHY0, LV_PHY0_PRBS_ON(4) | 
>> > > > > >> LV_PHY0_ND(6));
>> > > > > >> +
>> > > > > >> +   dev_dbg(tc->dev, "bus_formats %04x bpc %d\n",
>> > > > > >> +   connector->display_info.bus_formats[0],
>> > > > > >> +   tc->bpc);
>> > > > > >> +   /*
>> > > > > >> +* Default hardware register settings of tc358775 
>> > > > > >> configured
>> > > > > >> +* with MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA jeida-24 format
>> > > > > >> +*/
>> > > > > >> +   if (connector->display_info.bus_formats[0] ==
>> > > > > >> +   MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
>> >
>> > This shouldn't come from the connector, but from the
>> > drm_bridge_state.output_bus_cfg.format. The drm_bridge_funcs
>> > .atomic_get_input_bus_fmts() operation likely needs to be implemented.
>>
>> I trust you will look into this and submit a patch on top of
>> drm-misc-next.
>> Please add a proper "Fixes:" tag identifying the commit that introduced
>> this bug - in this case the commit introducing the driver.
>>
>> Do not hesitate to reply to all if you have any questions.
>> We will help you if we can.
>>
>> Sam
>
>
>
> --
> regards,
> vinaysimha



-- 
regards,
vinaysimha


[PATCH] drm/bridge/tc358775: Fixes bus formats read

2020-08-12 Thread Vinay Simha BN
- bus formats read from drm_bridge_state.output_bus_cfg.format
  and .atomic_get_input_bus_fmts() instead of connector

Signed-off-by: Vinay Simha BN 

---
 v1:
 * Laurent Pinchart review comments incorporated
   drm_bridge_state.output_bus_cfg.format
   instead of connector
---
 drivers/gpu/drm/bridge/tc358775.c | 76 ++-
 1 file changed, 59 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
index 7da15cd..5d8714a 100644
--- a/drivers/gpu/drm/bridge/tc358775.c
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -271,6 +271,13 @@ struct tc_data {
struct gpio_desc*stby_gpio;
u8  lvds_link; /* single-link or dual-link */
u8  bpc;
+   u32 output_bus_fmt;
+};
+
+static const u32 tc_lvds_out_bus_fmts[] = {
+   MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
+   MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+   MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
 };
 
 static inline struct tc_data *bridge_to_tc(struct drm_bridge *b)
@@ -359,19 +366,6 @@ static void d2l_write(struct i2c_client *i2c, u16 addr, 
u32 val)
ret, addr);
 }
 
-/* helper function to access bus_formats */
-static struct drm_connector *get_connector(struct drm_encoder *encoder)
-{
-   struct drm_device *dev = encoder->dev;
-   struct drm_connector *connector;
-
-   list_for_each_entry(connector, >mode_config.connector_list, head)
-   if (connector->encoder == encoder)
-   return connector;
-
-   return NULL;
-}
-
 static void tc_bridge_enable(struct drm_bridge *bridge)
 {
struct tc_data *tc = bridge_to_tc(bridge);
@@ -380,7 +374,6 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
u32 val = 0;
u16 dsiclk, clkdiv, byteclk, t1, t2, t3, vsdelay;
struct drm_display_mode *mode;
-   struct drm_connector *connector = get_connector(bridge->encoder);
 
mode = >encoder->crtc->state->adjusted_mode;
 
@@ -451,14 +444,13 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
d2l_write(tc->i2c, LVPHY0, LV_PHY0_PRBS_ON(4) | LV_PHY0_ND(6));
 
dev_dbg(tc->dev, "bus_formats %04x bpc %d\n",
-   connector->display_info.bus_formats[0],
+   tc->output_bus_fmt,
tc->bpc);
/*
 * Default hardware register settings of tc358775 configured
 * with MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA jeida-24 format
 */
-   if (connector->display_info.bus_formats[0] ==
-   MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
+   if (tc->output_bus_fmt == MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
/* VESA-24 */
d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R0, LVI_R1, LVI_R2, 
LVI_R3));
d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R4, LVI_R7, LVI_R5, 
LVI_G0));
@@ -590,6 +582,51 @@ static int tc358775_parse_dt(struct device_node *np, 
struct tc_data *tc)
return 0;
 }
 
+static int tc_bridge_atomic_check(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state)
+{
+   struct tc_data *tc = bridge_to_tc(bridge);
+
+   tc->output_bus_fmt = bridge_state->output_bus_cfg.format;
+
+   dev_dbg(tc->dev, "output_bus_fmt %04x\n", tc->output_bus_fmt);
+
+   return 0;
+}
+
+static u32 *
+tc_bridge_get_input_bus_fmts(struct drm_bridge *bridge,
+struct drm_bridge_state *bridge_state,
+struct drm_crtc_state *crtc_state,
+struct drm_connector_state *conn_state,
+u32 output_fmt,
+unsigned int *num_input_fmts)
+{
+   u32 *input_fmts = NULL;
+   int i;
+
+   *num_input_fmts = 0;
+
+   for (i = 0 ; i < ARRAY_SIZE(tc_lvds_out_bus_fmts) ; ++i) {
+   if (output_fmt == tc_lvds_out_bus_fmts[i]) {
+   *num_input_fmts = 1;
+   input_fmts = kcalloc(*num_input_fmts,
+sizeof(*input_fmts),
+GFP_KERNEL);
+   if (!input_fmts)
+   return NULL;
+
+   input_fmts[0] = output_fmt;
+
+   break;
+   }
+   }
+
+   return input_fmts;
+}
+
 static int tc_bridge_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
 {
@@ -639,6 +676,11 @@ static int tc_bridge_attach(struct drm_bridge *bridge,
 }
 
 static const struct drm_bridge_funcs tc_bridge_funcs = {
+   .atomic_dup

[PATCH v8 2/2] display/drm/bridge: TC358775 DSI/LVDS driver

2020-07-10 Thread Vinay Simha BN
This driver is tested with two panels individually with Apq8016-IFC6309 board
https://www.inforcecomputing.com/products/single-board-computers-sbc/qualcomm-snapdragon-410-inforce-6309-micro-sbc

1. 1366x768@60 auo,b101xtn01 data-mapping = "jeida-24"
2. 800x480@60 innolux,at070tn92 data-mapping = "vesa-24"

- power off sequence in proper order
- put_unaligned_be16, put_unaligned_le32 macros used
- static function for mode_valid
- len initialized
- MODE_CLOCK_HIGH handled properly
- bus_formats handeld in mode_valid
- GENMASK and FIELD_PREP used
- Kconfig proper indentation
- error handling enpoint data-lanes
- check for bus_formats unsupported
- display_timings naming local variables
- help modified
- ~vsdelay dynamic value set based on the
  calculation of dsi speed, output speed, blanking
- panel->connector_type removed
- dual port implemented
- devm_drm_panel_bridge_add method used instead of panel
  description modified
- regulator enable and disable with proper orders and delays
  as per the spec
- removed drm_connector_status
- added bus_formats
- mdelay to usleep_range
- magic number to macros for CLRSI and mux registers
  description modified
- replaced u32 instead of uint32_t
- updated alphabetic order of headers
- added SPDX identifier license

Signed-off-by: Vinay Simha BN 

---
v1:
 Initial version

v2:
* Andrzej Hajda review comments incorporated
  SPDX identifier
  development debug removed
  alphabetic order headers
  u32 instead of unit32_t
  magic numbers to macros for CLRSI and mux registers
  ignored return value

* Laurent Pinchart review comments incorporated
  mdelay to usleep_range
  bus_formats added

v3:
* Andrzej Hajda review comments incorporated
  drm_connector_status removed
  u32 rev removed and local variabl is used
  regulator enable disable with proper orders and delays
  as per the spec
  devm_drm_panel_bridge_add method used instead of panel
  description modified
  dual port implemented

v4:
* Sam Ravnborg review comments incorporated
  panel->connector_type removed

* Reported-by: kernel test robot 
  parse_dt to static function
  removed the if (endpoint), since data-lanes has to be
  present for dsi dts ports

v5:
  ~vsdelay dynamic value set based on the
  calculation of dsi speed, output speed, blanking

v6:
* Sam Ravnborg review comments incorporated
  help modified
  display_timings naming local variables
  check for bus_formats unsupported
  error handling enpoint data-lanes

v7:
* Sam Ravnborg review comments incorporated
  Kconfig proper indentation
  GENMASK and FIELD_PREP used
  bus_formats handeld in mode_valid
  MODE_CLOCK_HIGH handled properly

* Reported-by: kernel test robot 
  len initialized
  static function for mode_valid

v8:
* Andrzej Hajda review comments incorporated
  power off sequence in proper order
  put_unaligned_be16, put_unaligned_le32 macros used
* change log modified in reverse chronological order
---
 drivers/gpu/drm/bridge/Kconfig|  10 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/tc358775.c | 749 ++
 3 files changed, 760 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/tc358775.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 43271c2..25c3097 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -181,6 +181,16 @@ config DRM_TOSHIBA_TC358768
help
  Toshiba TC358768AXBG/TC358778XBG DSI bridge chip driver.
 
+config DRM_TOSHIBA_TC358775
+   tristate "Toshiba TC358775 DSI/LVDS bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   select DRM_PANEL
+   select DRM_MIPI_DSI
+   help
+ Toshiba TC358775 DSI/LVDS bridge chip driver.
+
 config DRM_TI_TFP410
tristate "TI TFP410 DVI/HDMI bridge"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index d63d4b7..23c770b 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358768) += tc358768.o
+obj-$(CONFIG_DRM_TOSHIBA_TC358775) += tc358775.o
 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
 obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
 obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
new file mode 100644
index 000..7da15cd
--- /dev/null
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -0,0 +1,749 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * TC358775 DSI to LVDS bridge driver
+ *
+ * Copyright (C) 2020 SMART Wireless Computing
+ * Author: Vinay Simha BN 
+ *
+ */
+/* #define DEBUG */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 

[PATCH v8 1/2] dt-binding: Add DSI/LVDS TC358775 bridge bindings

2020-07-10 Thread Vinay Simha BN
- license modified to (GPL-2.0-only OR BSD-2-Clause)
- single-link and dual-link lvds description and
  examples are added
- proper indentation
- VESA/JEIDA formats picked from panel-lvds dts
- dsi data-lanes property removed, it will be picked
  from dsi0 ports
- dual-link lvds port added and implemented
- converted from .txt to .yaml

Signed-off-by: Vinay Simha BN 
Reviewed-by: Sam Ravnborg 
Reviewed-by: Rob Herring 
---
v1:
 Initial version wast .txt file

v2:
 From txt to yaml file format

v3:
* Andrzej Hajda review comments incorporated
  dual port lvds implemented

* Laurent Pinchart review comments incorporated
  dsi lanes property removed and it is dynamically
  picked from the dsi ports
  VESA/JEIDA format picked from panel-lvds dts

v4:
* Sam Ravnborg review comments incorporated
  }' is indented properly in examples data-lanes
  description for single-link and dual-link lvds

v5:
* Sam Ravnborg review comments incorporated
  license modified to (GPL-2.0-only OR BSD-2-Clause)
  changelog added

v6:
* No changes, revision version mentioned to inline with
  driver file

v7:
* change log added
  Reviewed-by: Sam Ravnborg 

v8:
* Reviewed-by: Rob Herring 
* change log modified in reverse chronological order
---
 .../bindings/display/bridge/toshiba,tc358775.yaml  | 215 +
 1 file changed, 215 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml 
b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
new file mode 100644
index 000..31f085d
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
@@ -0,0 +1,215 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/toshiba,tc358775.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Toshiba TC358775 DSI to LVDS bridge bindings
+
+maintainers:
+ - Vinay Simha BN 
+
+description: |
+ This binding supports DSI to LVDS bridge TC358775
+
+ MIPI DSI-RX Data 4-lane, CLK 1-lane with data rates up to 800 Mbps/lane.
+ Video frame size:
+ Up to 1600x1200 24-bit/pixel resolution for single-link LVDS display panel
+ limited by 135 MHz LVDS speed
+ Up to WUXGA (1920x1200 24-bit pixels) resolution for dual-link LVDS display
+ panel, limited by 270 MHz LVDS speed.
+
+properties:
+  compatible:
+const: toshiba,tc358775
+
+  reg:
+maxItems: 1
+description: i2c address of the bridge, 0x0f
+
+  vdd-supply:
+maxItems: 1
+description:  1.2V LVDS Power Supply
+
+  vddio-supply:
+maxItems: 1
+description: 1.8V IO Power Supply
+
+  stby-gpios:
+maxItems: 1
+description: Standby pin, Low active
+
+  reset-gpios:
+maxItems: 1
+description: Hardware reset, Low active
+
+  ports:
+type: object
+description:
+  A node containing input and output port nodes with endpoint definitions
+  as documented in
+  Documentation/devicetree/bindings/media/video-interfaces.txt
+properties:
+  "#address-cells":
+const: 1
+
+  "#size-cells":
+const: 0
+
+  port@0:
+type: object
+description: |
+  DSI Input. The remote endpoint phandle should be a
+  reference to a valid mipi_dsi_host device node.
+
+  port@1:
+type: object
+description: |
+  Video port for LVDS output (panel or connector).
+
+  port@2:
+type: object
+description: |
+  Video port for Dual link LVDS output (panel or connector).
+
+required:
+  - port@0
+  - port@1
+
+required:
+ - compatible
+ - reg
+ - vdd-supply
+ - vddio-supply
+ - stby-gpios
+ - reset-gpios
+ - ports
+
+examples:
+ - |
+#include 
+
+/* For single-link LVDS display panel */
+
+i2c@78b8000 {
+/* On High speed expansion */
+label = "HS-I2C2";
+reg = <0x078b8000 0x500>;
+clock-frequency = <40>; /* fastmode operation */
+#address-cells = <1>;
+#size-cells = <0>;
+
+tc_bridge: bridge@f {
+compatible = "toshiba,tc358775";
+reg = <0x0f>;
+
+vdd-supply = <_l2>;
+vddio-supply = <_l6>;
+
+stby-gpios = < 99 GPIO_ACTIVE_LOW>;
+reset-gpios = < 72 GPIO_ACTIVE_LOW>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+d2l_in_test: endpoint {
+remote-endpoint = <_out>;
+};
+};
+
+port@1 {
+reg = <1>;
+lvds_out: endpoint {
+remote-endpoint = <_in>;
+ 

[PATCH v7 1/2] dt-binding: Add DSI/LVDS TC358775 bridge bindings

2020-07-04 Thread Vinay Simha BN
- converted from .txt to .yaml
- dual-link lvds port added and implemented
- dsi data-lanes property removed, it will be picked
  from dsi0 ports
- VESA/JEIDA formats picked from panel-lvds dts
- proper indentation
- single-link and dual-link lvds description and
  examples are added
- license modified to (GPL-2.0-only OR BSD-2-Clause)

Signed-off-by: Vinay Simha BN 

---
v1:
 Initial version wast .txt file

v2:
 From txt to yaml file format

v3:
* Andrzej Hajda review comments incorporated
  dual port lvds implemented

* Laurent Pinchart review comments incorporated
  dsi lanes property removed and it is dynamically
  picked from the dsi ports
  VESA/JEIDA format picked from panel-lvds dts

v4:
* Sam Ravnborg review comments incorporated
  }' is indented properly in examples data-lanes
  description for single-link and dual-link lvds

v5:
* Sam Ravnborg review comments incorporated
  license modified to (GPL-2.0-only OR BSD-2-Clause)
  changelog added
---
 .../display/bridge/toshiba,tc358775.yaml  | 215 ++
 1 file changed, 215 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml 
b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
new file mode 100644
index ..31f085d8ab13
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
@@ -0,0 +1,215 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/toshiba,tc358775.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Toshiba TC358775 DSI to LVDS bridge bindings
+
+maintainers:
+ - Vinay Simha BN 
+
+description: |
+ This binding supports DSI to LVDS bridge TC358775
+
+ MIPI DSI-RX Data 4-lane, CLK 1-lane with data rates up to 800 Mbps/lane.
+ Video frame size:
+ Up to 1600x1200 24-bit/pixel resolution for single-link LVDS display panel
+ limited by 135 MHz LVDS speed
+ Up to WUXGA (1920x1200 24-bit pixels) resolution for dual-link LVDS display
+ panel, limited by 270 MHz LVDS speed.
+
+properties:
+  compatible:
+const: toshiba,tc358775
+
+  reg:
+maxItems: 1
+description: i2c address of the bridge, 0x0f
+
+  vdd-supply:
+maxItems: 1
+description:  1.2V LVDS Power Supply
+
+  vddio-supply:
+maxItems: 1
+description: 1.8V IO Power Supply
+
+  stby-gpios:
+maxItems: 1
+description: Standby pin, Low active
+
+  reset-gpios:
+maxItems: 1
+description: Hardware reset, Low active
+
+  ports:
+type: object
+description:
+  A node containing input and output port nodes with endpoint definitions
+  as documented in
+  Documentation/devicetree/bindings/media/video-interfaces.txt
+properties:
+  "#address-cells":
+const: 1
+
+  "#size-cells":
+const: 0
+
+  port@0:
+type: object
+description: |
+  DSI Input. The remote endpoint phandle should be a
+  reference to a valid mipi_dsi_host device node.
+
+  port@1:
+type: object
+description: |
+  Video port for LVDS output (panel or connector).
+
+  port@2:
+type: object
+description: |
+  Video port for Dual link LVDS output (panel or connector).
+
+required:
+  - port@0
+  - port@1
+
+required:
+ - compatible
+ - reg
+ - vdd-supply
+ - vddio-supply
+ - stby-gpios
+ - reset-gpios
+ - ports
+
+examples:
+ - |
+#include 
+
+/* For single-link LVDS display panel */
+
+i2c@78b8000 {
+/* On High speed expansion */
+label = "HS-I2C2";
+reg = <0x078b8000 0x500>;
+clock-frequency = <40>; /* fastmode operation */
+#address-cells = <1>;
+#size-cells = <0>;
+
+tc_bridge: bridge@f {
+compatible = "toshiba,tc358775";
+reg = <0x0f>;
+
+vdd-supply = <_l2>;
+vddio-supply = <_l6>;
+
+stby-gpios = < 99 GPIO_ACTIVE_LOW>;
+reset-gpios = < 72 GPIO_ACTIVE_LOW>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+d2l_in_test: endpoint {
+remote-endpoint = <_out>;
+};
+};
+
+port@1 {
+reg = <1>;
+lvds_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+};
+};
+};
+
+dsi@1a98000 {
+reg = <0x1a98000 0x25c>;
+reg-names = "dsi_ctrl";
+
+ports {
+#address-cells = <1>;
+#si

[PATCH v7 2/2] display/drm/bridge: TC358775 DSI/LVDS driver

2020-07-04 Thread Vinay Simha BN
This driver is tested with two panels individually with Apq8016-IFC6309 board
https://www.inforcecomputing.com/products/single-board-computers-sbc/qualcomm-snapdragon-410-inforce-6309-micro-sbc

1. 1366x768@60 auo,b101xtn01 data-mapping = "jeida-24"
2. 800x480@60 innolux,at070tn92 data-mapping = "vesa-24"

- added SPDX identifier license
- updated alphabetic order of headers
- replaced u32 instead of uint32_t
- magic number to macros for CLRSI and mux registers
- mdelay to usleep_range
- added bus_formats
- removed drm_connector_status
- regulator enable and disable with proper orders and delays
  as per the spec
- devm_drm_panel_bridge_add method used instead of panel
  description modified
- dual port implemented
- panel->connector_type removed
- ~vsdelay dynamic value set based on the
  calculation of dsi speed, output speed, blanking
- help modified
- display_timings naming local variables
- check for bus_formats unsupported
- error handling enpoint data-lanes
- Kconfig proper indentation
- GENMASK and FIELD_PREP used
- bus_formats handeld in mode_valid
- MODE_CLOCK_HIGH handled properly
- len initialized
- static function for mode_valid

Signed-off-by: Vinay Simha BN 
---
v1:
 Initial version

v2:
* Andrzej Hajda review comments incorporated
  SPDX identifier
  development debug removed
  alphabetic order headers
  u32 instead of unit32_t
  magic numbers to macros for CLRSI and mux registers
  ignored return value

* Laurent Pinchart review comments incorporated
  mdelay to usleep_range
  bus_formats added

v3:
* Andrzej Hajda review comments incorporated
  drm_connector_status removed
  u32 rev removed and local variabl is used
  regulator enable disable with proper orders and delays
  as per the spec
  devm_drm_panel_bridge_add method used instead of panel
  description modified
  dual port implemented

v4:
* Sam Ravnborg review comments incorporated
  panel->connector_type removed

* Reported-by: kernel test robot 
  parse_dt to static function
  removed the if (endpoint), since data-lanes has to be
  present for dsi dts ports

v5:
  ~vsdelay dynamic value set based on the
  calculation of dsi speed, output speed, blanking

v6:
* Sam Ravnborg review comments incorporated
  help modified
  display_timings naming local variables
  check for bus_formats unsupported
  error handling enpoint data-lanes

v7:
* Sam Ravnborg review comments incorporated
  Kconfig proper indentation
  GENMASK and FIELD_PREP used
  bus_formats handeld in mode_valid
  MODE_CLOCK_HIGH handled properly

* Reported-by: kernel test robot 
  len initialized
  static function for mode_valid
---
 drivers/gpu/drm/bridge/Kconfig|  10 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/tc358775.c | 757 ++
 3 files changed, 768 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/tc358775.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 43271c21d3fc..25c3097c4003 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -181,6 +181,16 @@ config DRM_TOSHIBA_TC358768
help
  Toshiba TC358768AXBG/TC358778XBG DSI bridge chip driver.
 
+config DRM_TOSHIBA_TC358775
+   tristate "Toshiba TC358775 DSI/LVDS bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   select DRM_PANEL
+   select DRM_MIPI_DSI
+   help
+ Toshiba TC358775 DSI/LVDS bridge chip driver.
+
 config DRM_TI_TFP410
tristate "TI TFP410 DVI/HDMI bridge"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index d63d4b7e4347..23c770b3bfe4 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358768) += tc358768.o
+obj-$(CONFIG_DRM_TOSHIBA_TC358775) += tc358775.o
 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
 obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
 obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
new file mode 100644
index ..6494179369a6
--- /dev/null
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -0,0 +1,757 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * tc358775 DSI to LVDS bridge driver
+ *
+ * Copyright (C) 2020 SMART Wireless Computing
+ * Author: Vinay Simha BN 
+ *
+ */
+/* #define DEBUG */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define FLD_VAL(val, start, end) FIELD_PREP(GENMASK(start, end), val)
+
+/* Registers */
+
+/* DSI D-PHY Layer Registers */
+#define D0W_DPHYCONTTX  0x0004  /* Data Lane 0 DPHY Tx Control */
+#def

Re: [PATCH v6 1/2] dt-binding: Add DSI/LVDS TC358775 bridge bindings

2020-07-03 Thread Vinay Simha B N
sam,

I will change to "GPL-2.0-only OR BSD-2-Clause", i thought running
dt_binding_check is enough for .yaml.

On Fri, Jul 3, 2020 at 8:36 PM Sam Ravnborg  wrote:
>
> Hi Vinay.
>
> On Thu, Jul 02, 2020 at 06:06:33PM +0530, Vinay Simha BN wrote:
> > Signed-off-by: Vinay Simha BN 
> >
> > ---
> > v1:
> >  Initial version wast .txt file
> >
> > v2:
> >  From txt to yaml file format
> >
> > v3:
> > * Andrzej Hajda review comments incorporated
> >   dual port lvds implemented
> >
> > * Laurent Pinchart review comments incorporated
> >   dsi lanes property removed and it is dynamically
> >   picked from the dsi ports
> >   VESA/JEIDA format picked from panel-lvds dts
> >
> > v4:
> > * Sam Ravnborg review comments incorporated
> >   }' is indented properly in examples data-lanes
> >   description for single-link and dual-link lvds
> > ---
> >  .../display/bridge/toshiba,tc358775.yaml  | 215 ++
> >  1 file changed, 215 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
> >
> > diff --git 
> > a/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml 
> > b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
> > new file mode 100644
> > index ..9ddd63bee403
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
> > @@ -0,0 +1,215 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +%YAML 1.2
> One detail that I missed - any specific reason this is not (GPL-2.0-only OR 
> BSD-2-Clause)
> This is the preferred license for new bindings - as checkpatch also
> tells you.
>
> Sam
>
> > +---
> > +$id: http://devicetree.org/schemas/display/bridge/toshiba,tc358775.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Toshiba TC358775 DSI to LVDS bridge bindings
> > +
> > +maintainers:
> > + - Vinay Simha BN 
> > +
> > +description: |
> > + This binding supports DSI to LVDS bridge TC358775
> > +
> > + MIPI DSI-RX Data 4-lane, CLK 1-lane with data rates up to 800 Mbps/lane.
> > + Video frame size:
> > + Up to 1600x1200 24-bit/pixel resolution for single-link LVDS display panel
> > + limited by 135 MHz LVDS speed
> > + Up to WUXGA (1920x1200 24-bit pixels) resolution for dual-link LVDS 
> > display
> > + panel, limited by 270 MHz LVDS speed.
> > +
> > +properties:
> > +  compatible:
> > +const: toshiba,tc358775
> > +
> > +  reg:
> > +maxItems: 1
> > +description: i2c address of the bridge, 0x0f
> > +
> > +  vdd-supply:
> > +maxItems: 1
> > +description:  1.2V LVDS Power Supply
> > +
> > +  vddio-supply:
> > +maxItems: 1
> > +description: 1.8V IO Power Supply
> > +
> > +  stby-gpios:
> > +maxItems: 1
> > +description: Standby pin, Low active
> > +
> > +  reset-gpios:
> > +maxItems: 1
> > +description: Hardware reset, Low active
> > +
> > +  ports:
> > +type: object
> > +description:
> > +  A node containing input and output port nodes with endpoint 
> > definitions
> > +  as documented in
> > +  Documentation/devicetree/bindings/media/video-interfaces.txt
> > +properties:
> > +  "#address-cells":
> > +const: 1
> > +
> > +  "#size-cells":
> > +const: 0
> > +
> > +  port@0:
> > +type: object
> > +description: |
> > +  DSI Input. The remote endpoint phandle should be a
> > +  reference to a valid mipi_dsi_host device node.
> > +
> > +  port@1:
> > +type: object
> > +description: |
> > +  Video port for LVDS output (panel or connector).
> > +
> > +  port@2:
> > +type: object
> > +description: |
> > +  Video port for Dual link LVDS output (panel or connector).
> > +
> > +required:
> > +  - port@0
> > +  - port@1
> > +
> > +required:
> > + - compatible
> > + - reg
> > + - vdd-supply
> > + - vddio-supply
> > + - stby-gpios
> > + - reset-gpios
> > + - ports
> > +
> > +examples:
> > + - |
> > +#include 
> > +
> > +/* For single-link LVDS display panel */
> > +
> > +i2c@78b800

[PATCH v6 2/2] display/drm/bridge: TC358775 DSI/LVDS driver

2020-07-02 Thread Vinay Simha BN
This driver is tested with two panels individually with Apq8016-IFC6309 board
https://www.inforcecomputing.com/products/single-board-computers-sbc/qualcomm-snapdragon-410-inforce-6309-micro-sbc

1. 1366x768@60 auo,b101xtn01 data-mapping = "jeida-24"
2. 800x480@60 innolux,at070tn92 data-mapping = "vesa-24"

Signed-off-by: Vinay Simha BN 

---
v1:
 Initial version

v2:
* Andrzej Hajda review comments incorporated
  SPDX identifier
  development debug removed
  alphabetic order headers
  u32 instead of unit32_t
  magic numbers to macros for CLRSI and mux registers
  ignored return value

* Laurent Pinchart review comments incorporated
  mdelay to usleep_range
  bus_formats added

v3:
* Andrzej Hajda review comments incorporated
  drm_connector_status removed
  u32 rev removed and local variabl is used
  regulator enable disable with proper orders and delays
  as per the spec
  devm_drm_panel_bridge_add method used instead of panel
  description modified
  dual port implemented

v4:
* Sam Ravnborg review comments incorporated
  panel->connector_type removed

* Reported-by: kernel test robot 
  parse_dt to static function
  removed the if (endpoint), since data-lanes has to be
  present for dsi dts ports

v5:
  ~vsdelay dynamic value set based on the
  calculation of dsi speed, output speed, blanking

v6:
* Sam Ravnborg review comments incorporated
  help modified
  display_timings naming local variables
  check for bus_formats unsupported
  error handling enpoint data-lanes
---
 drivers/gpu/drm/bridge/Kconfig|  10 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/tc358775.c | 766 ++
 3 files changed, 777 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/tc358775.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 43271c21d3fc..99abda4459ab 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -181,6 +181,16 @@ config DRM_TOSHIBA_TC358768
help
  Toshiba TC358768AXBG/TC358778XBG DSI bridge chip driver.
 
+config DRM_TOSHIBA_TC358775
+tristate "Toshiba TC358775 DSI/LVDS bridge"
+depends on OF
+select DRM_KMS_HELPER
+select REGMAP_I2C
+select DRM_PANEL
+   select DRM_MIPI_DSI
+help
+  Toshiba TC358775 DSI/LVDS bridge chip driver.
+
 config DRM_TI_TFP410
tristate "TI TFP410 DVI/HDMI bridge"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index d63d4b7e4347..23c770b3bfe4 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358768) += tc358768.o
+obj-$(CONFIG_DRM_TOSHIBA_TC358775) += tc358775.o
 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
 obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
 obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
new file mode 100644
index ..88a05b9645e8
--- /dev/null
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -0,0 +1,766 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * tc358775 DSI to LVDS bridge driver
+ *
+ * Copyright (C) 2020 SMART Wireless Computing
+ * Author: Vinay Simha BN 
+ *
+ */
+/* #define DEBUG */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define FLD_MASK(start, end)(((1 << ((start) - (end) + 1)) - 1) << (end))
+#define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end))
+
+/* Registers */
+
+/* DSI D-PHY Layer Registers */
+#define D0W_DPHYCONTTX  0x0004  /* Data Lane 0 DPHY Tx Control */
+#define CLW_DPHYCONTRX  0x0020  /* Clock Lane DPHY Rx Control */
+#define D0W_DPHYCONTRX  0x0024  /* Data Lane 0 DPHY Rx Control */
+#define D1W_DPHYCONTRX  0x0028  /* Data Lane 1 DPHY Rx Control */
+#define D2W_DPHYCONTRX  0x002C  /* Data Lane 2 DPHY Rx Control */
+#define D3W_DPHYCONTRX  0x0030  /* Data Lane 3 DPHY Rx Control */
+#define COM_DPHYCONTRX  0x0038  /* DPHY Rx Common Control */
+#define CLW_CNTRL   0x0040  /* Clock Lane Control */
+#define D0W_CNTRL   0x0044  /* Data Lane 0 Control */
+#define D1W_CNTRL   0x0048  /* Data Lane 1 Control */
+#define D2W_CNTRL   0x004C  /* Data Lane 2 Control */
+#define D3W_CNTRL   0x0050  /* Data Lane 3 Control */
+#define DFTMODE_CNTRL   0x0054  /* DFT Mode Control */
+
+/* DSI PPI Layer Registers */
+#define PPI_STARTPPI0x0104  /* START control bit of PPI-TX function. */
+#define PPI_START_FUNCTION  1
+
+#define PPI_BUSYPPI 0x0108
+#define PPI_LINEINITCNT 0x0110  /* Line Initialization Wait Counter  */
+#define PPI_LPTXTIM

[PATCH v6 1/2] dt-binding: Add DSI/LVDS TC358775 bridge bindings

2020-07-02 Thread Vinay Simha BN
Signed-off-by: Vinay Simha BN 

---
v1:
 Initial version wast .txt file

v2:
 From txt to yaml file format

v3:
* Andrzej Hajda review comments incorporated
  dual port lvds implemented

* Laurent Pinchart review comments incorporated
  dsi lanes property removed and it is dynamically
  picked from the dsi ports
  VESA/JEIDA format picked from panel-lvds dts

v4:
* Sam Ravnborg review comments incorporated
  }' is indented properly in examples data-lanes
  description for single-link and dual-link lvds
---
 .../display/bridge/toshiba,tc358775.yaml  | 215 ++
 1 file changed, 215 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml 
b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
new file mode 100644
index ..9ddd63bee403
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
@@ -0,0 +1,215 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/toshiba,tc358775.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Toshiba TC358775 DSI to LVDS bridge bindings
+
+maintainers:
+ - Vinay Simha BN 
+
+description: |
+ This binding supports DSI to LVDS bridge TC358775
+
+ MIPI DSI-RX Data 4-lane, CLK 1-lane with data rates up to 800 Mbps/lane.
+ Video frame size:
+ Up to 1600x1200 24-bit/pixel resolution for single-link LVDS display panel
+ limited by 135 MHz LVDS speed
+ Up to WUXGA (1920x1200 24-bit pixels) resolution for dual-link LVDS display
+ panel, limited by 270 MHz LVDS speed.
+
+properties:
+  compatible:
+const: toshiba,tc358775
+
+  reg:
+maxItems: 1
+description: i2c address of the bridge, 0x0f
+
+  vdd-supply:
+maxItems: 1
+description:  1.2V LVDS Power Supply
+
+  vddio-supply:
+maxItems: 1
+description: 1.8V IO Power Supply
+
+  stby-gpios:
+maxItems: 1
+description: Standby pin, Low active
+
+  reset-gpios:
+maxItems: 1
+description: Hardware reset, Low active
+
+  ports:
+type: object
+description:
+  A node containing input and output port nodes with endpoint definitions
+  as documented in
+  Documentation/devicetree/bindings/media/video-interfaces.txt
+properties:
+  "#address-cells":
+const: 1
+
+  "#size-cells":
+const: 0
+
+  port@0:
+type: object
+description: |
+  DSI Input. The remote endpoint phandle should be a
+  reference to a valid mipi_dsi_host device node.
+
+  port@1:
+type: object
+description: |
+  Video port for LVDS output (panel or connector).
+
+  port@2:
+type: object
+description: |
+  Video port for Dual link LVDS output (panel or connector).
+
+required:
+  - port@0
+  - port@1
+
+required:
+ - compatible
+ - reg
+ - vdd-supply
+ - vddio-supply
+ - stby-gpios
+ - reset-gpios
+ - ports
+
+examples:
+ - |
+#include 
+
+/* For single-link LVDS display panel */
+
+i2c@78b8000 {
+/* On High speed expansion */
+label = "HS-I2C2";
+reg = <0x078b8000 0x500>;
+clock-frequency = <40>; /* fastmode operation */
+#address-cells = <1>;
+#size-cells = <0>;
+
+tc_bridge: bridge@f {
+compatible = "toshiba,tc358775";
+reg = <0x0f>;
+
+vdd-supply = <_l2>;
+vddio-supply = <_l6>;
+
+stby-gpios = < 99 GPIO_ACTIVE_LOW>;
+reset-gpios = < 72 GPIO_ACTIVE_LOW>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+d2l_in_test: endpoint {
+remote-endpoint = <_out>;
+};
+};
+
+port@1 {
+reg = <1>;
+lvds_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+};
+};
+};
+
+dsi@1a98000 {
+reg = <0x1a98000 0x25c>;
+reg-names = "dsi_ctrl";
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+port@1 {
+reg = <1>;
+dsi0_out: endpoint {
+remote-endpoint = <_in_test>;
+data-lanes = <0 1 2 3>;
+};
+ };
+ };
+ };
+
+ - |
+/* For dual-link LVDS display panel */
+
+i2c@78b8000 {
+/* On High speed expansion */
+label = "HS-I2C2";
+reg = <0x078b8000 0x500>;
+c

Re: [PATCH v5 1/2] dt-binding: Add DSI/LVDS TC358775 bridge bindings

2020-07-01 Thread Vinay Simha B N
sam,

I rechecked, but did not find any indents are too spaced.
This is taken from a working dts tree.

I had given two examples for a purpose. One for single lvds
configuration single link mode,
another is for dual lvds configurations dual-link mode and port mappings.

On Wed, Jul 1, 2020 at 2:49 PM Sam Ravnborg  wrote:
>
> Hi Vinay.
>
> On Wed, Jul 01, 2020 at 12:33:36PM +0530, Vinay Simha BN wrote:
> > This driver is tested with two panels with Apq8016-IFC6309 board
> > https://www.inforcecomputing.com/products/single-board-computers-sbc/qualcomm-snapdragon-410-inforce-6309-micro-sbc
> >
> > 1. 1366x768@60 auo,b101xtn01 data-mapping = "jeida-24"
> > 2. 800x480@60 innolux,at070tn92 data-mapping = "vesa-24"
> >
> > Signed-off-by: Vinay Simha BN 
> >
> > ---
> > v1:
> >  Initial version wast .txt file
> >
> > v2:
> >  From txt to yaml file format
> >
> > v3:
> > * Andrzej Hajda review comments incorporated
> >   dual port lvds implemented
> >
> > * Laurent Pinchart review comments incorporated
> >   dsi lanes property removed and it is dynamically
> >   picked from the dsi ports
> >   VESA/JEIDA format picked from panel-lvds dts
> > ---
> >  .../display/bridge/toshiba,tc358775.yaml  | 204 ++
> >  1 file changed, 204 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
> >
> > diff --git 
> > a/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml 
> > b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
> > new file mode 100644
> > index ..ec53d62d408b
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
> > @@ -0,0 +1,204 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/display/bridge/toshiba,tc358775.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Toshiba TC358775 DSI to LVDS bridge bindings
> > +
> > +maintainers:
> > + - Vinay Simha BN 
> > +
> > +description: |
> > + This binding supports DSI to LVDS bridge TC358775
> > +
> > +properties:
> > +  compatible:
> > +const: toshiba,tc358775
> > +
> > +  reg:
> > +maxItems: 1
> > +description: i2c address of the bridge, 0x0f
> > +
> > +  vdd-supply:
> > +maxItems: 1
> > +description:  1.2V LVDS Power Supply
> > +
> > +  vddio-supply:
> > +maxItems: 1
> > +description: 1.8V IO Power Supply
> > +
> > +  stby-gpios:
> > +maxItems: 1
> > +description: Standby pin, Low active
> > +
> > +  reset-gpios:
> > +maxItems: 1
> > +description: Hardware reset, Low active
> > +
> > +  ports:
> > +type: object
> > +description:
> > +  A node containing input and output port nodes with endpoint 
> > definitions
> > +  as documented in
> > +  Documentation/devicetree/bindings/media/video-interfaces.txt
> > +properties:
> > +  "#address-cells":
> > +const: 1
> > +
> > +  "#size-cells":
> > +const: 0
> > +
> > +  port@0:
> > +type: object
> > +description: |
> > +  DSI Input. The remote endpoint phandle should be a
> > +  reference to a valid mipi_dsi_host device node.
> > +
> > +  port@1:
> > +type: object
> > +description: |
> > +  Video port for LVDS output (panel or connector).
> > +
> > +  port@2:
> > +type: object
> > +description: |
> > +  Video port for Dual link LVDS output (panel or connector).
> > +
> > +required:
> > +  - port@0
> > +  - port@1
> > +
> > +required:
> > + - compatible
> > + - reg
> > + - vdd-supply
> > + - vddio-supply
> > + - stby-gpios
> > + - reset-gpios
> > + - ports
> > +
> > +examples:
> > + - |
> > +#include 
> > +
> > +i2c@78b8000 {
> > +/* On High speed expansion */
> > +label = "HS-I2C2";
> > +reg = <0x078b8000 0x500>;
> > +clock-frequency = <40>; /* fastmode operation */
> > +#address-cells = <1>;
> > + 

[PATCH v5 1/2] dt-binding: Add DSI/LVDS TC358775 bridge bindings

2020-07-01 Thread Vinay Simha BN
This driver is tested with two panels with Apq8016-IFC6309 board
https://www.inforcecomputing.com/products/single-board-computers-sbc/qualcomm-snapdragon-410-inforce-6309-micro-sbc

1. 1366x768@60 auo,b101xtn01 data-mapping = "jeida-24"
2. 800x480@60 innolux,at070tn92 data-mapping = "vesa-24"

Signed-off-by: Vinay Simha BN 

---
v1:
 Initial version wast .txt file

v2:
 From txt to yaml file format

v3:
* Andrzej Hajda review comments incorporated
  dual port lvds implemented

* Laurent Pinchart review comments incorporated
  dsi lanes property removed and it is dynamically
  picked from the dsi ports
  VESA/JEIDA format picked from panel-lvds dts
---
 .../display/bridge/toshiba,tc358775.yaml  | 204 ++
 1 file changed, 204 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml 
b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
new file mode 100644
index ..ec53d62d408b
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
@@ -0,0 +1,204 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/toshiba,tc358775.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Toshiba TC358775 DSI to LVDS bridge bindings
+
+maintainers:
+ - Vinay Simha BN 
+
+description: |
+ This binding supports DSI to LVDS bridge TC358775
+
+properties:
+  compatible:
+const: toshiba,tc358775
+
+  reg:
+maxItems: 1
+description: i2c address of the bridge, 0x0f
+
+  vdd-supply:
+maxItems: 1
+description:  1.2V LVDS Power Supply
+
+  vddio-supply:
+maxItems: 1
+description: 1.8V IO Power Supply
+
+  stby-gpios:
+maxItems: 1
+description: Standby pin, Low active
+
+  reset-gpios:
+maxItems: 1
+description: Hardware reset, Low active
+
+  ports:
+type: object
+description:
+  A node containing input and output port nodes with endpoint definitions
+  as documented in
+  Documentation/devicetree/bindings/media/video-interfaces.txt
+properties:
+  "#address-cells":
+const: 1
+
+  "#size-cells":
+const: 0
+
+  port@0:
+type: object
+description: |
+  DSI Input. The remote endpoint phandle should be a
+  reference to a valid mipi_dsi_host device node.
+
+  port@1:
+type: object
+description: |
+  Video port for LVDS output (panel or connector).
+
+  port@2:
+type: object
+description: |
+  Video port for Dual link LVDS output (panel or connector).
+
+required:
+  - port@0
+  - port@1
+
+required:
+ - compatible
+ - reg
+ - vdd-supply
+ - vddio-supply
+ - stby-gpios
+ - reset-gpios
+ - ports
+
+examples:
+ - |
+#include 
+
+i2c@78b8000 {
+/* On High speed expansion */
+label = "HS-I2C2";
+reg = <0x078b8000 0x500>;
+clock-frequency = <40>; /* fastmode operation */
+#address-cells = <1>;
+#size-cells = <0>;
+
+tc_bridge: bridge@f {
+compatible = "toshiba,tc358775";
+reg = <0x0f>;
+
+vdd-supply = <_l2>;
+vddio-supply = <_l6>;
+
+stby-gpios = < 99 GPIO_ACTIVE_LOW>;
+reset-gpios = < 72 GPIO_ACTIVE_LOW>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+d2l_in_test: endpoint {
+remote-endpoint = <_out>;
+};
+};
+
+port@1 {
+reg = <1>;
+lvds_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+};
+};
+};
+
+dsi@1a98000 {
+reg = <0x1a98000 0x25c>;
+reg-names = "dsi_ctrl";
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+port@1 {
+reg = <1>;
+dsi0_out: endpoint {
+remote-endpoint = <_in_test>;
+data-lanes = <0 1 2 3>;
+};
+ };
+ };
+ };
+
+ - |
+i2c@78b8000 {
+/* On High speed expansion */
+label = "HS-I2C2";
+reg = <0x078b8000 0x500>;
+clock-frequency = <40>; /* fastmode operation */
+#address-cells = <1>;
+#size-cells = <0>;
+
+tc_bridge_dual: bridge@f {
+compatible = "toshiba,tc358775";
+reg 

[PATCH v5 2/2] display/drm/bridge: TC358775 DSI/LVDS driver

2020-07-01 Thread Vinay Simha BN
Signed-off-by: Vinay Simha BN 

---
v1:
 Initial version

v2:
* Andrzej Hajda review comments incorporated
  SPDX identifier
  development debug removed
  alphabetic order headers
  u32 instead of unit32_t
  magic numbers to macros for CLRSI and mux registers
  ignored return value

* Laurent Pinchart review comments incorporated
  mdelay to usleep_range
  bus_formats added

v3:
* Andrzej Hajda review comments incorporated
  drm_connector_status removed
  u32 rev removed and local variabl is used
  regulator enable disable with proper orders and delays
  as per the spec
  devm_drm_panel_bridge_add method used instead of panel
  description modified
  dual port implemented

v4:
* Sam Ravnborg review comments incorporated
  panel->connector_type removed

* Reported-by: kernel test robot 
  parse_dt to static function
  removed the if (endpoint), since data-lanes has to be
  present for dsi dts ports

v5:
  ~vsdelay dynamic value set based on the
  calculation of dsi speed, output speed, blanking
---
 drivers/gpu/drm/bridge/Kconfig|  10 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/tc358775.c | 735 ++
 3 files changed, 746 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/tc358775.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 43271c21d3fc..084e9853944a 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -181,6 +181,16 @@ config DRM_TOSHIBA_TC358768
help
  Toshiba TC358768AXBG/TC358778XBG DSI bridge chip driver.
 
+config DRM_TOSHIBA_TC358775
+tristate "Toshiba TC358775 LVDS bridge"
+depends on OF
+select DRM_KMS_HELPER
+select REGMAP_I2C
+select DRM_PANEL
+   select DRM_MIPI_DSI
+---help---
+  Toshiba TC358775 LVDS bridge chip driver.
+
 config DRM_TI_TFP410
tristate "TI TFP410 DVI/HDMI bridge"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index d63d4b7e4347..23c770b3bfe4 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358768) += tc358768.o
+obj-$(CONFIG_DRM_TOSHIBA_TC358775) += tc358775.o
 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
 obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
 obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
new file mode 100644
index ..e580c544190c
--- /dev/null
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -0,0 +1,735 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * tc358775 DSI to LVDS bridge driver
+ *
+ * Copyright (C) 2020 SMART Wireless Computing
+ * Author: Vinay Simha BN 
+ *
+ */
+/* #define DEBUG */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define FLD_MASK(start, end)(((1 << ((start) - (end) + 1)) - 1) << (end))
+#define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end))
+
+/* Registers */
+
+/* DSI D-PHY Layer Registers */
+#define D0W_DPHYCONTTX  0x0004  /* Data Lane 0 DPHY Tx Control */
+#define CLW_DPHYCONTRX  0x0020  /* Clock Lane DPHY Rx Control */
+#define D0W_DPHYCONTRX  0x0024  /* Data Lane 0 DPHY Rx Control */
+#define D1W_DPHYCONTRX  0x0028  /* Data Lane 1 DPHY Rx Control */
+#define D2W_DPHYCONTRX  0x002C  /* Data Lane 2 DPHY Rx Control */
+#define D3W_DPHYCONTRX  0x0030  /* Data Lane 3 DPHY Rx Control */
+#define COM_DPHYCONTRX  0x0038  /* DPHY Rx Common Control */
+#define CLW_CNTRL   0x0040  /* Clock Lane Control */
+#define D0W_CNTRL   0x0044  /* Data Lane 0 Control */
+#define D1W_CNTRL   0x0048  /* Data Lane 1 Control */
+#define D2W_CNTRL   0x004C  /* Data Lane 2 Control */
+#define D3W_CNTRL   0x0050  /* Data Lane 3 Control */
+#define DFTMODE_CNTRL   0x0054  /* DFT Mode Control */
+
+/* DSI PPI Layer Registers */
+#define PPI_STARTPPI0x0104  /* START control bit of PPI-TX function. */
+#define PPI_START_FUNCTION  1
+
+#define PPI_BUSYPPI 0x0108
+#define PPI_LINEINITCNT 0x0110  /* Line Initialization Wait Counter  */
+#define PPI_LPTXTIMECNT 0x0114
+#define PPI_LANEENABLE  0x0134  /* Enables each lane at the PPI layer. */
+#define PPI_TX_RX_TA0x013C  /* DSI Bus Turn Around timing parameters */
+
+/* Analog timer function enable */
+#define PPI_CLS_ATMR0x0140  /* Delay for Clock Lane in LPRX  */
+#define PPI_D0S_ATMR0x0144  /* Delay for Data Lane 0 in LPRX */
+#define PPI_D1S_ATMR0x0148  /* Delay for Data Lane 1 in LPRX */
+#define PPI_D2S_ATMR0x014C  /* Delay for Data Lane 2 in LPRX */
+#define PPI_D3S_ATMR0x0150  /

[PATCH v4 1/2] dt-binding: Add DSI/LVDS TC358775 bridge bindings

2020-06-30 Thread Vinay Simha BN
This driver is tested with two panels with Apq8016-IFC6309 board
https://www.inforcecomputing.com/products/single-board-computers-sbc/qualcomm-snapdragon-410-inforce-6309-micro-sbc

1. 1366x768@60 auo,b101xtn01 data-mapping = "jeida-24"
2. 800x480@60 innolux,at070tn92 data-mapping = "vesa-24"

Signed-off-by: Vinay Simha BN 

---
v1:
 Initial version wast .txt file

v2:
 From txt to yaml file format

v3:
* Andrzej Hajda review comments incorporated
  dual port lvds implemented

* Laurent Pinchart review comments incorporated
  dsi lanes property removed and it is dynamically
  picked from the dsi ports
  VESA/JEIDA format picked from panel-lvds dts
---
 .../display/bridge/toshiba,tc358775.yaml  | 204 ++
 1 file changed, 204 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml 
b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
new file mode 100644
index ..ec53d62d408b
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
@@ -0,0 +1,204 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/toshiba,tc358775.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Toshiba TC358775 DSI to LVDS bridge bindings
+
+maintainers:
+ - Vinay Simha BN 
+
+description: |
+ This binding supports DSI to LVDS bridge TC358775
+
+properties:
+  compatible:
+const: toshiba,tc358775
+
+  reg:
+maxItems: 1
+description: i2c address of the bridge, 0x0f
+
+  vdd-supply:
+maxItems: 1
+description:  1.2V LVDS Power Supply
+
+  vddio-supply:
+maxItems: 1
+description: 1.8V IO Power Supply
+
+  stby-gpios:
+maxItems: 1
+description: Standby pin, Low active
+
+  reset-gpios:
+maxItems: 1
+description: Hardware reset, Low active
+
+  ports:
+type: object
+description:
+  A node containing input and output port nodes with endpoint definitions
+  as documented in
+  Documentation/devicetree/bindings/media/video-interfaces.txt
+properties:
+  "#address-cells":
+const: 1
+
+  "#size-cells":
+const: 0
+
+  port@0:
+type: object
+description: |
+  DSI Input. The remote endpoint phandle should be a
+  reference to a valid mipi_dsi_host device node.
+
+  port@1:
+type: object
+description: |
+  Video port for LVDS output (panel or connector).
+
+  port@2:
+type: object
+description: |
+  Video port for Dual link LVDS output (panel or connector).
+
+required:
+  - port@0
+  - port@1
+
+required:
+ - compatible
+ - reg
+ - vdd-supply
+ - vddio-supply
+ - stby-gpios
+ - reset-gpios
+ - ports
+
+examples:
+ - |
+#include 
+
+i2c@78b8000 {
+/* On High speed expansion */
+label = "HS-I2C2";
+reg = <0x078b8000 0x500>;
+clock-frequency = <40>; /* fastmode operation */
+#address-cells = <1>;
+#size-cells = <0>;
+
+tc_bridge: bridge@f {
+compatible = "toshiba,tc358775";
+reg = <0x0f>;
+
+vdd-supply = <_l2>;
+vddio-supply = <_l6>;
+
+stby-gpios = < 99 GPIO_ACTIVE_LOW>;
+reset-gpios = < 72 GPIO_ACTIVE_LOW>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+d2l_in_test: endpoint {
+remote-endpoint = <_out>;
+};
+};
+
+port@1 {
+reg = <1>;
+lvds_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+};
+};
+};
+
+dsi@1a98000 {
+reg = <0x1a98000 0x25c>;
+reg-names = "dsi_ctrl";
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+port@1 {
+reg = <1>;
+dsi0_out: endpoint {
+remote-endpoint = <_in_test>;
+data-lanes = <0 1 2 3>;
+};
+ };
+ };
+ };
+
+ - |
+i2c@78b8000 {
+/* On High speed expansion */
+label = "HS-I2C2";
+reg = <0x078b8000 0x500>;
+clock-frequency = <40>; /* fastmode operation */
+#address-cells = <1>;
+#size-cells = <0>;
+
+tc_bridge_dual: bridge@f {
+compatible = "toshiba,tc358775";
+reg 

[PATCH v4 2/2] display/drm/bridge: TC358775 DSI/LVDS driver

2020-06-30 Thread Vinay Simha BN
Signed-off-by: Vinay Simha BN 

---
v1:
 Initial version

v2:
* Andrzej Hajda review comments incorporated
  SPDX identifier
  development debug removed
  alphabetic order headers
  u32 instead of unit32_t
  magic numbers to macros for CLRSI and mux registers
  ignored return value

* Laurent Pinchart review comments incorporated
  mdelay to usleep_range
  bus_formats added

v3:
* Andrzej Hajda review comments incorporated
  drm_connector_status removed
  u32 rev removed and local variabl is used
  regulator enable disable with proper orders and delays
  as per the spec
  devm_drm_panel_bridge_add method used instead of panel
  description modified
  dual port implemented

v4:
* Sam Ravnborg review comments incorporated
  panel->connector_type removed

* Reported-by: kernel test robot 
  parse_dt to static function
  removed the if (endpoint), since data-lanes has to be
  present for dsi dts ports
---
 drivers/gpu/drm/bridge/Kconfig|  10 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/tc358775.c | 721 ++
 3 files changed, 732 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/tc358775.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 43271c21d3fc..084e9853944a 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -181,6 +181,16 @@ config DRM_TOSHIBA_TC358768
help
  Toshiba TC358768AXBG/TC358778XBG DSI bridge chip driver.
 
+config DRM_TOSHIBA_TC358775
+tristate "Toshiba TC358775 LVDS bridge"
+depends on OF
+select DRM_KMS_HELPER
+select REGMAP_I2C
+select DRM_PANEL
+   select DRM_MIPI_DSI
+---help---
+  Toshiba TC358775 LVDS bridge chip driver.
+
 config DRM_TI_TFP410
tristate "TI TFP410 DVI/HDMI bridge"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index d63d4b7e4347..23c770b3bfe4 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358768) += tc358768.o
+obj-$(CONFIG_DRM_TOSHIBA_TC358775) += tc358775.o
 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
 obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
 obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
new file mode 100644
index ..a54376135bb7
--- /dev/null
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -0,0 +1,721 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * tc358775 DSI to LVDS bridge driver
+ *
+ * Copyright (C) 2020 SMART Wireless Computing
+ * Author: Vinay Simha BN 
+ *
+ */
+//#define DEBUG
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define FLD_MASK(start, end)(((1 << ((start) - (end) + 1)) - 1) << (end))
+#define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end))
+
+/* Registers */
+
+/* DSI D-PHY Layer Registers */
+#define D0W_DPHYCONTTX  0x0004  /* Data Lane 0 DPHY Tx Control */
+#define CLW_DPHYCONTRX  0x0020  /* Clock Lane DPHY Rx Control */
+#define D0W_DPHYCONTRX  0x0024  /* Data Lane 0 DPHY Rx Control */
+#define D1W_DPHYCONTRX  0x0028  /* Data Lane 1 DPHY Rx Control */
+#define D2W_DPHYCONTRX  0x002C  /* Data Lane 2 DPHY Rx Control */
+#define D3W_DPHYCONTRX  0x0030  /* Data Lane 3 DPHY Rx Control */
+#define COM_DPHYCONTRX  0x0038  /* DPHY Rx Common Control */
+#define CLW_CNTRL   0x0040  /* Clock Lane Control */
+#define D0W_CNTRL   0x0044  /* Data Lane 0 Control */
+#define D1W_CNTRL   0x0048  /* Data Lane 1 Control */
+#define D2W_CNTRL   0x004C  /* Data Lane 2 Control */
+#define D3W_CNTRL   0x0050  /* Data Lane 3 Control */
+#define DFTMODE_CNTRL   0x0054  /* DFT Mode Control */
+
+/* DSI PPI Layer Registers */
+#define PPI_STARTPPI0x0104  /* START control bit of PPI-TX function. */
+#define PPI_START_FUNCTION  1
+
+#define PPI_BUSYPPI 0x0108
+#define PPI_LINEINITCNT 0x0110  /* Line Initialization Wait Counter  */
+#define PPI_LPTXTIMECNT 0x0114
+#define PPI_LANEENABLE  0x0134  /* Enables each lane at the PPI layer. */
+#define PPI_TX_RX_TA0x013C  /* DSI Bus Turn Around timing parameters */
+
+/* Analog timer function enable */
+#define PPI_CLS_ATMR0x0140  /* Delay for Clock Lane in LPRX  */
+#define PPI_D0S_ATMR0x0144  /* Delay for Data Lane 0 in LPRX */
+#define PPI_D1S_ATMR0x0148  /* Delay for Data Lane 1 in LPRX */
+#define PPI_D2S_ATMR0x014C  /* Delay for Data Lane 2 in LPRX */
+#define PPI_D3S_ATMR0x0150  /* Delay for Data Lane 3 in LPRX */
+
+#define PPI_D0S_CLRSIPOCOUNT0x0164  /* For lane 0 */
+#defin

Re: [PATCH v4] display/drm/bridge: TC358775 DSI/LVDS driver

2020-06-29 Thread Vinay Simha B N
Neil,

yaml is the v3 version, there was no change , so i had not created v4 for yaml
[PATCH v3 2/2] display/drm/bridge: TC358775 DSI/LVDS driver


On Mon, Jun 29, 2020 at 2:08 PM Neil Armstrong  wrote:
>
> Hi,
>
> On 21/06/2020 17:38, Vinay Simha BN wrote:
> > Signed-off-by: Vinay Simha BN 
> >
> > ---
> > v1:
> >  Initial version
> >
> > v2:
> > * Andrzej Hajda review comments incorporated
> >   SPDX identifier
> >   development debug removed
> >   alphabetic order headers
> >   u32 instead of unit32_t
> >   magic numbers to macros for CLRSI and mux registers
> >   ignored return value
> >
> > * Laurent Pinchart review comments incorporated
> >   mdelay to usleep_range
> >   bus_formats added
> >
> > v3:
> > * Andrzej Hajda review comments incorporated
> >   drm_connector_status removed
> >   u32 rev removed and local variabl is used
> >   regulator enable disable with proper orders and delays
> >   as per the spec
> >   devm_drm_panel_bridge_add method used instead of panel
> >   description modified
> >   dual port implemented
> >
> > v4:
> > * Sam Ravnborg review comments incorporated
> >   panel->connector_type removed
> >
> > * Reported-by: kernel test robot 
> >   parse_dt to static function
> >   removed the if (endpoint), since data-lanes has to be
> >   present for dsi dts ports
>
> I maybe missed something, but you should also post a YAML DT bindings
> file associated to the driver.
>
> Neil
>
>
> > ---
> >  drivers/gpu/drm/bridge/Kconfig|  10 +
> >  drivers/gpu/drm/bridge/Makefile   |   1 +
> >  drivers/gpu/drm/bridge/tc358775.c | 721 ++
> >  3 files changed, 732 insertions(+)
> >  create mode 100644 drivers/gpu/drm/bridge/tc358775.c
> >
> > diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> > index 43271c21d3fc..084e9853944a 100644
> > --- a/drivers/gpu/drm/bridge/Kconfig
> > +++ b/drivers/gpu/drm/bridge/Kconfig
> > @@ -181,6 +181,16 @@ config DRM_TOSHIBA_TC358768
> >   help
> > Toshiba TC358768AXBG/TC358778XBG DSI bridge chip driver.
> >
> > +config DRM_TOSHIBA_TC358775
> > +tristate "Toshiba TC358775 LVDS bridge"
> > +depends on OF
> > +select DRM_KMS_HELPER
> > +select REGMAP_I2C
> > +select DRM_PANEL
> > + select DRM_MIPI_DSI
> > +---help---
> > +  Toshiba TC358775 LVDS bridge chip driver.
> > +
> >  config DRM_TI_TFP410
> >   tristate "TI TFP410 DVI/HDMI bridge"
> >   depends on OF
> > diff --git a/drivers/gpu/drm/bridge/Makefile 
> > b/drivers/gpu/drm/bridge/Makefile
> > index d63d4b7e4347..23c770b3bfe4 100644
> > --- a/drivers/gpu/drm/bridge/Makefile
> > +++ b/drivers/gpu/drm/bridge/Makefile
> > @@ -15,6 +15,7 @@ obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
> >  obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
> >  obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
> >  obj-$(CONFIG_DRM_TOSHIBA_TC358768) += tc358768.o
> > +obj-$(CONFIG_DRM_TOSHIBA_TC358775) += tc358775.o
> >  obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
> >  obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
> >  obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
> > diff --git a/drivers/gpu/drm/bridge/tc358775.c 
> > b/drivers/gpu/drm/bridge/tc358775.c
> > new file mode 100644
> > index ..8c9bd4e77bfd
> > --- /dev/null
> > +++ b/drivers/gpu/drm/bridge/tc358775.c
> > @@ -0,0 +1,721 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * tc358775 DSI to LVDS bridge driver
> > + *
> > + * Copyright (C) 2020 SMART Wireless Computing
> > + * Author: Vinay Simha BN 
> > + *
> > + */
> > +//#define DEBUG
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#define FLD_MASK(start, end)(((1 << ((start) - (end) + 1)) - 1) << 
> > (end))
> > +#define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end))
> > +
> > +/* Registers */
> > +
> > +/* DSI D-PHY Layer Registers */
> > +#define D0W_DPHYCONTTX  0x0004  /* Data Lane 0 DPHY Tx Control */
> > +#define CLW_DPHYCONTRX

[PATCH v4] display/drm/bridge: TC358775 DSI/LVDS driver

2020-06-21 Thread Vinay Simha BN
Signed-off-by: Vinay Simha BN 

---
v1:
 Initial version

v2:
* Andrzej Hajda review comments incorporated
  SPDX identifier
  development debug removed
  alphabetic order headers
  u32 instead of unit32_t
  magic numbers to macros for CLRSI and mux registers
  ignored return value

* Laurent Pinchart review comments incorporated
  mdelay to usleep_range
  bus_formats added

v3:
* Andrzej Hajda review comments incorporated
  drm_connector_status removed
  u32 rev removed and local variabl is used
  regulator enable disable with proper orders and delays
  as per the spec
  devm_drm_panel_bridge_add method used instead of panel
  description modified
  dual port implemented

v4:
* Sam Ravnborg review comments incorporated
  panel->connector_type removed

* Reported-by: kernel test robot 
  parse_dt to static function
  removed the if (endpoint), since data-lanes has to be
  present for dsi dts ports
---
 drivers/gpu/drm/bridge/Kconfig|  10 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/tc358775.c | 721 ++
 3 files changed, 732 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/tc358775.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 43271c21d3fc..084e9853944a 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -181,6 +181,16 @@ config DRM_TOSHIBA_TC358768
help
  Toshiba TC358768AXBG/TC358778XBG DSI bridge chip driver.
 
+config DRM_TOSHIBA_TC358775
+tristate "Toshiba TC358775 LVDS bridge"
+depends on OF
+select DRM_KMS_HELPER
+select REGMAP_I2C
+select DRM_PANEL
+   select DRM_MIPI_DSI
+---help---
+  Toshiba TC358775 LVDS bridge chip driver.
+
 config DRM_TI_TFP410
tristate "TI TFP410 DVI/HDMI bridge"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index d63d4b7e4347..23c770b3bfe4 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358768) += tc358768.o
+obj-$(CONFIG_DRM_TOSHIBA_TC358775) += tc358775.o
 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
 obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
 obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
new file mode 100644
index ..8c9bd4e77bfd
--- /dev/null
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -0,0 +1,721 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * tc358775 DSI to LVDS bridge driver
+ *
+ * Copyright (C) 2020 SMART Wireless Computing
+ * Author: Vinay Simha BN 
+ *
+ */
+//#define DEBUG
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define FLD_MASK(start, end)(((1 << ((start) - (end) + 1)) - 1) << (end))
+#define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end))
+
+/* Registers */
+
+/* DSI D-PHY Layer Registers */
+#define D0W_DPHYCONTTX  0x0004  /* Data Lane 0 DPHY Tx Control */
+#define CLW_DPHYCONTRX  0x0020  /* Clock Lane DPHY Rx Control */
+#define D0W_DPHYCONTRX  0x0024  /* Data Lane 0 DPHY Rx Control */
+#define D1W_DPHYCONTRX  0x0028  /* Data Lane 1 DPHY Rx Control */
+#define D2W_DPHYCONTRX  0x002C  /* Data Lane 2 DPHY Rx Control */
+#define D3W_DPHYCONTRX  0x0030  /* Data Lane 3 DPHY Rx Control */
+#define COM_DPHYCONTRX  0x0038  /* DPHY Rx Common Control */
+#define CLW_CNTRL   0x0040  /* Clock Lane Control */
+#define D0W_CNTRL   0x0044  /* Data Lane 0 Control */
+#define D1W_CNTRL   0x0048  /* Data Lane 1 Control */
+#define D2W_CNTRL   0x004C  /* Data Lane 2 Control */
+#define D3W_CNTRL   0x0050  /* Data Lane 3 Control */
+#define DFTMODE_CNTRL   0x0054  /* DFT Mode Control */
+
+/* DSI PPI Layer Registers */
+#define PPI_STARTPPI0x0104  /* START control bit of PPI-TX function. */
+#define PPI_START_FUNCTION  1
+
+#define PPI_BUSYPPI 0x0108
+#define PPI_LINEINITCNT 0x0110  /* Line Initialization Wait Counter  */
+#define PPI_LPTXTIMECNT 0x0114
+#define PPI_LANEENABLE  0x0134  /* Enables each lane at the PPI layer. */
+#define PPI_TX_RX_TA0x013C  /* DSI Bus Turn Around timing parameters */
+
+/* Analog timer function enable */
+#define PPI_CLS_ATMR0x0140  /* Delay for Clock Lane in LPRX  */
+#define PPI_D0S_ATMR0x0144  /* Delay for Data Lane 0 in LPRX */
+#define PPI_D1S_ATMR0x0148  /* Delay for Data Lane 1 in LPRX */
+#define PPI_D2S_ATMR0x014C  /* Delay for Data Lane 2 in LPRX */
+#define PPI_D3S_ATMR0x0150  /* Delay for Data Lane 3 in LPRX */
+
+#define PPI_D0S_CLRSIPOCOUNT0x0164  /* For lane 0 */
+#defin

[PATCH v3 2/2] display/drm/bridge: TC358775 DSI/LVDS driver

2020-06-18 Thread Vinay Simha BN
Signed-off-by: Vinay Simha BN 

---
v1:
 Initial version

v2:
* Andrzej Hajda review comments incorporated
  SPDX identifier
  development debug removed
  alphabetic order headers
  u32 instead of unit32_t
  magic numbers to macros for CLRSI and mux registers
  ignored return value

* Laurent Pinchart review comments incorporated
  mdelay to usleep_range
  bus_formats added

v3:
* Andrzej Hajda review comments incorporated
  drm_connector_status removed
  u32 rev removed and local variabl is used
  regulator enable disable with proper orders and delays
  as per the spec
  devm_drm_panel_bridge_add method used instead of panel
  description modified
  dual port implemented
---
 drivers/gpu/drm/bridge/Kconfig|  10 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/tc358775.c | 725 ++
 3 files changed, 736 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/tc358775.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 43271c21d3fc..084e9853944a 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -181,6 +181,16 @@ config DRM_TOSHIBA_TC358768
help
  Toshiba TC358768AXBG/TC358778XBG DSI bridge chip driver.
 
+config DRM_TOSHIBA_TC358775
+tristate "Toshiba TC358775 LVDS bridge"
+depends on OF
+select DRM_KMS_HELPER
+select REGMAP_I2C
+select DRM_PANEL
+   select DRM_MIPI_DSI
+---help---
+  Toshiba TC358775 LVDS bridge chip driver.
+
 config DRM_TI_TFP410
tristate "TI TFP410 DVI/HDMI bridge"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index d63d4b7e4347..23c770b3bfe4 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358768) += tc358768.o
+obj-$(CONFIG_DRM_TOSHIBA_TC358775) += tc358775.o
 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
 obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
 obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
new file mode 100644
index ..87af3271b635
--- /dev/null
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -0,0 +1,725 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * tc358775 DSI to LVDS bridge driver
+ *
+ * Copyright (C) 2020 SMART Wireless Computing
+ * Author: Vinay Simha BN 
+ *
+ */
+//#define DEBUG
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define FLD_MASK(start, end)(((1 << ((start) - (end) + 1)) - 1) << (end))
+#define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end))
+
+/* Registers */
+
+/* DSI D-PHY Layer Registers */
+#define D0W_DPHYCONTTX  0x0004  /* Data Lane 0 DPHY Tx Control */
+#define CLW_DPHYCONTRX  0x0020  /* Clock Lane DPHY Rx Control */
+#define D0W_DPHYCONTRX  0x0024  /* Data Lane 0 DPHY Rx Control */
+#define D1W_DPHYCONTRX  0x0028  /* Data Lane 1 DPHY Rx Control */
+#define D2W_DPHYCONTRX  0x002C  /* Data Lane 2 DPHY Rx Control */
+#define D3W_DPHYCONTRX  0x0030  /* Data Lane 3 DPHY Rx Control */
+#define COM_DPHYCONTRX  0x0038  /* DPHY Rx Common Control */
+#define CLW_CNTRL   0x0040  /* Clock Lane Control */
+#define D0W_CNTRL   0x0044  /* Data Lane 0 Control */
+#define D1W_CNTRL   0x0048  /* Data Lane 1 Control */
+#define D2W_CNTRL   0x004C  /* Data Lane 2 Control */
+#define D3W_CNTRL   0x0050  /* Data Lane 3 Control */
+#define DFTMODE_CNTRL   0x0054  /* DFT Mode Control */
+
+/* DSI PPI Layer Registers */
+#define PPI_STARTPPI0x0104  /* START control bit of PPI-TX function. */
+#define PPI_START_FUNCTION  1
+
+#define PPI_BUSYPPI 0x0108
+#define PPI_LINEINITCNT 0x0110  /* Line Initialization Wait Counter  */
+#define PPI_LPTXTIMECNT 0x0114
+#define PPI_LANEENABLE  0x0134  /* Enables each lane at the PPI layer. */
+#define PPI_TX_RX_TA0x013C  /* DSI Bus Turn Around timing parameters */
+
+/* Analog timer function enable */
+#define PPI_CLS_ATMR0x0140  /* Delay for Clock Lane in LPRX  */
+#define PPI_D0S_ATMR0x0144  /* Delay for Data Lane 0 in LPRX */
+#define PPI_D1S_ATMR0x0148  /* Delay for Data Lane 1 in LPRX */
+#define PPI_D2S_ATMR0x014C  /* Delay for Data Lane 2 in LPRX */
+#define PPI_D3S_ATMR0x0150  /* Delay for Data Lane 3 in LPRX */
+
+#define PPI_D0S_CLRSIPOCOUNT0x0164  /* For lane 0 */
+#define PPI_D1S_CLRSIPOCOUNT0x0168  /* For lane 1 */
+#define PPI_D2S_CLRSIPOCOUNT0x016C  /* For lane 2 */
+#define PPI_D3S_CLRSIPOCOUNT0x0170  /* For lane 3 */
+
+#define CLS_PRE 0x0180  /* Digital Counter inside of

[PATCH v3 1/2] dt-binding: Add DSI/LVDS TC358775 bridge bindings

2020-06-18 Thread Vinay Simha BN
Signed-off-by: Vinay Simha BN 

---
v1:
 Initial version wast .txt file

v2:
 From txt to yaml file format

v3:
* Andrzej Hajda review comments incorporated
  dual port lvds implemented

* Laurent Pinchart review comments incorporated
  dsi lanes property removed and it is dynamically
  picked from the dsi ports
  VESA/JEIDA format picked from panel-lvds dts
---
 .../display/bridge/toshiba,tc358775.yaml  | 204 ++
 1 file changed, 204 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml 
b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
new file mode 100644
index ..ec53d62d408b
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
@@ -0,0 +1,204 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/toshiba,tc358775.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Toshiba TC358775 DSI to LVDS bridge bindings
+
+maintainers:
+ - Vinay Simha BN 
+
+description: |
+ This binding supports DSI to LVDS bridge TC358775
+
+properties:
+  compatible:
+const: toshiba,tc358775
+
+  reg:
+maxItems: 1
+description: i2c address of the bridge, 0x0f
+
+  vdd-supply:
+maxItems: 1
+description:  1.2V LVDS Power Supply
+
+  vddio-supply:
+maxItems: 1
+description: 1.8V IO Power Supply
+
+  stby-gpios:
+maxItems: 1
+description: Standby pin, Low active
+
+  reset-gpios:
+maxItems: 1
+description: Hardware reset, Low active
+
+  ports:
+type: object
+description:
+  A node containing input and output port nodes with endpoint definitions
+  as documented in
+  Documentation/devicetree/bindings/media/video-interfaces.txt
+properties:
+  "#address-cells":
+const: 1
+
+  "#size-cells":
+const: 0
+
+  port@0:
+type: object
+description: |
+  DSI Input. The remote endpoint phandle should be a
+  reference to a valid mipi_dsi_host device node.
+
+  port@1:
+type: object
+description: |
+  Video port for LVDS output (panel or connector).
+
+  port@2:
+type: object
+description: |
+  Video port for Dual link LVDS output (panel or connector).
+
+required:
+  - port@0
+  - port@1
+
+required:
+ - compatible
+ - reg
+ - vdd-supply
+ - vddio-supply
+ - stby-gpios
+ - reset-gpios
+ - ports
+
+examples:
+ - |
+#include 
+
+i2c@78b8000 {
+/* On High speed expansion */
+label = "HS-I2C2";
+reg = <0x078b8000 0x500>;
+clock-frequency = <40>; /* fastmode operation */
+#address-cells = <1>;
+#size-cells = <0>;
+
+tc_bridge: bridge@f {
+compatible = "toshiba,tc358775";
+reg = <0x0f>;
+
+vdd-supply = <_l2>;
+vddio-supply = <_l6>;
+
+stby-gpios = < 99 GPIO_ACTIVE_LOW>;
+reset-gpios = < 72 GPIO_ACTIVE_LOW>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+d2l_in_test: endpoint {
+remote-endpoint = <_out>;
+};
+};
+
+port@1 {
+reg = <1>;
+lvds_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+};
+};
+};
+
+dsi@1a98000 {
+reg = <0x1a98000 0x25c>;
+reg-names = "dsi_ctrl";
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+port@1 {
+reg = <1>;
+dsi0_out: endpoint {
+remote-endpoint = <_in_test>;
+data-lanes = <0 1 2 3>;
+};
+ };
+ };
+ };
+
+ - |
+i2c@78b8000 {
+/* On High speed expansion */
+label = "HS-I2C2";
+reg = <0x078b8000 0x500>;
+clock-frequency = <40>; /* fastmode operation */
+#address-cells = <1>;
+#size-cells = <0>;
+
+tc_bridge_dual: bridge@f {
+compatible = "toshiba,tc358775";
+reg = <0x0f>;
+
+vdd-supply = <_l2>;
+vddio-supply = <_l6>;
+
+stby-gpios = < 99 GPIO_ACTIVE_LOW>;
+reset-gpios = < 72 GPIO_ACTIVE_LOW>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;

Re: [PATCH 1/2] dt-binding: Add DSI/LVDS tc358775 bridge bindings

2020-06-08 Thread Vinay Simha B N
sam,

This is my latest yaml file
https://github.com/vinaysimhabn/kernel-msm/blob/5.6.0-rc3-d2l-wip/Documentation/devicetree/bindings/display/bridge/toshiba%2Ctc358775.yaml

 make CROSS_COMPILE=$TC64 ARCH=arm64
DT_SCHEMA_FILES=Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.yaml
dt_binding_check
i am getting these errors
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.example.dt.yaml:
lvds-out: 'data-mapping', 'height-mm', 'panel-timing', 'width-mm' do
not match any of the regexes: 'pinctrl-[0-9]+'
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.example.dt.yaml:
lvds-out: compatible: Additional items are not allowed ('panel-lvds'
was unexpected)
Documentation/devicetree/bindings/display/bridge/toshiba,tc358775.example.dt.yaml:
lvds-out: compatible: ['auo,b101xtn01', 'panel-lvds'] is too long

Please suggest how to add the references of panel/lvds.yaml or
panel/panel-common.yaml and panel/advantech,idk-2121wr.yaml in my yaml
file.

On Tue, Mar 17, 2020 at 7:57 PM Sam Ravnborg  wrote:
>
> Hi Vinay.
>
> On Tue, Mar 17, 2020 at 12:25:42PM +0530, Vinay Simha B N wrote:
> > sam,
> >
> > i need some inputs on the below  error. I had created this file
> > Documentation/devicetree/bindings/display/bridge/toshiba-tc358775.yaml
> > by using vim editor. Do we have any tool to create yaml file?
>
> I use vim myself, but is careful to follow the right syntax.
>
> >
> > i do not get the error when running 'make dt_binding_check' in my
> > build environment
> > Documentation/devicetree/bindings/display/bridge/toshiba-tc358775.yaml
> >
> > is there any tool available similar to  scripts/checkpatch.pl -f
> >  , for yaml files?
>
> Please read Documentation/devicetree/writing-schema.
> Here you can find general info + instruction how to install the tools
> required for "make dt_binding_check".
>
> I could reproduce the error reported by Rob.
> I gave your binding file a shot - there were a lot of smaller issues:
>
> - do not use tabs in yaml files
> - be consistent in indent
> - vendor prefixed properties needed some extra care
> - example was full of bugs
>   - "..."
>   - no need for status = "okay";
>   - properties spelled wrong
>
> For the example I adjusted it to use indent of 4 spaces, which IMO
> is more readable than the two spaces used in the other parts of the
> file.
>
> I have attached the updated binding file - please review and fix.
> This is just a quick shot, I did not do a proper review.
>
> Please rename the file, other files in same dir are named "toshiba,xxx",
> so replace '-' with ','.
>
> And try to introduce bugs in the example - and check that the tooling
> catches the bug.
>
> hint:
>
> make DT=.../foo.yaml dt_binding_check
>
> is a qucik way to check only your binding.
>
> And for new bindings the preferred license is: (GPL-2.0-only OR BSD-2-Clause)
>
> Sam
>
> # SPDX-License-Identifier: GPL-2.0
> %YAML 1.2
> ---
> $id: http://devicetree.org/schemas/display/bridge/toshiba-tc358775.yaml#
> $schema: http://devicetree.org/meta-schemas/core.yaml#
>
>
> title: Toshiba TC358775 DSI to LVDS bridge bindings
>
> maintainers:
>   - Vinay Simha BN 
>
> description: |
>   This binding supports DSI to LVDS bridge TC358775
>
> properties:
>   compatible:
> const: toshiba,tc358775
>
>   reg:
> maxItems: 1
> description: i2c address of the bridge, 0x0f
>
>   toshiba,dsi-lanes:
> allOf:
>   - $ref: /schemas/types.yaml#/definitions/uint32
>   - minimum: 1
> maximum: 4
> default: 1
> description: bla bla
>
>   toshiba,dual-link:
> $ref: /schemas/types.yaml#definitions/flag
> description: bla bla
>
>   vdd-supply:
> maxItems: 1
> description: 1.2V LVDS Power Supply
>
>   vddio-supply:
> maxItems: 1
> description: 1.8V IO Power Supply
>
>   stby-gpios:
> maxItems: 1
> description: Standby pin, Low active
>
>   reset-gpios:
> maxItems: 1
> description: Hardware reset, Low active
>
>   ports:
> type: object
>
> properties:
>   port@0:
> type: object
> description: |
>   DSI Input. The remote endpoint phandle should be a
>   reference to a valid mipi_dsi_host device node.
>   port@1:
> type: object
> description: |
>   Video port for LVDS output (panel or connector).
>
> required:
>   - port@0
>   - port@1
>
> required:
>  - compatible
>  - reg
>  - tc,dsi-lanes
>  - vdd-supply
>  - vddio-supply
>  - stby-gpios
>  - res

[PATCH v2] pinctrl: qcom: General Purpose clocks for apq8064

2017-08-16 Thread Vinay Simha BN
Add support for general purpose (GP) clocks
for apq8064

DT binding documentation updated for
qcom,apq8064-pinctrl general purpose (GP) clocks.

Acked-by: Bjorn Andersson <bjorn.anders...@linaro.org>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>

---
v1:
* only gp_clk_1b tested in nexus7 anx7808 slimport.

v2:
* bjorn review comments incorporated
  added gp clock functions
  merged documentation and driver to single patch
---
---
 .../bindings/pinctrl/qcom,apq8064-pinctrl.txt  |  3 +-
 drivers/pinctrl/qcom/pinctrl-apq8064.c | 42 ++
 2 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt 
b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
index a7bde64..a752a47 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
@@ -46,7 +46,8 @@ Valid values for pins are:
   gpio0-gpio89
 
 Valid values for function are:
-  cam_mclk, codec_mic_i2s, codec_spkr_i2s, gpio, gsbi1, gsbi2, gsbi3, gsbi4,
+  cam_mclk, codec_mic_i2s, codec_spkr_i2s, gp_clk_0a, gp_clk_0b, gp_clk_1a,
+  gp_clk_1b, gp_clk_2a, gp_clk_2b, gpio, gsbi1, gsbi2, gsbi3, gsbi4,
   gsbi4_cam_i2c, gsbi5, gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6,
   gsbi6_spi_cs1, gsbi6_spi_cs2, gsbi6_spi_cs3, gsbi7, gsbi7_spi_cs1,
   gsbi7_spi_cs2, gsbi7_spi_cs3, gsbi_cam_i2c, hdmi, mi2s, riva_bt, riva_fm,
diff --git a/drivers/pinctrl/qcom/pinctrl-apq8064.c 
b/drivers/pinctrl/qcom/pinctrl-apq8064.c
index cd96699..bcf9e61 100644
--- a/drivers/pinctrl/qcom/pinctrl-apq8064.c
+++ b/drivers/pinctrl/qcom/pinctrl-apq8064.c
@@ -295,6 +295,12 @@ enum apq8064_functions {
APQ_MUX_cam_mclk,
APQ_MUX_codec_mic_i2s,
APQ_MUX_codec_spkr_i2s,
+   APQ_MUX_gp_clk_0a,
+   APQ_MUX_gp_clk_0b,
+   APQ_MUX_gp_clk_1a,
+   APQ_MUX_gp_clk_1b,
+   APQ_MUX_gp_clk_2a,
+   APQ_MUX_gp_clk_2b,
APQ_MUX_gpio,
APQ_MUX_gsbi1,
APQ_MUX_gsbi2,
@@ -354,6 +360,24 @@ static const char * const gpio_groups[] = {
"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
"gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
 };
+static const char * const gp_clk_0a_groups[] = {
+   "gpio3"
+};
+static const char * const gp_clk_0b_groups[] = {
+   "gpio34"
+};
+static const char * const gp_clk_1a_groups[] = {
+   "gpio4"
+};
+static const char * const gp_clk_1b_groups[] = {
+   "gpio50"
+};
+static const char * const gp_clk_2a_groups[] = {
+   "gpio32"
+};
+static const char * const gp_clk_2b_groups[] = {
+   "gpio25"
+};
 static const char * const ps_hold_groups[] = {
"gpio78"
 };
@@ -452,6 +476,12 @@ static const struct msm_function apq8064_functions[] = {
FUNCTION(cam_mclk),
FUNCTION(codec_mic_i2s),
FUNCTION(codec_spkr_i2s),
+   FUNCTION(gp_clk_0a),
+   FUNCTION(gp_clk_0b),
+   FUNCTION(gp_clk_1a),
+   FUNCTION(gp_clk_1b),
+   FUNCTION(gp_clk_2a),
+   FUNCTION(gp_clk_2b),
FUNCTION(gpio),
FUNCTION(gsbi1),
FUNCTION(gsbi2),
@@ -490,8 +520,8 @@ static const struct msm_pingroup apq8064_groups[] = {
PINGROUP(0, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(3, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(4, NA, NA, cam_mclk, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(3, NA, gp_clk_0a, NA, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(4, NA, NA, cam_mclk, gp_clk_1a, NA, NA, NA, NA, NA, NA),
PINGROUP(5, NA, cam_mclk, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(6, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(7, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA),
@@ -512,16 +542,16 @@ static const struct msm_pingroup apq8064_groups[] = {
PINGROUP(22, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(23, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(24, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(25, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(25, gsbi2, gp_clk_2b, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(26, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(27, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(28, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(29, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(30, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(31, mi2s, NA, gsbi5_spi_cs2, gsbi6_spi_cs2, gsbi7_spi_cs2, NA, 
NA, NA, NA, NA),
-   PINGROUP(32, mi2s, NA, NA, NA, NA, gsbi5_s

[PATCH v2] pinctrl: qcom: General Purpose clocks for apq8064

2017-08-16 Thread Vinay Simha BN
Add support for general purpose (GP) clocks
for apq8064

DT binding documentation updated for
qcom,apq8064-pinctrl general purpose (GP) clocks.

Acked-by: Bjorn Andersson 
Signed-off-by: Vinay Simha BN 

---
v1:
* only gp_clk_1b tested in nexus7 anx7808 slimport.

v2:
* bjorn review comments incorporated
  added gp clock functions
  merged documentation and driver to single patch
---
---
 .../bindings/pinctrl/qcom,apq8064-pinctrl.txt  |  3 +-
 drivers/pinctrl/qcom/pinctrl-apq8064.c | 42 ++
 2 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt 
b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
index a7bde64..a752a47 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
@@ -46,7 +46,8 @@ Valid values for pins are:
   gpio0-gpio89
 
 Valid values for function are:
-  cam_mclk, codec_mic_i2s, codec_spkr_i2s, gpio, gsbi1, gsbi2, gsbi3, gsbi4,
+  cam_mclk, codec_mic_i2s, codec_spkr_i2s, gp_clk_0a, gp_clk_0b, gp_clk_1a,
+  gp_clk_1b, gp_clk_2a, gp_clk_2b, gpio, gsbi1, gsbi2, gsbi3, gsbi4,
   gsbi4_cam_i2c, gsbi5, gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6,
   gsbi6_spi_cs1, gsbi6_spi_cs2, gsbi6_spi_cs3, gsbi7, gsbi7_spi_cs1,
   gsbi7_spi_cs2, gsbi7_spi_cs3, gsbi_cam_i2c, hdmi, mi2s, riva_bt, riva_fm,
diff --git a/drivers/pinctrl/qcom/pinctrl-apq8064.c 
b/drivers/pinctrl/qcom/pinctrl-apq8064.c
index cd96699..bcf9e61 100644
--- a/drivers/pinctrl/qcom/pinctrl-apq8064.c
+++ b/drivers/pinctrl/qcom/pinctrl-apq8064.c
@@ -295,6 +295,12 @@ enum apq8064_functions {
APQ_MUX_cam_mclk,
APQ_MUX_codec_mic_i2s,
APQ_MUX_codec_spkr_i2s,
+   APQ_MUX_gp_clk_0a,
+   APQ_MUX_gp_clk_0b,
+   APQ_MUX_gp_clk_1a,
+   APQ_MUX_gp_clk_1b,
+   APQ_MUX_gp_clk_2a,
+   APQ_MUX_gp_clk_2b,
APQ_MUX_gpio,
APQ_MUX_gsbi1,
APQ_MUX_gsbi2,
@@ -354,6 +360,24 @@ static const char * const gpio_groups[] = {
"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
"gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
 };
+static const char * const gp_clk_0a_groups[] = {
+   "gpio3"
+};
+static const char * const gp_clk_0b_groups[] = {
+   "gpio34"
+};
+static const char * const gp_clk_1a_groups[] = {
+   "gpio4"
+};
+static const char * const gp_clk_1b_groups[] = {
+   "gpio50"
+};
+static const char * const gp_clk_2a_groups[] = {
+   "gpio32"
+};
+static const char * const gp_clk_2b_groups[] = {
+   "gpio25"
+};
 static const char * const ps_hold_groups[] = {
"gpio78"
 };
@@ -452,6 +476,12 @@ static const struct msm_function apq8064_functions[] = {
FUNCTION(cam_mclk),
FUNCTION(codec_mic_i2s),
FUNCTION(codec_spkr_i2s),
+   FUNCTION(gp_clk_0a),
+   FUNCTION(gp_clk_0b),
+   FUNCTION(gp_clk_1a),
+   FUNCTION(gp_clk_1b),
+   FUNCTION(gp_clk_2a),
+   FUNCTION(gp_clk_2b),
FUNCTION(gpio),
FUNCTION(gsbi1),
FUNCTION(gsbi2),
@@ -490,8 +520,8 @@ static const struct msm_pingroup apq8064_groups[] = {
PINGROUP(0, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(3, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(4, NA, NA, cam_mclk, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(3, NA, gp_clk_0a, NA, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(4, NA, NA, cam_mclk, gp_clk_1a, NA, NA, NA, NA, NA, NA),
PINGROUP(5, NA, cam_mclk, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(6, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(7, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA),
@@ -512,16 +542,16 @@ static const struct msm_pingroup apq8064_groups[] = {
PINGROUP(22, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(23, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(24, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(25, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(25, gsbi2, gp_clk_2b, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(26, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(27, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(28, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(29, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(30, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(31, mi2s, NA, gsbi5_spi_cs2, gsbi6_spi_cs2, gsbi7_spi_cs2, NA, 
NA, NA, NA, NA),
-   PINGROUP(32, mi2s, NA, NA, NA, NA, gsbi5_spi_cs3, gsbi6_spi_cs3, 
gsbi7_spi_cs3, NA, NA),
+   PINGR

[PATCH 1/2] pinctrl: msm: GP clock for pinctrl-apq8064 binding

2017-08-11 Thread Vinay Simha BN
DT binding documentation for qcom,apq8064-pinctrl driver
for general purpose (GP) clocks.

Signed-off-by: Vinay Simha BN <simha...@gmail.com>
---
 Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt 
b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
index a7bde64..a752a47 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
@@ -46,7 +46,8 @@ Valid values for pins are:
   gpio0-gpio89
 
 Valid values for function are:
-  cam_mclk, codec_mic_i2s, codec_spkr_i2s, gpio, gsbi1, gsbi2, gsbi3, gsbi4,
+  cam_mclk, codec_mic_i2s, codec_spkr_i2s, gp_clk_0a, gp_clk_0b, gp_clk_1a,
+  gp_clk_1b, gp_clk_2a, gp_clk_2b, gpio, gsbi1, gsbi2, gsbi3, gsbi4,
   gsbi4_cam_i2c, gsbi5, gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6,
   gsbi6_spi_cs1, gsbi6_spi_cs2, gsbi6_spi_cs3, gsbi7, gsbi7_spi_cs1,
   gsbi7_spi_cs2, gsbi7_spi_cs3, gsbi_cam_i2c, hdmi, mi2s, riva_bt, riva_fm,
-- 
2.7.4



[PATCH 1/2] pinctrl: msm: GP clock for pinctrl-apq8064 binding

2017-08-11 Thread Vinay Simha BN
DT binding documentation for qcom,apq8064-pinctrl driver
for general purpose (GP) clocks.

Signed-off-by: Vinay Simha BN 
---
 Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt 
b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
index a7bde64..a752a47 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
@@ -46,7 +46,8 @@ Valid values for pins are:
   gpio0-gpio89
 
 Valid values for function are:
-  cam_mclk, codec_mic_i2s, codec_spkr_i2s, gpio, gsbi1, gsbi2, gsbi3, gsbi4,
+  cam_mclk, codec_mic_i2s, codec_spkr_i2s, gp_clk_0a, gp_clk_0b, gp_clk_1a,
+  gp_clk_1b, gp_clk_2a, gp_clk_2b, gpio, gsbi1, gsbi2, gsbi3, gsbi4,
   gsbi4_cam_i2c, gsbi5, gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6,
   gsbi6_spi_cs1, gsbi6_spi_cs2, gsbi6_spi_cs3, gsbi7, gsbi7_spi_cs1,
   gsbi7_spi_cs2, gsbi7_spi_cs3, gsbi_cam_i2c, hdmi, mi2s, riva_bt, riva_fm,
-- 
2.7.4



[PATCH 2/2] pinctrl: qcom: General Purpose clocks for apq8064

2017-08-11 Thread Vinay Simha BN
Add support for general purpose (GP) clocks
for apq8064

Signed-off-by: Vinay Simha BN <simha...@gmail.com>

---
v1:
* only gp_clk_1b tested in nexus7 anx7808 slimport.
---
 drivers/pinctrl/qcom/pinctrl-apq8064.c | 37 --
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-apq8064.c 
b/drivers/pinctrl/qcom/pinctrl-apq8064.c
index cd96699..e59ee61 100644
--- a/drivers/pinctrl/qcom/pinctrl-apq8064.c
+++ b/drivers/pinctrl/qcom/pinctrl-apq8064.c
@@ -295,6 +295,12 @@ enum apq8064_functions {
APQ_MUX_cam_mclk,
APQ_MUX_codec_mic_i2s,
APQ_MUX_codec_spkr_i2s,
+   APQ_MUX_gp_clk_0a,
+   APQ_MUX_gp_clk_0b,
+   APQ_MUX_gp_clk_1a,
+   APQ_MUX_gp_clk_1b,
+   APQ_MUX_gp_clk_2a,
+   APQ_MUX_gp_clk_2b,
APQ_MUX_gpio,
APQ_MUX_gsbi1,
APQ_MUX_gsbi2,
@@ -354,6 +360,24 @@ static const char * const gpio_groups[] = {
"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
"gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
 };
+static const char * const gp_clk_0a_groups[] = {
+   "gpio3"
+};
+static const char * const gp_clk_0b_groups[] = {
+   "gpio34"
+};
+static const char * const gp_clk_1a_groups[] = {
+   "gpio4"
+};
+static const char * const gp_clk_1b_groups[] = {
+   "gpio50"
+};
+static const char * const gp_clk_2a_groups[] = {
+   "gpio32"
+};
+static const char * const gp_clk_2b_groups[] = {
+   "gpio25"
+};
 static const char * const ps_hold_groups[] = {
"gpio78"
 };
@@ -453,6 +477,7 @@ static const struct msm_function apq8064_functions[] = {
FUNCTION(codec_mic_i2s),
FUNCTION(codec_spkr_i2s),
FUNCTION(gpio),
+   FUNCTION(gp_clk_1b),
FUNCTION(gsbi1),
FUNCTION(gsbi2),
FUNCTION(gsbi3),
@@ -490,8 +515,8 @@ static const struct msm_pingroup apq8064_groups[] = {
PINGROUP(0, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(3, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(4, NA, NA, cam_mclk, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(3, NA, gp_clk_0a, NA, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(4, NA, NA, cam_mclk, gp_clk_1a, NA, NA, NA, NA, NA, NA),
PINGROUP(5, NA, cam_mclk, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(6, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(7, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA),
@@ -512,16 +537,16 @@ static const struct msm_pingroup apq8064_groups[] = {
PINGROUP(22, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(23, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(24, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(25, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(25, gsbi2, gp_clk_2b, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(26, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(27, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(28, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(29, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(30, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(31, mi2s, NA, gsbi5_spi_cs2, gsbi6_spi_cs2, gsbi7_spi_cs2, NA, 
NA, NA, NA, NA),
-   PINGROUP(32, mi2s, NA, NA, NA, NA, gsbi5_spi_cs3, gsbi6_spi_cs3, 
gsbi7_spi_cs3, NA, NA),
+   PINGROUP(32, mi2s, gp_clk_2a, NA, NA, NA, gsbi5_spi_cs3, gsbi6_spi_cs3, 
gsbi7_spi_cs3, NA, NA),
PINGROUP(33, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(34, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(34, codec_mic_i2s, gp_clk_0b, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(35, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(36, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(37, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
@@ -537,7 +562,7 @@ static const struct msm_pingroup apq8064_groups[] = {
PINGROUP(47, spkr_i2s, gsbi5_spi_cs1, gsbi6_spi_cs1, gsbi7_spi_cs1, NA, 
NA, NA, NA, NA, NA),
PINGROUP(48, spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(49, spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(50, spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(50, spkr_i2s, gp_clk_1b, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(51, NA, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(52, NA, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(53, NA, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA),
-- 
2.7.4



[PATCH 2/2] pinctrl: qcom: General Purpose clocks for apq8064

2017-08-11 Thread Vinay Simha BN
Add support for general purpose (GP) clocks
for apq8064

Signed-off-by: Vinay Simha BN 

---
v1:
* only gp_clk_1b tested in nexus7 anx7808 slimport.
---
 drivers/pinctrl/qcom/pinctrl-apq8064.c | 37 --
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-apq8064.c 
b/drivers/pinctrl/qcom/pinctrl-apq8064.c
index cd96699..e59ee61 100644
--- a/drivers/pinctrl/qcom/pinctrl-apq8064.c
+++ b/drivers/pinctrl/qcom/pinctrl-apq8064.c
@@ -295,6 +295,12 @@ enum apq8064_functions {
APQ_MUX_cam_mclk,
APQ_MUX_codec_mic_i2s,
APQ_MUX_codec_spkr_i2s,
+   APQ_MUX_gp_clk_0a,
+   APQ_MUX_gp_clk_0b,
+   APQ_MUX_gp_clk_1a,
+   APQ_MUX_gp_clk_1b,
+   APQ_MUX_gp_clk_2a,
+   APQ_MUX_gp_clk_2b,
APQ_MUX_gpio,
APQ_MUX_gsbi1,
APQ_MUX_gsbi2,
@@ -354,6 +360,24 @@ static const char * const gpio_groups[] = {
"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
"gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
 };
+static const char * const gp_clk_0a_groups[] = {
+   "gpio3"
+};
+static const char * const gp_clk_0b_groups[] = {
+   "gpio34"
+};
+static const char * const gp_clk_1a_groups[] = {
+   "gpio4"
+};
+static const char * const gp_clk_1b_groups[] = {
+   "gpio50"
+};
+static const char * const gp_clk_2a_groups[] = {
+   "gpio32"
+};
+static const char * const gp_clk_2b_groups[] = {
+   "gpio25"
+};
 static const char * const ps_hold_groups[] = {
"gpio78"
 };
@@ -453,6 +477,7 @@ static const struct msm_function apq8064_functions[] = {
FUNCTION(codec_mic_i2s),
FUNCTION(codec_spkr_i2s),
FUNCTION(gpio),
+   FUNCTION(gp_clk_1b),
FUNCTION(gsbi1),
FUNCTION(gsbi2),
FUNCTION(gsbi3),
@@ -490,8 +515,8 @@ static const struct msm_pingroup apq8064_groups[] = {
PINGROUP(0, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(3, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(4, NA, NA, cam_mclk, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(3, NA, gp_clk_0a, NA, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(4, NA, NA, cam_mclk, gp_clk_1a, NA, NA, NA, NA, NA, NA),
PINGROUP(5, NA, cam_mclk, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(6, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(7, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA),
@@ -512,16 +537,16 @@ static const struct msm_pingroup apq8064_groups[] = {
PINGROUP(22, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(23, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(24, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(25, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(25, gsbi2, gp_clk_2b, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(26, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(27, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(28, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(29, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(30, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(31, mi2s, NA, gsbi5_spi_cs2, gsbi6_spi_cs2, gsbi7_spi_cs2, NA, 
NA, NA, NA, NA),
-   PINGROUP(32, mi2s, NA, NA, NA, NA, gsbi5_spi_cs3, gsbi6_spi_cs3, 
gsbi7_spi_cs3, NA, NA),
+   PINGROUP(32, mi2s, gp_clk_2a, NA, NA, NA, gsbi5_spi_cs3, gsbi6_spi_cs3, 
gsbi7_spi_cs3, NA, NA),
PINGROUP(33, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(34, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(34, codec_mic_i2s, gp_clk_0b, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(35, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(36, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(37, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
@@ -537,7 +562,7 @@ static const struct msm_pingroup apq8064_groups[] = {
PINGROUP(47, spkr_i2s, gsbi5_spi_cs1, gsbi6_spi_cs1, gsbi7_spi_cs1, NA, 
NA, NA, NA, NA, NA),
PINGROUP(48, spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(49, spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-   PINGROUP(50, spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
+   PINGROUP(50, spkr_i2s, gp_clk_1b, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(51, NA, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(52, NA, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA),
PINGROUP(53, NA, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA),
-- 
2.7.4



Re: [PATCH] power: smb347-charger: Summit SMB358 charger IC

2017-08-07 Thread Vinay Simha B N
In the config attached. CONFIG_GPIOLIB is not set. please set and recompile

fyi,
devm_gpiod_get() declared in drivers/gpio/devres.c -> CONFIG_GPIOLIB

On Thu, Aug 3, 2017 at 3:28 AM, kbuild test robot <l...@intel.com> wrote:
>
> Hi Vinay,
>
> [auto build test ERROR on linus/master]
> [also build test ERROR on v4.13-rc3 next-20170802]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
>
> url:
> https://github.com/0day-ci/linux/commits/Vinay-Simha-BN/power-smb347-charger-Summit-SMB358-charger-IC/20170802-054147
> config: x86_64-randconfig-b0-08030519 (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> All errors (new ones prefixed by >>):
>
>drivers/power/supply/smb347-charger.c: In function 'smb347_probe':
> >> drivers/power/supply/smb347-charger.c:1341:24: error: implicit declaration 
> >> of function 'devm_gpiod_get' [-Werror=implicit-function-declaration]
>  smb->pdata->en_gpio = devm_gpiod_get(dev, "en", GPIOD_OUT_HIGH);
>^~
> >> drivers/power/supply/smb347-charger.c:1341:50: error: 'GPIOD_OUT_HIGH' 
> >> undeclared (first use in this function)
>  smb->pdata->en_gpio = devm_gpiod_get(dev, "en", GPIOD_OUT_HIGH);
>  ^~
>drivers/power/supply/smb347-charger.c:1341:50: note: each undeclared 
> identifier is reported only once for each function it appears in
>cc1: some warnings being treated as errors
>
> vim +/devm_gpiod_get +1341 drivers/power/supply/smb347-charger.c
>
>   1273
>   1274  static int smb347_probe(struct i2c_client *client,
>   1275  const struct i2c_device_id *id)
>   1276  {
>   1277  struct power_supply_config mains_usb_cfg = {}, battery_cfg = 
> {};
>   1278  struct device *dev = >dev;
>   1279  struct smb347_charger *smb;
>   1280  int ret;
>   1281
>   1282  smb = devm_kzalloc(dev, sizeof(*smb), GFP_KERNEL);
>   1283  if (!smb)
>   1284  return -ENOMEM;
>   1285
>   1286  smb->pdata = smb347_get_platdata(dev);
>   1287  if (IS_ERR_OR_NULL(smb->pdata))
>   1288  return -ENODEV;
>   1289
>   1290  if (!smb->pdata->use_mains && !smb->pdata->use_usb)
>   1291  return -EINVAL;
>   1292
>   1293  i2c_set_clientdata(client, smb);
>   1294
>   1295  mutex_init(>lock);
>   1296  smb->id = id->driver_data;
>   1297  smb->dev = >dev;
>   1298
>   1299  smb->regmap = devm_regmap_init_i2c(client, _regmap);
>   1300  if (IS_ERR(smb->regmap))
>   1301  return PTR_ERR(smb->regmap);
>   1302
>   1303  ret = smb347_hw_init(smb);
>   1304  if (ret < 0)
>   1305  return ret;
>   1306
>   1307  mains_usb_cfg.supplied_to = battery;
>   1308  mains_usb_cfg.num_supplicants = ARRAY_SIZE(battery);
>   1309  mains_usb_cfg.drv_data = smb;
>   1310  if (smb->pdata->use_mains) {
>   1311  smb->mains = power_supply_register(dev, 
> _mains_desc,
>   1312 _usb_cfg);
>   1313  if (IS_ERR(smb->mains))
>   1314  return PTR_ERR(smb->mains);
>   1315  }
>   1316
>   1317  if (smb->pdata->use_usb) {
>   1318  smb->usb = power_supply_register(dev, 
> _usb_desc,
>   1319   _usb_cfg);
>   1320  if (IS_ERR(smb->usb)) {
>   1321  if (smb->pdata->use_mains)
>   1322  power_supply_unregister(smb->mains);
>   1323  return PTR_ERR(smb->usb);
>   1324  }
>   1325  }
>   1326
>   1327  battery_cfg.drv_data = smb;
>   1328  smb->battery = power_supply_register(dev, 
> _battery_desc,
>   1329   _cfg);
>   1330  if (IS_ERR(smb->battery)) {
>   1331  if (smb->pdata->use_usb)
>   1332  power_supply_unregister(smb->usb);
>   1333  if (smb->pdata->use_mains)
>   1334  power_supply_unregister(smb->mains);
>   1335  return PTR_ER

Re: [PATCH] power: smb347-charger: Summit SMB358 charger IC

2017-08-07 Thread Vinay Simha B N
In the config attached. CONFIG_GPIOLIB is not set. please set and recompile

fyi,
devm_gpiod_get() declared in drivers/gpio/devres.c -> CONFIG_GPIOLIB

On Thu, Aug 3, 2017 at 3:28 AM, kbuild test robot  wrote:
>
> Hi Vinay,
>
> [auto build test ERROR on linus/master]
> [also build test ERROR on v4.13-rc3 next-20170802]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
>
> url:
> https://github.com/0day-ci/linux/commits/Vinay-Simha-BN/power-smb347-charger-Summit-SMB358-charger-IC/20170802-054147
> config: x86_64-randconfig-b0-08030519 (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> All errors (new ones prefixed by >>):
>
>drivers/power/supply/smb347-charger.c: In function 'smb347_probe':
> >> drivers/power/supply/smb347-charger.c:1341:24: error: implicit declaration 
> >> of function 'devm_gpiod_get' [-Werror=implicit-function-declaration]
>  smb->pdata->en_gpio = devm_gpiod_get(dev, "en", GPIOD_OUT_HIGH);
>^~
> >> drivers/power/supply/smb347-charger.c:1341:50: error: 'GPIOD_OUT_HIGH' 
> >> undeclared (first use in this function)
>  smb->pdata->en_gpio = devm_gpiod_get(dev, "en", GPIOD_OUT_HIGH);
>  ^~
>drivers/power/supply/smb347-charger.c:1341:50: note: each undeclared 
> identifier is reported only once for each function it appears in
>cc1: some warnings being treated as errors
>
> vim +/devm_gpiod_get +1341 drivers/power/supply/smb347-charger.c
>
>   1273
>   1274  static int smb347_probe(struct i2c_client *client,
>   1275  const struct i2c_device_id *id)
>   1276  {
>   1277  struct power_supply_config mains_usb_cfg = {}, battery_cfg = 
> {};
>   1278  struct device *dev = >dev;
>   1279  struct smb347_charger *smb;
>   1280  int ret;
>   1281
>   1282  smb = devm_kzalloc(dev, sizeof(*smb), GFP_KERNEL);
>   1283  if (!smb)
>   1284  return -ENOMEM;
>   1285
>   1286  smb->pdata = smb347_get_platdata(dev);
>   1287  if (IS_ERR_OR_NULL(smb->pdata))
>   1288  return -ENODEV;
>   1289
>   1290  if (!smb->pdata->use_mains && !smb->pdata->use_usb)
>   1291  return -EINVAL;
>   1292
>   1293  i2c_set_clientdata(client, smb);
>   1294
>   1295  mutex_init(>lock);
>   1296  smb->id = id->driver_data;
>   1297  smb->dev = >dev;
>   1298
>   1299  smb->regmap = devm_regmap_init_i2c(client, _regmap);
>   1300  if (IS_ERR(smb->regmap))
>   1301  return PTR_ERR(smb->regmap);
>   1302
>   1303  ret = smb347_hw_init(smb);
>   1304  if (ret < 0)
>   1305  return ret;
>   1306
>   1307  mains_usb_cfg.supplied_to = battery;
>   1308  mains_usb_cfg.num_supplicants = ARRAY_SIZE(battery);
>   1309  mains_usb_cfg.drv_data = smb;
>   1310  if (smb->pdata->use_mains) {
>   1311  smb->mains = power_supply_register(dev, 
> _mains_desc,
>   1312 _usb_cfg);
>   1313  if (IS_ERR(smb->mains))
>   1314  return PTR_ERR(smb->mains);
>   1315  }
>   1316
>   1317  if (smb->pdata->use_usb) {
>   1318  smb->usb = power_supply_register(dev, 
> _usb_desc,
>   1319   _usb_cfg);
>   1320  if (IS_ERR(smb->usb)) {
>   1321  if (smb->pdata->use_mains)
>   1322  power_supply_unregister(smb->mains);
>   1323  return PTR_ERR(smb->usb);
>   1324  }
>   1325  }
>   1326
>   1327  battery_cfg.drv_data = smb;
>   1328  smb->battery = power_supply_register(dev, 
> _battery_desc,
>   1329   _cfg);
>   1330  if (IS_ERR(smb->battery)) {
>   1331  if (smb->pdata->use_usb)
>   1332  power_supply_unregister(smb->usb);
>   1333  if (smb->pdata->use_mains)
>   1334  power_supply_unregister(smb->mains);
>   1335  return PTR_ERR(smb->battery);
>   

[PATCH] power: smb347-charger: Summit SMB358 charger IC

2017-08-01 Thread Vinay Simha BN
Summit microelectronics' SMB358 charger chip has
almost the same register map and functionality.
voltage and current table are only differed.

SMB345 charger IC tested in nexus7

Cc: John Stultz <john.stu...@linaro.org>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Cc: Jonghwa Lee <jonghwa3@samsung.com>
Cc: Chanwoo Choi <cw00.c...@samsung.com>
Cc: Myungjoo Ham <myungjoo@samsung.com>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>

---
v2:
* incorporated code review from Rob Herring
  gpio line added for Enable charging control,
  documentation bindings (vendor prefixes and unit suffixes)
---
 .../bindings/power/supply/smb347_charger.txt   |  73 +
 drivers/power/supply/smb347-charger.c  | 334 +
 include/linux/power/smb347-charger.h   |   4 +-
 3 files changed, 283 insertions(+), 128 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/power/supply/smb347_charger.txt

diff --git a/Documentation/devicetree/bindings/power/supply/smb347_charger.txt 
b/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
new file mode 100644
index 000..45da4ee
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
@@ -0,0 +1,73 @@
+smb347_charger bindings
+
+
+[Required porperties]
+- compatible : "summit,smb345"
+  "summit,smb347"
+- reg : Slave address for i2c interface
+# At least one of following should be set
+  - enable-usb-charging
+  - enable-otg-charging
+  - enable-mains-charging
+
+[Optional properties]
+- interrupt-parent : The phandle for the interrupt controller
+- interrupts : Interrupt line index for mapping
+- en-gpio : Enable charging control
+ : If this is not specified it will use SW (i2c interface)
+
+# Charging constraints
+- max-chg-curr : microamps for charging Maximum current
+- max-chg-volt : microvolts for charging Maximum voltage
+- pre-chg-curr : microamps for Pre-charging current
+- term-curr : microamps for Charging cycle termination current
+- fast-volt-thershold : microvolts for Voltage threshold to transit to fast 
charge mode
+- mains-curr-limit : micromaps for Maximum input current from AC/DC input
+- usb-curr-limit : microamps for Maximum input current from USB input
+
+# Related thermometer monitoring (Degrees Celsius)
+- chip-temp-threshold : Chip temperature for thermal regulaton.   <100, 130>
+- soft-cold-temp-limit : Cold battery temperature for soft alarm. <0, 15>*
+- soft-hot-temp-limit : Hot battery temperature for soft alarm.   <40, 55>
+- hard-cold-temp-limit : Cold battery temperature for hard alarm. <0, 15>*
+- hard-hot-temp-limit : Hot battery temperature for hard alarm.   <55, 65>
+(* The written temperature has +5'C offset. 0'C -> -5'C, 15'C -> 10'C)
+- soft-comp-method : Soft temperature limit compensation method
+   (Not defined) : Use default setting
+   <0> : Compensation none
+   <1> : Charge current compensation
+   <2> : Voltage compensation
+
+Example:
+   smb345@6a {
+   compatible = "summit,smb345";
+   reg = <0x6a>;
+   status = "okay";
+   interrupt-parent = <_pinmux>;
+   interrupts = <23 IRQ_TYPE_EDGE_BOTH>;
+
+   max-chg-curr = <180>;
+   usb-curr-limit = <45>;
+
+   chip-temp-thershold = <110>; /* celsius */
+
+   enable-usb-charging;
+   enable-otg-charging;
+   };
+
+   smb347@7f {
+   compatible = "summit,smb347";
+   reg = <0x7f>;
+   status = "okay";
+
+   max-chg-curr = <180>;
+   mains-curr-limit = <200>;
+   usb-curr-limit = <45>;
+
+   chip-temp-thershold = <110>; /* celsius */
+
+   en-gpios = <_pinmux 54 GPIO_ACTIVE_HIGH>;
+
+   enable-usb-charging;
+   enable-mains-charging;
+   };
diff --git a/drivers/power/supply/smb347-charger.c 
b/drivers/power/supply/smb347-charger.c
index 072c518..28666ab 100644
--- a/drivers/power/supply/smb347-charger.c
+++ b/drivers/power/supply/smb347-charger.c
@@ -124,6 +124,7 @@
 
 /**
  * struct smb347_charger - smb347 charger instance
+ * @id: smb charger id
  * @lock: protects concurrent access to online variables
  * @dev: pointer to device
  * @regmap: pointer to driver regmap
@@ -136,7 +137,8 @@
  * @pdata: pointer to platform data
  */
 struct smb347_charger {
-   struct mutexlock;
+   int id;
+   struct mutexlock; /* protects concurrent access */
struct device   *dev;
struct regmap   *regmap;
struct power_sup

[PATCH] power: smb347-charger: Summit SMB358 charger IC

2017-08-01 Thread Vinay Simha BN
Summit microelectronics' SMB358 charger chip has
almost the same register map and functionality.
voltage and current table are only differed.

SMB345 charger IC tested in nexus7

Cc: John Stultz 
Cc: Sumit Semwal 
Cc: Jonghwa Lee 
Cc: Chanwoo Choi 
Cc: Myungjoo Ham 
Signed-off-by: Vinay Simha BN 

---
v2:
* incorporated code review from Rob Herring
  gpio line added for Enable charging control,
  documentation bindings (vendor prefixes and unit suffixes)
---
 .../bindings/power/supply/smb347_charger.txt   |  73 +
 drivers/power/supply/smb347-charger.c  | 334 +
 include/linux/power/smb347-charger.h   |   4 +-
 3 files changed, 283 insertions(+), 128 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/power/supply/smb347_charger.txt

diff --git a/Documentation/devicetree/bindings/power/supply/smb347_charger.txt 
b/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
new file mode 100644
index 000..45da4ee
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
@@ -0,0 +1,73 @@
+smb347_charger bindings
+
+
+[Required porperties]
+- compatible : "summit,smb345"
+  "summit,smb347"
+- reg : Slave address for i2c interface
+# At least one of following should be set
+  - enable-usb-charging
+  - enable-otg-charging
+  - enable-mains-charging
+
+[Optional properties]
+- interrupt-parent : The phandle for the interrupt controller
+- interrupts : Interrupt line index for mapping
+- en-gpio : Enable charging control
+ : If this is not specified it will use SW (i2c interface)
+
+# Charging constraints
+- max-chg-curr : microamps for charging Maximum current
+- max-chg-volt : microvolts for charging Maximum voltage
+- pre-chg-curr : microamps for Pre-charging current
+- term-curr : microamps for Charging cycle termination current
+- fast-volt-thershold : microvolts for Voltage threshold to transit to fast 
charge mode
+- mains-curr-limit : micromaps for Maximum input current from AC/DC input
+- usb-curr-limit : microamps for Maximum input current from USB input
+
+# Related thermometer monitoring (Degrees Celsius)
+- chip-temp-threshold : Chip temperature for thermal regulaton.   <100, 130>
+- soft-cold-temp-limit : Cold battery temperature for soft alarm. <0, 15>*
+- soft-hot-temp-limit : Hot battery temperature for soft alarm.   <40, 55>
+- hard-cold-temp-limit : Cold battery temperature for hard alarm. <0, 15>*
+- hard-hot-temp-limit : Hot battery temperature for hard alarm.   <55, 65>
+(* The written temperature has +5'C offset. 0'C -> -5'C, 15'C -> 10'C)
+- soft-comp-method : Soft temperature limit compensation method
+   (Not defined) : Use default setting
+   <0> : Compensation none
+   <1> : Charge current compensation
+   <2> : Voltage compensation
+
+Example:
+   smb345@6a {
+   compatible = "summit,smb345";
+   reg = <0x6a>;
+   status = "okay";
+   interrupt-parent = <_pinmux>;
+   interrupts = <23 IRQ_TYPE_EDGE_BOTH>;
+
+   max-chg-curr = <180>;
+   usb-curr-limit = <45>;
+
+   chip-temp-thershold = <110>; /* celsius */
+
+   enable-usb-charging;
+   enable-otg-charging;
+   };
+
+   smb347@7f {
+   compatible = "summit,smb347";
+   reg = <0x7f>;
+   status = "okay";
+
+   max-chg-curr = <180>;
+   mains-curr-limit = <200>;
+   usb-curr-limit = <45>;
+
+   chip-temp-thershold = <110>; /* celsius */
+
+   en-gpios = <_pinmux 54 GPIO_ACTIVE_HIGH>;
+
+   enable-usb-charging;
+   enable-mains-charging;
+   };
diff --git a/drivers/power/supply/smb347-charger.c 
b/drivers/power/supply/smb347-charger.c
index 072c518..28666ab 100644
--- a/drivers/power/supply/smb347-charger.c
+++ b/drivers/power/supply/smb347-charger.c
@@ -124,6 +124,7 @@
 
 /**
  * struct smb347_charger - smb347 charger instance
+ * @id: smb charger id
  * @lock: protects concurrent access to online variables
  * @dev: pointer to device
  * @regmap: pointer to driver regmap
@@ -136,7 +137,8 @@
  * @pdata: pointer to platform data
  */
 struct smb347_charger {
-   struct mutexlock;
+   int id;
+   struct mutexlock; /* protects concurrent access */
struct device   *dev;
struct regmap   *regmap;
struct power_supply *mains;
@@ -145,61 +147,49 @@ struct smb347_charger {
boolmains_online;
boolusb_online;
boolcharg

Re: [PATCH] drm/msm/hdmi: redefinitions of macros not required

2017-03-21 Thread Vinay Simha B N
hi,

Could you please give some feedback or review comments for this patch

On 3/14/17, Vinay Simha BN <simha...@gmail.com> wrote:
> 4 macros already defined in hdmi.h,
> which is not required to redefine in hdmi_audio.c
>
> Signed-off-by: Vinay Simha BN <simha...@gmail.com>
> ---
>  drivers/gpu/drm/msm/hdmi/hdmi_audio.c | 7 ---
>  1 file changed, 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
> b/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
> index a54d3bb..8177e85 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
> @@ -18,13 +18,6 @@
>  #include 
>  #include "hdmi.h"
>
> -
> -/* Supported HDMI Audio channels */
> -#define MSM_HDMI_AUDIO_CHANNEL_2 0
> -#define MSM_HDMI_AUDIO_CHANNEL_4 1
> -#define MSM_HDMI_AUDIO_CHANNEL_6 2
> -#define MSM_HDMI_AUDIO_CHANNEL_8 3
> -
>  /* maps MSM_HDMI_AUDIO_CHANNEL_n consts used by audio driver to # of
> channels: */
>  static int nchannels[] = { 2, 4, 6, 8 };
>
> --
> 2.7.4
>
>


-- 
regards,
vinaysimha


Re: [PATCH] drm/msm/hdmi: redefinitions of macros not required

2017-03-21 Thread Vinay Simha B N
hi,

Could you please give some feedback or review comments for this patch

On 3/14/17, Vinay Simha BN  wrote:
> 4 macros already defined in hdmi.h,
> which is not required to redefine in hdmi_audio.c
>
> Signed-off-by: Vinay Simha BN 
> ---
>  drivers/gpu/drm/msm/hdmi/hdmi_audio.c | 7 ---
>  1 file changed, 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
> b/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
> index a54d3bb..8177e85 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
> @@ -18,13 +18,6 @@
>  #include 
>  #include "hdmi.h"
>
> -
> -/* Supported HDMI Audio channels */
> -#define MSM_HDMI_AUDIO_CHANNEL_2 0
> -#define MSM_HDMI_AUDIO_CHANNEL_4 1
> -#define MSM_HDMI_AUDIO_CHANNEL_6 2
> -#define MSM_HDMI_AUDIO_CHANNEL_8 3
> -
>  /* maps MSM_HDMI_AUDIO_CHANNEL_n consts used by audio driver to # of
> channels: */
>  static int nchannels[] = { 2, 4, 6, 8 };
>
> --
> 2.7.4
>
>


-- 
regards,
vinaysimha


[PATCH] drm/msm/hdmi: redefinitions of macros not required

2017-03-13 Thread Vinay Simha BN
4 macros already defined in hdmi.h,
which is not required to redefine in hdmi_audio.c

Signed-off-by: Vinay Simha BN <simha...@gmail.com>
---
 drivers/gpu/drm/msm/hdmi/hdmi_audio.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_audio.c 
b/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
index a54d3bb..8177e85 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
@@ -18,13 +18,6 @@
 #include 
 #include "hdmi.h"
 
-
-/* Supported HDMI Audio channels */
-#define MSM_HDMI_AUDIO_CHANNEL_2   0
-#define MSM_HDMI_AUDIO_CHANNEL_4   1
-#define MSM_HDMI_AUDIO_CHANNEL_6   2
-#define MSM_HDMI_AUDIO_CHANNEL_8   3
-
 /* maps MSM_HDMI_AUDIO_CHANNEL_n consts used by audio driver to # of channels: 
*/
 static int nchannels[] = { 2, 4, 6, 8 };
 
-- 
2.7.4



[PATCH] drm/msm/hdmi: redefinitions of macros not required

2017-03-13 Thread Vinay Simha BN
4 macros already defined in hdmi.h,
which is not required to redefine in hdmi_audio.c

Signed-off-by: Vinay Simha BN 
---
 drivers/gpu/drm/msm/hdmi/hdmi_audio.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_audio.c 
b/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
index a54d3bb..8177e85 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi_audio.c
@@ -18,13 +18,6 @@
 #include 
 #include "hdmi.h"
 
-
-/* Supported HDMI Audio channels */
-#define MSM_HDMI_AUDIO_CHANNEL_2   0
-#define MSM_HDMI_AUDIO_CHANNEL_4   1
-#define MSM_HDMI_AUDIO_CHANNEL_6   2
-#define MSM_HDMI_AUDIO_CHANNEL_8   3
-
 /* maps MSM_HDMI_AUDIO_CHANNEL_n consts used by audio driver to # of channels: 
*/
 static int nchannels[] = { 2, 4, 6, 8 };
 
-- 
2.7.4



[PATCH v4] dt-bindings: Add jdi lt070me05000 panel bindings

2016-09-07 Thread Vinay Simha BN
Add documentation for lt070me05000 panel

Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: John Stultz <john.stu...@linaro.org>
Cc: Thierry Reding <thierry.red...@gmail.com>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
Acked-by: Rob Herring <r...@kernel.org>

---
v2:
 * incorporated rob herring and thierry reviews
   gpio to gpios, gpio to regulator using fixed regulators
   and pwm backlight is removed, since it is controlled by
   dcs commands

v3:
 * incorporated thierry reviews
   - Added gpio polarity details for reset-gpios
   - proper naming conventions and sequence wrt panel datasheet
 (vddp-supply, iovcc-supply,
  enable-gpios, reset-gpios, dcdc-en-gpios)
v4:
 * pinctrl-names, pinctrl-0 removed, not required for
   reset-gpios
---
 .../bindings/display/panel/jdi,lt070me05000.txt| 31 ++
 1 file changed, 31 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
new file mode 100644
index 000..4989c91d
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
@@ -0,0 +1,31 @@
+JDI model LT070ME05000 1200x1920 7" DSI Panel
+
+Required properties:
+- compatible: should be "jdi,lt070me05000"
+- vddp-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply (3-5V)
+- iovcc-supply: phandle of the regulator that provides the supply voltage
+  IOVCC , power supply for LCM (1.8V)
+- enable-gpios: phandle of gpio for enable line
+  LED_EN, LED backlight enable, High active
+- reset-gpios: phandle of gpio for reset line
+  This should be 8mA, gpio can be configured using mux, pinctrl, pinctrl-names
+  XRES, Reset, Low active
+- dcdc-en-gpios: phandle of the gpio for power ic line
+  Power IC supply enable, High active
+
+Example:
+
+   dsi0: qcom,mdss_dsi@470 {
+   panel@0 {
+   compatible = "jdi,lt070me05000";
+   reg = <0>;
+
+   vddp-supply = <_l17>;
+   iovcc-supply = <_lvs7>;
+
+   enable-gpios = <_gpio 36 GPIO_ACTIVE_HIGH>;
+   reset-gpios = <_pinmux 54 GPIO_ACTIVE_LOW>;
+   dcdc-en-gpios = <_gpio 23 GPIO_ACTIVE_HIGH>;
+   };
+   };
-- 
2.1.2



[PATCH v4] dt-bindings: Add jdi lt070me05000 panel bindings

2016-09-07 Thread Vinay Simha BN
Add documentation for lt070me05000 panel

Cc: Archit Taneja 
Cc: John Stultz 
Cc: Thierry Reding 
Cc: Sumit Semwal 
Signed-off-by: Vinay Simha BN 
Acked-by: Rob Herring 

---
v2:
 * incorporated rob herring and thierry reviews
   gpio to gpios, gpio to regulator using fixed regulators
   and pwm backlight is removed, since it is controlled by
   dcs commands

v3:
 * incorporated thierry reviews
   - Added gpio polarity details for reset-gpios
   - proper naming conventions and sequence wrt panel datasheet
 (vddp-supply, iovcc-supply,
  enable-gpios, reset-gpios, dcdc-en-gpios)
v4:
 * pinctrl-names, pinctrl-0 removed, not required for
   reset-gpios
---
 .../bindings/display/panel/jdi,lt070me05000.txt| 31 ++
 1 file changed, 31 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
new file mode 100644
index 000..4989c91d
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
@@ -0,0 +1,31 @@
+JDI model LT070ME05000 1200x1920 7" DSI Panel
+
+Required properties:
+- compatible: should be "jdi,lt070me05000"
+- vddp-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply (3-5V)
+- iovcc-supply: phandle of the regulator that provides the supply voltage
+  IOVCC , power supply for LCM (1.8V)
+- enable-gpios: phandle of gpio for enable line
+  LED_EN, LED backlight enable, High active
+- reset-gpios: phandle of gpio for reset line
+  This should be 8mA, gpio can be configured using mux, pinctrl, pinctrl-names
+  XRES, Reset, Low active
+- dcdc-en-gpios: phandle of the gpio for power ic line
+  Power IC supply enable, High active
+
+Example:
+
+   dsi0: qcom,mdss_dsi@470 {
+   panel@0 {
+   compatible = "jdi,lt070me05000";
+   reg = <0>;
+
+   vddp-supply = <_l17>;
+   iovcc-supply = <_lvs7>;
+
+   enable-gpios = <_gpio 36 GPIO_ACTIVE_HIGH>;
+   reset-gpios = <_pinmux 54 GPIO_ACTIVE_LOW>;
+   dcdc-en-gpios = <_gpio 23 GPIO_ACTIVE_HIGH>;
+   };
+   };
-- 
2.1.2



[PATCH 4/4] power: smb347-charger: Summit SMB345 charger IC

2016-09-07 Thread Vinay Simha BN
Summit microelectronics SMB345 charger chip added.

Cc: Jonghwa Lee <jonghwa3@samsung.com>
Cc: Chanwoo Choi <cw00.c...@samsung.com>
Cc: Myungjoo Ham <myungjoo@samsung.com>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Cc: John Stultz <john.stu...@linaro.org>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
---
 .../bindings/power/supply/smb347_charger.txt   |  21 +++-
 drivers/power/supply/smb347-charger.c  | 123 ++---
 2 files changed, 81 insertions(+), 63 deletions(-)

diff --git a/Documentation/devicetree/bindings/power/supply/smb347_charger.txt 
b/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
index 91570a5..939a86d 100644
--- a/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
+++ b/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
@@ -2,7 +2,8 @@ smb347_charger bindings
 
 
 [Required porperties]
-- compatible : "summit,smb347"
+- compatible : "summit,smb345"
+  "summit,smb347"
 - reg : Slave address for i2c interface
 # At least one of followings should be set
   - enable-usb-charging
@@ -39,6 +40,24 @@ smb347_charger bindings
<2> : Voltage compensation
 
 Example:
+   smb345@6a {
+   compatible = "summit,smb345";
+   reg = <0x6a>;
+   status = "okay";
+   interrupt-parent = <_pinmux>;
+   interrupts = <23 IRQ_TYPE_EDGE_BOTH>;
+
+   max-chg-curr = <180>;
+   usb-curr-limit = <45>;
+
+   chip-temp-thershold = <110>;
+
+   enable-usb-charging;
+   enable-otg-charging;
+
+   enable-chg-ctrl = <0>;  /* SW (i2c interface) */
+   };
+
smb347@7f {
compatible = "summit,smb347";
reg = <0x7f>;
diff --git a/drivers/power/supply/smb347-charger.c 
b/drivers/power/supply/smb347-charger.c
index 472f5e2..c1a9b73 100644
--- a/drivers/power/supply/smb347-charger.c
+++ b/drivers/power/supply/smb347-charger.c
@@ -124,6 +124,7 @@
 
 /**
  * struct smb347_charger - smb347 charger instance
+ * @id: smb charger id
  * @lock: protects concurrent access to online variables
  * @dev: pointer to device
  * @regmap: pointer to driver regmap
@@ -136,6 +137,7 @@
  * @pdata: pointer to platform data
  */
 struct smb347_charger {
+   int id;
struct mutexlock; /* protects concurrent access */
struct device   *dev;
struct regmap   *regmap;
@@ -148,58 +150,46 @@ struct smb347_charger {
const struct smb347_charger_platform_data *pdata;
 };
 
+enum smb_charger_chipid {
+   SMB345,
+   SMB347,
+   NUM_CHIP_TYPES,
+};
+
 /* Fast charge current in uA */
-static const unsigned int fcc_tbl[] = {
-   70,
-   90,
-   120,
-   150,
-   180,
-   200,
-   220,
-   250,
+static const unsigned int fcc_tbl[NUM_CHIP_TYPES][8] = {
+   [SMB345] = { 20, 45, 60, 90,
+   130, 150, 180, 200 },
+   [SMB347] = { 70, 90, 120, 150,
+   180, 200, 220, 250 },
 };
 
 /* Pre-charge current in uA */
-static const unsigned int pcc_tbl[] = {
-   10,
-   15,
-   20,
-   25,
+static const unsigned int pcc_tbl[NUM_CHIP_TYPES][4] = {
+   [SMB345] = { 15, 25, 35, 45 },
+   [SMB347] = { 10, 15, 20, 25 },
 };
 
 /* Termination current in uA */
-static const unsigned int tc_tbl[] = {
-   37500,
-   5,
-   10,
-   15,
-   20,
-   25,
-   50,
-   60,
+static const unsigned int tc_tbl[NUM_CHIP_TYPES][8] = {
+   [SMB345] = { 3, 4, 6, 8,
+   10, 125000, 15, 20 },
+   [SMB347] = { 37500, 5, 10, 15,
+   20, 25, 50, 60 },
 };
 
 /* Input current limit in uA */
-static const unsigned int icl_tbl[] = {
-   30,
-   50,
-   70,
-   90,
-   120,
-   150,
-   180,
-   200,
-   220,
-   250,
+static const unsigned int icl_tbl[NUM_CHIP_TYPES][10] = {
+   [SMB345] = { 30, 50, 70, 100, 150,
+   180, 200, 200, 200, 200 },
+   [SMB347] = { 30, 50, 70, 90, 120,
+   150, 180, 200, 220, 250 },
 };
 
 /* Charge current compensation in uA */
-static const unsigned int ccc_tbl[] = {
-   25,
-   70,
-   90,
-   120,
+static const unsigned int ccc_tbl[NUM_CHIP_TYPES][4] = {
+   [SMB345] = { 20

[PATCH 4/4] power: smb347-charger: Summit SMB345 charger IC

2016-09-07 Thread Vinay Simha BN
Summit microelectronics SMB345 charger chip added.

Cc: Jonghwa Lee 
Cc: Chanwoo Choi 
Cc: Myungjoo Ham 
Cc: Sumit Semwal 
Cc: John Stultz 
Signed-off-by: Vinay Simha BN 
---
 .../bindings/power/supply/smb347_charger.txt   |  21 +++-
 drivers/power/supply/smb347-charger.c  | 123 ++---
 2 files changed, 81 insertions(+), 63 deletions(-)

diff --git a/Documentation/devicetree/bindings/power/supply/smb347_charger.txt 
b/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
index 91570a5..939a86d 100644
--- a/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
+++ b/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
@@ -2,7 +2,8 @@ smb347_charger bindings
 
 
 [Required porperties]
-- compatible : "summit,smb347"
+- compatible : "summit,smb345"
+  "summit,smb347"
 - reg : Slave address for i2c interface
 # At least one of followings should be set
   - enable-usb-charging
@@ -39,6 +40,24 @@ smb347_charger bindings
<2> : Voltage compensation
 
 Example:
+   smb345@6a {
+   compatible = "summit,smb345";
+   reg = <0x6a>;
+   status = "okay";
+   interrupt-parent = <_pinmux>;
+   interrupts = <23 IRQ_TYPE_EDGE_BOTH>;
+
+   max-chg-curr = <180>;
+   usb-curr-limit = <45>;
+
+   chip-temp-thershold = <110>;
+
+   enable-usb-charging;
+   enable-otg-charging;
+
+   enable-chg-ctrl = <0>;  /* SW (i2c interface) */
+   };
+
smb347@7f {
compatible = "summit,smb347";
reg = <0x7f>;
diff --git a/drivers/power/supply/smb347-charger.c 
b/drivers/power/supply/smb347-charger.c
index 472f5e2..c1a9b73 100644
--- a/drivers/power/supply/smb347-charger.c
+++ b/drivers/power/supply/smb347-charger.c
@@ -124,6 +124,7 @@
 
 /**
  * struct smb347_charger - smb347 charger instance
+ * @id: smb charger id
  * @lock: protects concurrent access to online variables
  * @dev: pointer to device
  * @regmap: pointer to driver regmap
@@ -136,6 +137,7 @@
  * @pdata: pointer to platform data
  */
 struct smb347_charger {
+   int id;
struct mutexlock; /* protects concurrent access */
struct device   *dev;
struct regmap   *regmap;
@@ -148,58 +150,46 @@ struct smb347_charger {
const struct smb347_charger_platform_data *pdata;
 };
 
+enum smb_charger_chipid {
+   SMB345,
+   SMB347,
+   NUM_CHIP_TYPES,
+};
+
 /* Fast charge current in uA */
-static const unsigned int fcc_tbl[] = {
-   70,
-   90,
-   120,
-   150,
-   180,
-   200,
-   220,
-   250,
+static const unsigned int fcc_tbl[NUM_CHIP_TYPES][8] = {
+   [SMB345] = { 20, 45, 60, 90,
+   130, 150, 180, 200 },
+   [SMB347] = { 70, 90, 120, 150,
+   180, 200, 220, 250 },
 };
 
 /* Pre-charge current in uA */
-static const unsigned int pcc_tbl[] = {
-   10,
-   15,
-   20,
-   25,
+static const unsigned int pcc_tbl[NUM_CHIP_TYPES][4] = {
+   [SMB345] = { 15, 25, 35, 45 },
+   [SMB347] = { 10, 15, 20, 25 },
 };
 
 /* Termination current in uA */
-static const unsigned int tc_tbl[] = {
-   37500,
-   5,
-   10,
-   15,
-   20,
-   25,
-   50,
-   60,
+static const unsigned int tc_tbl[NUM_CHIP_TYPES][8] = {
+   [SMB345] = { 3, 4, 6, 8,
+   10, 125000, 15, 20 },
+   [SMB347] = { 37500, 5, 10, 15,
+   20, 25, 50, 60 },
 };
 
 /* Input current limit in uA */
-static const unsigned int icl_tbl[] = {
-   30,
-   50,
-   70,
-   90,
-   120,
-   150,
-   180,
-   200,
-   220,
-   250,
+static const unsigned int icl_tbl[NUM_CHIP_TYPES][10] = {
+   [SMB345] = { 30, 50, 70, 100, 150,
+   180, 200, 200, 200, 200 },
+   [SMB347] = { 30, 50, 70, 90, 120,
+   150, 180, 200, 220, 250 },
 };
 
 /* Charge current compensation in uA */
-static const unsigned int ccc_tbl[] = {
-   25,
-   70,
-   90,
-   120,
+static const unsigned int ccc_tbl[NUM_CHIP_TYPES][4] = {
+   [SMB345] = { 20, 45, 60, 90 },
+   [SMB347] = { 25, 70, 90, 120 },
 };
 
 /* Convert register value to current using lookup table */
@@ -354,10 +344,10 @@

[PATCH 3/4] power: smb347-charger: Support devicetree binding

2016-09-07 Thread Vinay Simha BN
smb347 charger driver to support dt binding.
All legacy platform data now can be parsed from dt.
smb347 is i2c client driver, IRQ number can be passed
automatically through client's irq variable.

Cc: John Stultz <john.stu...@linaro.org>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: Jonghwa Lee <jonghwa3@samsung.com>
Cc: Chanwoo Choi <cw00.c...@samsung.com>
Cc: Myungjoo Ham <myungjoo@samsung.com>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
---
 drivers/power/supply/smb347-charger.c | 198 +++---
 1 file changed, 134 insertions(+), 64 deletions(-)

diff --git a/drivers/power/supply/smb347-charger.c 
b/drivers/power/supply/smb347-charger.c
index 072c518..472f5e2 100644
--- a/drivers/power/supply/smb347-charger.c
+++ b/drivers/power/supply/smb347-charger.c
@@ -136,7 +136,7 @@
  * @pdata: pointer to platform data
  */
 struct smb347_charger {
-   struct mutexlock;
+   struct mutexlock; /* protects concurrent access */
struct device   *dev;
struct regmap   *regmap;
struct power_supply *mains;
@@ -440,9 +440,10 @@ static int smb347_set_voltage_limits(struct smb347_charger 
*smb)
ret = clamp_val(ret, 240, 300) - 240;
ret /= 20;
 
-   ret = regmap_update_bits(smb->regmap, CFG_FLOAT_VOLTAGE,
-   CFG_FLOAT_VOLTAGE_THRESHOLD_MASK,
-   ret << CFG_FLOAT_VOLTAGE_THRESHOLD_SHIFT);
+   ret = regmap_update_bits
+   (smb->regmap, CFG_FLOAT_VOLTAGE,
+CFG_FLOAT_VOLTAGE_THRESHOLD_MASK,
+ret << CFG_FLOAT_VOLTAGE_THRESHOLD_SHIFT);
if (ret < 0)
return ret;
}
@@ -565,8 +566,9 @@ static int smb347_set_temp_limits(struct smb347_charger 
*smb)
}
 
if (smb->pdata->suspend_on_hard_temp_limit) {
-   ret = regmap_update_bits(smb->regmap, CFG_SYSOK,
-CFG_SYSOK_SUSPEND_HARD_LIMIT_DISABLED, 0);
+   ret = regmap_update_bits
+   (smb->regmap, CFG_SYSOK,
+CFG_SYSOK_SUSPEND_HARD_LIMIT_DISABLED, 0);
if (ret < 0)
return ret;
}
@@ -575,15 +577,17 @@ static int smb347_set_temp_limits(struct smb347_charger 
*smb)
SMB347_SOFT_TEMP_COMPENSATE_DEFAULT) {
val = smb->pdata->soft_temp_limit_compensation & 0x3;
 
-   ret = regmap_update_bits(smb->regmap, CFG_THERM,
-CFG_THERM_SOFT_HOT_COMPENSATION_MASK,
-val << CFG_THERM_SOFT_HOT_COMPENSATION_SHIFT);
+   ret = regmap_update_bits
+   (smb->regmap, CFG_THERM,
+CFG_THERM_SOFT_HOT_COMPENSATION_MASK,
+val << CFG_THERM_SOFT_HOT_COMPENSATION_SHIFT);
if (ret < 0)
return ret;
 
-   ret = regmap_update_bits(smb->regmap, CFG_THERM,
-CFG_THERM_SOFT_COLD_COMPENSATION_MASK,
-val << CFG_THERM_SOFT_COLD_COMPENSATION_SHIFT);
+   ret = regmap_update_bits
+   (smb->regmap, CFG_THERM,
+CFG_THERM_SOFT_COLD_COMPENSATION_MASK,
+val << CFG_THERM_SOFT_COLD_COMPENSATION_SHIFT);
if (ret < 0)
return ret;
}
@@ -594,9 +598,10 @@ static int smb347_set_temp_limits(struct smb347_charger 
*smb)
if (val < 0)
return val;
 
-   ret = regmap_update_bits(smb->regmap, CFG_OTG,
-   CFG_OTG_CC_COMPENSATION_MASK,
-   (val & 0x3) << CFG_OTG_CC_COMPENSATION_SHIFT);
+   ret = regmap_update_bits
+   (smb->regmap, CFG_OTG,
+CFG_OTG_CC_COMPENSATION_MASK,
+(val & 0x3) << CFG_OTG_CC_COMPENSATION_SHIFT);
if (ret < 0)
return ret;
}
@@ -662,7 +667,8 @@ static int smb347_hw_init(struct smb347_charger *smb)
 * support for driving VBUS. Otherwise we disable it.
 */
ret = regmap_update_bits(smb->regmap, CFG_OTHER, CFG_OTHER_RID_MASK,
-   smb->pdata->use_usb_otg ? CFG_OTHER_RID_ENABLED_AUTO_OTG : 0);
+smb->pdata->use_usb_otg ?
+CFG_OTHER_RID_ENABLED_AUTO_OTG : 0);
if (ret < 0)
goto fail;
 
@@ -809,7 +815,7 @@ static int smb347_irq_set(struct smb347_charger *smb, bool 

[PATCH 3/4] power: smb347-charger: Support devicetree binding

2016-09-07 Thread Vinay Simha BN
smb347 charger driver to support dt binding.
All legacy platform data now can be parsed from dt.
smb347 is i2c client driver, IRQ number can be passed
automatically through client's irq variable.

Cc: John Stultz 
Cc: Sumit Semwal 
Signed-off-by: Jonghwa Lee 
Cc: Chanwoo Choi 
Cc: Myungjoo Ham 
Signed-off-by: Vinay Simha BN 
---
 drivers/power/supply/smb347-charger.c | 198 +++---
 1 file changed, 134 insertions(+), 64 deletions(-)

diff --git a/drivers/power/supply/smb347-charger.c 
b/drivers/power/supply/smb347-charger.c
index 072c518..472f5e2 100644
--- a/drivers/power/supply/smb347-charger.c
+++ b/drivers/power/supply/smb347-charger.c
@@ -136,7 +136,7 @@
  * @pdata: pointer to platform data
  */
 struct smb347_charger {
-   struct mutexlock;
+   struct mutexlock; /* protects concurrent access */
struct device   *dev;
struct regmap   *regmap;
struct power_supply *mains;
@@ -440,9 +440,10 @@ static int smb347_set_voltage_limits(struct smb347_charger 
*smb)
ret = clamp_val(ret, 240, 300) - 240;
ret /= 20;
 
-   ret = regmap_update_bits(smb->regmap, CFG_FLOAT_VOLTAGE,
-   CFG_FLOAT_VOLTAGE_THRESHOLD_MASK,
-   ret << CFG_FLOAT_VOLTAGE_THRESHOLD_SHIFT);
+   ret = regmap_update_bits
+   (smb->regmap, CFG_FLOAT_VOLTAGE,
+CFG_FLOAT_VOLTAGE_THRESHOLD_MASK,
+ret << CFG_FLOAT_VOLTAGE_THRESHOLD_SHIFT);
if (ret < 0)
return ret;
}
@@ -565,8 +566,9 @@ static int smb347_set_temp_limits(struct smb347_charger 
*smb)
}
 
if (smb->pdata->suspend_on_hard_temp_limit) {
-   ret = regmap_update_bits(smb->regmap, CFG_SYSOK,
-CFG_SYSOK_SUSPEND_HARD_LIMIT_DISABLED, 0);
+   ret = regmap_update_bits
+   (smb->regmap, CFG_SYSOK,
+CFG_SYSOK_SUSPEND_HARD_LIMIT_DISABLED, 0);
if (ret < 0)
return ret;
}
@@ -575,15 +577,17 @@ static int smb347_set_temp_limits(struct smb347_charger 
*smb)
SMB347_SOFT_TEMP_COMPENSATE_DEFAULT) {
val = smb->pdata->soft_temp_limit_compensation & 0x3;
 
-   ret = regmap_update_bits(smb->regmap, CFG_THERM,
-CFG_THERM_SOFT_HOT_COMPENSATION_MASK,
-val << CFG_THERM_SOFT_HOT_COMPENSATION_SHIFT);
+   ret = regmap_update_bits
+   (smb->regmap, CFG_THERM,
+CFG_THERM_SOFT_HOT_COMPENSATION_MASK,
+val << CFG_THERM_SOFT_HOT_COMPENSATION_SHIFT);
if (ret < 0)
return ret;
 
-   ret = regmap_update_bits(smb->regmap, CFG_THERM,
-CFG_THERM_SOFT_COLD_COMPENSATION_MASK,
-val << CFG_THERM_SOFT_COLD_COMPENSATION_SHIFT);
+   ret = regmap_update_bits
+   (smb->regmap, CFG_THERM,
+CFG_THERM_SOFT_COLD_COMPENSATION_MASK,
+val << CFG_THERM_SOFT_COLD_COMPENSATION_SHIFT);
if (ret < 0)
return ret;
}
@@ -594,9 +598,10 @@ static int smb347_set_temp_limits(struct smb347_charger 
*smb)
if (val < 0)
return val;
 
-   ret = regmap_update_bits(smb->regmap, CFG_OTG,
-   CFG_OTG_CC_COMPENSATION_MASK,
-   (val & 0x3) << CFG_OTG_CC_COMPENSATION_SHIFT);
+   ret = regmap_update_bits
+   (smb->regmap, CFG_OTG,
+CFG_OTG_CC_COMPENSATION_MASK,
+(val & 0x3) << CFG_OTG_CC_COMPENSATION_SHIFT);
if (ret < 0)
return ret;
}
@@ -662,7 +667,8 @@ static int smb347_hw_init(struct smb347_charger *smb)
 * support for driving VBUS. Otherwise we disable it.
 */
ret = regmap_update_bits(smb->regmap, CFG_OTHER, CFG_OTHER_RID_MASK,
-   smb->pdata->use_usb_otg ? CFG_OTHER_RID_ENABLED_AUTO_OTG : 0);
+smb->pdata->use_usb_otg ?
+CFG_OTHER_RID_ENABLED_AUTO_OTG : 0);
if (ret < 0)
goto fail;
 
@@ -809,7 +815,7 @@ static int smb347_irq_set(struct smb347_charger *smb, bool 
enable)
goto fail;
 
ret = regmap_update_bits(smb->regmap, CFG_STATUS_IRQ, 0xff,
-   enable ? (CFG_STATUS_IRQ_TERMINATION_OR_TAPER |
+ 

[PATCH 2/4] dt-bindings: Add summit SMB347 charger bindings

2016-09-07 Thread Vinay Simha BN
Add documentation for summit SMB347 charger

Cc: John Stultz <john.stu...@linaro.org>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: Jonghwa Lee <jonghwa3@samsung.com>
Cc: Chanwoo Choi <cw00.c...@samsung.com>
Cc: Myungjoo Ham <myungjoo@samsung.com>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
---
 .../bindings/power/supply/smb347_charger.txt   | 57 ++
 1 file changed, 57 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/power/supply/smb347_charger.txt

diff --git a/Documentation/devicetree/bindings/power/supply/smb347_charger.txt 
b/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
new file mode 100644
index 000..91570a5
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
@@ -0,0 +1,57 @@
+smb347_charger bindings
+
+
+[Required porperties]
+- compatible : "summit,smb347"
+- reg : Slave address for i2c interface
+# At least one of followings should be set
+  - enable-usb-charging
+  - enable-otg-charging
+  - enable-mains-charging
+
+[Optional properties]
+- interrupt-parent : The phandle for the interrupt controller
+- interrupts : Interrupt line index for mapping
+- enable-chg-ctrl : Enable charging control
+   <0> : SW (i2c interface)
+   <1> : Pin control (Active Low)
+   <2> : Pin control (Active High)
+# Charging constraints
+- max-chg-curr : Maximum current for charging (in uA)
+- max-chg-volt : Maximum voltage for charging (in uV)
+- pre-chg-curr : Pre-charging current (in uA)
+- term-curr : Charging cycle termination current (in uA)
+- fast-volt-thershold : Voltage threshold to transit to fast charge mode (in 
uV)
+- mains-curr-limit : Maximum input current from AC/DC input (in uA)
+- usb-curr-limit : Maximum input current from USB input (in uA)
+
+# Related thermometer monitoring (in degree C)
+- chip-temp-threshold : Chip temperature for thermal regulaton.   <100, 130>
+- soft-cold-temp-limit : Cold battery temperature for soft alarm. <0, 15>*
+- soft-hot-temp-limit : Hot battery temperature for soft alarm.   <40, 55>
+- hard-cold-temp-limit : Cold battery temperature for hard alarm. <0, 15>*
+- hard-hot-temp-limit : Hot battery temperature for hard alarm.   <55, 65>
+(* The written temperature has +5'C offset. 0'C -> -5'C, 15'C -> 10'C)
+- soft-comp-method : Soft temperature limit compensation method
+   (Not defined) : Use default setting
+   <0> : Compensation none
+   <1> : Charge current compensation
+   <2> : Voltage compensation
+
+Example:
+   smb347@7f {
+   compatible = "summit,smb347";
+   reg = <0x7f>;
+   status = "okay";
+
+   max-chg-curr = <180>;
+   mains-curr-limit = <200>;
+   usb-curr-limit = <45>;
+
+   chip-temp-thershold = <110>;
+
+   enable-usb-charging;
+   enable-mains-charging;
+
+   enable-chg-ctrl = <2>;  /* Pin control (Active High) */
+   };
-- 
2.1.2



[PATCH 1/4] dt-bindings: Add summit vendor id

2016-09-07 Thread Vinay Simha BN
Add vendor id for Summit microelectronics
for SMB347 charger.

Cc: John Stultz <john.stu...@linaro.org>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: Jonghwa Lee <jonghwa3@samsung.com>
Cc: Chanwoo Choi <cw00.c...@samsung.com>
Cc: Myungjoo Ham <myungjoo@samsung.com>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 7958a60..f165eb3 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -256,6 +256,7 @@ starry  Starry Electronic Technology (ShenZhen) Co., LTD
 startekStartek
 steST-Ericsson
 stericsson ST-Ericsson
+summit Summit microelectronics
 sunchipShenzhen Sunchip Technology Co., Ltd
 SUNW   Sun Microsystems, Inc
 swir   Sierra Wireless
-- 
2.1.2



[PATCH 2/4] dt-bindings: Add summit SMB347 charger bindings

2016-09-07 Thread Vinay Simha BN
Add documentation for summit SMB347 charger

Cc: John Stultz 
Cc: Sumit Semwal 
Signed-off-by: Jonghwa Lee 
Cc: Chanwoo Choi 
Cc: Myungjoo Ham 
Signed-off-by: Vinay Simha BN 
---
 .../bindings/power/supply/smb347_charger.txt   | 57 ++
 1 file changed, 57 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/power/supply/smb347_charger.txt

diff --git a/Documentation/devicetree/bindings/power/supply/smb347_charger.txt 
b/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
new file mode 100644
index 000..91570a5
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/smb347_charger.txt
@@ -0,0 +1,57 @@
+smb347_charger bindings
+
+
+[Required porperties]
+- compatible : "summit,smb347"
+- reg : Slave address for i2c interface
+# At least one of followings should be set
+  - enable-usb-charging
+  - enable-otg-charging
+  - enable-mains-charging
+
+[Optional properties]
+- interrupt-parent : The phandle for the interrupt controller
+- interrupts : Interrupt line index for mapping
+- enable-chg-ctrl : Enable charging control
+   <0> : SW (i2c interface)
+   <1> : Pin control (Active Low)
+   <2> : Pin control (Active High)
+# Charging constraints
+- max-chg-curr : Maximum current for charging (in uA)
+- max-chg-volt : Maximum voltage for charging (in uV)
+- pre-chg-curr : Pre-charging current (in uA)
+- term-curr : Charging cycle termination current (in uA)
+- fast-volt-thershold : Voltage threshold to transit to fast charge mode (in 
uV)
+- mains-curr-limit : Maximum input current from AC/DC input (in uA)
+- usb-curr-limit : Maximum input current from USB input (in uA)
+
+# Related thermometer monitoring (in degree C)
+- chip-temp-threshold : Chip temperature for thermal regulaton.   <100, 130>
+- soft-cold-temp-limit : Cold battery temperature for soft alarm. <0, 15>*
+- soft-hot-temp-limit : Hot battery temperature for soft alarm.   <40, 55>
+- hard-cold-temp-limit : Cold battery temperature for hard alarm. <0, 15>*
+- hard-hot-temp-limit : Hot battery temperature for hard alarm.   <55, 65>
+(* The written temperature has +5'C offset. 0'C -> -5'C, 15'C -> 10'C)
+- soft-comp-method : Soft temperature limit compensation method
+   (Not defined) : Use default setting
+   <0> : Compensation none
+   <1> : Charge current compensation
+   <2> : Voltage compensation
+
+Example:
+   smb347@7f {
+   compatible = "summit,smb347";
+   reg = <0x7f>;
+   status = "okay";
+
+   max-chg-curr = <180>;
+   mains-curr-limit = <200>;
+   usb-curr-limit = <45>;
+
+   chip-temp-thershold = <110>;
+
+   enable-usb-charging;
+   enable-mains-charging;
+
+   enable-chg-ctrl = <2>;  /* Pin control (Active High) */
+   };
-- 
2.1.2



[PATCH 1/4] dt-bindings: Add summit vendor id

2016-09-07 Thread Vinay Simha BN
Add vendor id for Summit microelectronics
for SMB347 charger.

Cc: John Stultz 
Cc: Sumit Semwal 
Signed-off-by: Jonghwa Lee 
Cc: Chanwoo Choi 
Cc: Myungjoo Ham 
Signed-off-by: Vinay Simha BN 
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 7958a60..f165eb3 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -256,6 +256,7 @@ starry  Starry Electronic Technology (ShenZhen) Co., LTD
 startekStartek
 steST-Ericsson
 stericsson ST-Ericsson
+summit Summit microelectronics
 sunchipShenzhen Sunchip Technology Co., Ltd
 SUNW   Sun Microsystems, Inc
 swir   Sierra Wireless
-- 
2.1.2



Re: [PATCH v10 3/3] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-09-07 Thread Vinay Simha
thierry,

please review.

On Fri, Aug 26, 2016 at 8:07 AM, Vinay Simha BN <simha...@gmail.com> wrote:
> Add support for the JDI LT070ME05000 WUXGA DSI panel used in
> Nexus 7 2013 devices.
>
> Programming sequence for the panel is was originally found in the
> android-msm-flo-3.4-lollipop-release branch from:
> https://android.googlesource.com/kernel/msm.git
>
> And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
> file in:
> git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27
>
> Cc: Archit Taneja <archit.tan...@gmail.com>
> Cc: Rob Clark <robdcl...@gmail.com>
> Cc: Sumit Semwal <sumit.sem...@linaro.org>
> Cc: John Stultz <john.stu...@linaro.org>
> Cc: Emil Velikov <emil.l.veli...@gmail.com>
> Cc: Thierry Reding <thierry.red...@gmail.com>
> Cc: David Airlie <airl...@linux.ie>
> Signed-off-by: Sumit Semwal <sumit.sem...@linaro.org>
> Signed-off-by: John Stultz <john.stu...@linaro.org>
> Signed-off-by: Vinay Simha BN <simha...@gmail.com>
> Tested-by: John Stultz <john.stu...@linaro.org>
> Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com>
>
> ---
> v1:
>  * sumit ported to drm/panel framework, john cherry-picked to mainline,
>folded down other fixes from Vinay and Archit, vinay removed interface
>setting cmd mode, video mode panel selected
>
> v2:
>  * incorporated code reviews from theiry, archit
>code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
>arrays of u8, generic helper function, documentation bindings,
>
> v3:
>  * dcs backlight support added
>  * tested this panel driver in nexus7 2013 device
>
> v4:
>  * backlight interface added in the panel driver
>  * incorporated width_mm and height_mm suggested by rob herring
>
> v5:
>  * theirry review comments incorporated
>panel model naming consistent, alphabetical soring in Kconfig
>Makefile, MAX_BRIGHTNESS dropped, regulator_names, parameterize
>panel width and height, descprition for control display, cabc
>and interface setting, temporary variable removed, consistent
>error reporting and commit message
>  * removed tear on/off, scanline, since these are required only
>for command mode panels
>
> v6:
>  * emil review comments incorporated
>PANEL_NUM_REGULATORS dropped, return ret added at necessary
>places, if checks dropped for backlight and gpios
>
> v7:
>  * emil review comments incorporated
>added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
>gpios checks dropped.
>some returns cannot be dropped, since drm panel framework return
>type required.
>
> v8:
>  * emil review commnets incorporated for jdi_panel_unprepare,
>dropped the returns (ref: panel-sharp-lq101r1sx01.c) and
>for jdi_panel_prepare(panel_on) it does not return prematurely
>and goes to poweroff if not success
>  * few dev_err's for panel_init
>
> v9:
>  * function drm_panel_create_dsi_backlight made as static
>
> v10:
>  * proper naming conventions and sequence wrt panel datasheet
>(vddp-supply, iovcc-supply,
> enable-gpios, reset-gpios, dcdc-en-gpios)
>  * GPIO_ACTIVE_LOW polarity logic for reset-gpios
> ---
>  drivers/gpu/drm/panel/Kconfig  |  11 +
>  drivers/gpu/drm/panel/Makefile |   1 +
>  drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 532 
> +
>  3 files changed, 544 insertions(+)
>  create mode 100644 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
>
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 1500ab9..62aba97 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -18,6 +18,17 @@ config DRM_PANEL_SIMPLE
>   that it can be automatically turned off when the panel goes into a
>   low power state.
>
> +config DRM_PANEL_JDI_LT070ME05000
> +   tristate "JDI LT070ME05000 WUXGA DSI panel"
> +   depends on OF
> +   depends on DRM_MIPI_DSI
> +   depends on BACKLIGHT_CLASS_DEVICE
> +   help
> + Say Y here if you want to enable support for JDI DSI video mode
> + panel as found in Google Nexus 7 (2013) devices.
> + The panel has a 1200(RGB)×1920 (WUXGA) resolution and uses
> + 24 bit per pixel.
> +
>  config DRM_PANEL_SAMSUNG_LD9040
> tristate "Samsung LD9040 RGB/SPI panel"
> depends on OF && SPI
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index f277eed..a5c7ec0 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> 

Re: [PATCH v10 3/3] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-09-07 Thread Vinay Simha
thierry,

please review.

On Fri, Aug 26, 2016 at 8:07 AM, Vinay Simha BN  wrote:
> Add support for the JDI LT070ME05000 WUXGA DSI panel used in
> Nexus 7 2013 devices.
>
> Programming sequence for the panel is was originally found in the
> android-msm-flo-3.4-lollipop-release branch from:
> https://android.googlesource.com/kernel/msm.git
>
> And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
> file in:
> git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27
>
> Cc: Archit Taneja 
> Cc: Rob Clark 
> Cc: Sumit Semwal 
> Cc: John Stultz 
> Cc: Emil Velikov 
> Cc: Thierry Reding 
> Cc: David Airlie 
> Signed-off-by: Sumit Semwal 
> Signed-off-by: John Stultz 
> Signed-off-by: Vinay Simha BN 
> Tested-by: John Stultz 
> Reviewed-by: Emil Velikov 
>
> ---
> v1:
>  * sumit ported to drm/panel framework, john cherry-picked to mainline,
>folded down other fixes from Vinay and Archit, vinay removed interface
>setting cmd mode, video mode panel selected
>
> v2:
>  * incorporated code reviews from theiry, archit
>code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
>arrays of u8, generic helper function, documentation bindings,
>
> v3:
>  * dcs backlight support added
>  * tested this panel driver in nexus7 2013 device
>
> v4:
>  * backlight interface added in the panel driver
>  * incorporated width_mm and height_mm suggested by rob herring
>
> v5:
>  * theirry review comments incorporated
>panel model naming consistent, alphabetical soring in Kconfig
>Makefile, MAX_BRIGHTNESS dropped, regulator_names, parameterize
>panel width and height, descprition for control display, cabc
>and interface setting, temporary variable removed, consistent
>error reporting and commit message
>  * removed tear on/off, scanline, since these are required only
>for command mode panels
>
> v6:
>  * emil review comments incorporated
>PANEL_NUM_REGULATORS dropped, return ret added at necessary
>places, if checks dropped for backlight and gpios
>
> v7:
>  * emil review comments incorporated
>added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
>gpios checks dropped.
>some returns cannot be dropped, since drm panel framework return
>type required.
>
> v8:
>  * emil review commnets incorporated for jdi_panel_unprepare,
>dropped the returns (ref: panel-sharp-lq101r1sx01.c) and
>for jdi_panel_prepare(panel_on) it does not return prematurely
>and goes to poweroff if not success
>  * few dev_err's for panel_init
>
> v9:
>  * function drm_panel_create_dsi_backlight made as static
>
> v10:
>  * proper naming conventions and sequence wrt panel datasheet
>(vddp-supply, iovcc-supply,
> enable-gpios, reset-gpios, dcdc-en-gpios)
>  * GPIO_ACTIVE_LOW polarity logic for reset-gpios
> ---
>  drivers/gpu/drm/panel/Kconfig  |  11 +
>  drivers/gpu/drm/panel/Makefile |   1 +
>  drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 532 
> +
>  3 files changed, 544 insertions(+)
>  create mode 100644 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
>
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 1500ab9..62aba97 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -18,6 +18,17 @@ config DRM_PANEL_SIMPLE
>   that it can be automatically turned off when the panel goes into a
>   low power state.
>
> +config DRM_PANEL_JDI_LT070ME05000
> +   tristate "JDI LT070ME05000 WUXGA DSI panel"
> +   depends on OF
> +   depends on DRM_MIPI_DSI
> +   depends on BACKLIGHT_CLASS_DEVICE
> +   help
> + Say Y here if you want to enable support for JDI DSI video mode
> + panel as found in Google Nexus 7 (2013) devices.
> + The panel has a 1200(RGB)×1920 (WUXGA) resolution and uses
> + 24 bit per pixel.
> +
>  config DRM_PANEL_SAMSUNG_LD9040
> tristate "Samsung LD9040 RGB/SPI panel"
> depends on OF && SPI
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index f277eed..a5c7ec0 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -1,4 +1,5 @@
>  obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
> +obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
>  obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
>  obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += 
> panel-panasonic-vvx10f034n00.o
>  obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
> dif

Re: [PATCH v3 2/3] dt-bindings: Add jdi lt070me05000 panel bindings

2016-09-07 Thread Vinay Simha
thierry,

please review.

On Fri, Aug 26, 2016 at 8:07 AM, Vinay Simha BN <simha...@gmail.com> wrote:
> Add documentation for lt070me05000 panel
>
> Cc: Archit Taneja <archit.tan...@gmail.com>
> Cc: John Stultz <john.stu...@linaro.org>
> Cc: Thierry Reding <thierry.red...@gmail.com>
> Cc: Sumit Semwal <sumit.sem...@linaro.org>
> Signed-off-by: Vinay Simha BN <simha...@gmail.com>
> Acked-by: Rob Herring <r...@kernel.org>
>
> ---
> v2:
>  * incorporated rob herring and thierry reviews
>gpio to gpios, gpio to regulator using fixed regulators
>and pwm backlight is removed, since it is controlled by
>dcs commands
>
> v3:
>  * incorporated thierry reviews
>- Added gpio polarity details for reset-gpios
>- proper naming conventions and sequence wrt panel datasheet
>  (vddp-supply, iovcc-supply,
>   enable-gpios, reset-gpios, dcdc-en-gpios)
> ---
>  .../bindings/display/panel/jdi,lt070me05000.txt| 33 
> ++
>  1 file changed, 33 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
> b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
> new file mode 100644
> index 000..4724952
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
> @@ -0,0 +1,33 @@
> +JDI model LT070ME05000 1200x1920 7" DSI Panel
> +
> +Required properties:
> +- compatible: should be "jdi,lt070me05000"
> +- vddp-supply: phandle of the regulator that provides the supply voltage
> +  Power IC supply (3-5V)
> +- iovcc-supply: phandle of the regulator that provides the supply voltage
> +  IOVCC , power supply for LCM (1.8V)
> +- enable-gpios: phandle of gpio for enable line
> +  LED_EN, LED backlight enable, High active
> +- reset-gpios: phandle of gpio for reset line
> +  This should be 8mA, gpio can be configured using mux, pinctrl, 
> pinctrl-names
> +  XRES, Reset, Low active
> +- dcdc-en-gpios: phandle of the gpio for power ic line
> +  Power IC supply enable, High active
> +
> +Example:
> +
> +   dsi0: qcom,mdss_dsi@470 {
> +   panel@0 {
> +   compatible = "jdi,lt070me05000";
> +   reg = <0>;
> +   pinctrl-names = "default";
> +   pinctrl-0 = <_panel_pinctrl>;
> +
> +   vddp-supply = <_l17>;
> +   iovcc-supply = <_lvs7>;
> +
> +   enable-gpios = <_gpio 36 GPIO_ACTIVE_HIGH>;
> +   reset-gpios = <_pinmux 54 GPIO_ACTIVE_LOW>;
> +   dcdc-en-gpios = <_gpio 23 GPIO_ACTIVE_HIGH>;
> +   };
> +   };
> --
> 2.1.2
>



-- 
regards,
vinaysimha


Re: [PATCH v3 2/3] dt-bindings: Add jdi lt070me05000 panel bindings

2016-09-07 Thread Vinay Simha
thierry,

please review.

On Fri, Aug 26, 2016 at 8:07 AM, Vinay Simha BN  wrote:
> Add documentation for lt070me05000 panel
>
> Cc: Archit Taneja 
> Cc: John Stultz 
> Cc: Thierry Reding 
> Cc: Sumit Semwal 
> Signed-off-by: Vinay Simha BN 
> Acked-by: Rob Herring 
>
> ---
> v2:
>  * incorporated rob herring and thierry reviews
>gpio to gpios, gpio to regulator using fixed regulators
>and pwm backlight is removed, since it is controlled by
>dcs commands
>
> v3:
>  * incorporated thierry reviews
>- Added gpio polarity details for reset-gpios
>- proper naming conventions and sequence wrt panel datasheet
>  (vddp-supply, iovcc-supply,
>   enable-gpios, reset-gpios, dcdc-en-gpios)
> ---
>  .../bindings/display/panel/jdi,lt070me05000.txt| 33 
> ++
>  1 file changed, 33 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
> b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
> new file mode 100644
> index 000..4724952
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
> @@ -0,0 +1,33 @@
> +JDI model LT070ME05000 1200x1920 7" DSI Panel
> +
> +Required properties:
> +- compatible: should be "jdi,lt070me05000"
> +- vddp-supply: phandle of the regulator that provides the supply voltage
> +  Power IC supply (3-5V)
> +- iovcc-supply: phandle of the regulator that provides the supply voltage
> +  IOVCC , power supply for LCM (1.8V)
> +- enable-gpios: phandle of gpio for enable line
> +  LED_EN, LED backlight enable, High active
> +- reset-gpios: phandle of gpio for reset line
> +  This should be 8mA, gpio can be configured using mux, pinctrl, 
> pinctrl-names
> +  XRES, Reset, Low active
> +- dcdc-en-gpios: phandle of the gpio for power ic line
> +  Power IC supply enable, High active
> +
> +Example:
> +
> +   dsi0: qcom,mdss_dsi@470 {
> +   panel@0 {
> +   compatible = "jdi,lt070me05000";
> +   reg = <0>;
> +   pinctrl-names = "default";
> +   pinctrl-0 = <_panel_pinctrl>;
> +
> +   vddp-supply = <_l17>;
> +   iovcc-supply = <_lvs7>;
> +
> +   enable-gpios = <_gpio 36 GPIO_ACTIVE_HIGH>;
> +   reset-gpios = <_pinmux 54 GPIO_ACTIVE_LOW>;
> +   dcdc-en-gpios = <_gpio 23 GPIO_ACTIVE_HIGH>;
> +   };
> +   };
> --
> 2.1.2
>



-- 
regards,
vinaysimha


[PATCH 1/3] dt-bindings: Add Japan Display Inc vendor id

2016-08-25 Thread Vinay Simha BN
Add vendor id for Japan Display Inc.

Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: John Stultz <john.stu...@linaro.org>
Cc: Thierry Reding <thierry.red...@gmail.com>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
Acked-by: Rob Herring <r...@kernel.org>
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 0d9d4d8..48b8128 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -139,6 +139,7 @@ invensense  InvenSense Inc.
 isee   ISEE 2007 S.L.
 isil   Intersil
 issi   Integrated Silicon Solutions Inc.
+jdiJapan Display Inc.
 jedec  JEDEC Solid State Technology Association
 karo   Ka-Ro electronics GmbH
 keymileKeymile GmbH
-- 
2.1.2



[PATCH 1/3] dt-bindings: Add Japan Display Inc vendor id

2016-08-25 Thread Vinay Simha BN
Add vendor id for Japan Display Inc.

Cc: Archit Taneja 
Cc: John Stultz 
Cc: Thierry Reding 
Cc: Sumit Semwal 
Signed-off-by: Vinay Simha BN 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 0d9d4d8..48b8128 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -139,6 +139,7 @@ invensense  InvenSense Inc.
 isee   ISEE 2007 S.L.
 isil   Intersil
 issi   Integrated Silicon Solutions Inc.
+jdiJapan Display Inc.
 jedec  JEDEC Solid State Technology Association
 karo   Ka-Ro electronics GmbH
 keymileKeymile GmbH
-- 
2.1.2



[PATCH v10 3/3] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-08-25 Thread Vinay Simha BN
Add support for the JDI LT070ME05000 WUXGA DSI panel used in
Nexus 7 2013 devices.

Programming sequence for the panel is was originally found in the
android-msm-flo-3.4-lollipop-release branch from:
https://android.googlesource.com/kernel/msm.git

And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
file in:
git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27

Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: Rob Clark <robdcl...@gmail.com>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Cc: John Stultz <john.stu...@linaro.org>
Cc: Emil Velikov <emil.l.veli...@gmail.com>
Cc: Thierry Reding <thierry.red...@gmail.com>
Cc: David Airlie <airl...@linux.ie>
Signed-off-by: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: John Stultz <john.stu...@linaro.org>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
Tested-by: John Stultz <john.stu...@linaro.org>
Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com>

---
v1:
 * sumit ported to drm/panel framework, john cherry-picked to mainline,
   folded down other fixes from Vinay and Archit, vinay removed interface
   setting cmd mode, video mode panel selected

v2:
 * incorporated code reviews from theiry, archit
   code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
   arrays of u8, generic helper function, documentation bindings,

v3:
 * dcs backlight support added
 * tested this panel driver in nexus7 2013 device

v4:
 * backlight interface added in the panel driver
 * incorporated width_mm and height_mm suggested by rob herring

v5:
 * theirry review comments incorporated
   panel model naming consistent, alphabetical soring in Kconfig
   Makefile, MAX_BRIGHTNESS dropped, regulator_names, parameterize
   panel width and height, descprition for control display, cabc
   and interface setting, temporary variable removed, consistent
   error reporting and commit message
 * removed tear on/off, scanline, since these are required only
   for command mode panels

v6:
 * emil review comments incorporated
   PANEL_NUM_REGULATORS dropped, return ret added at necessary
   places, if checks dropped for backlight and gpios

v7:
 * emil review comments incorporated
   added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
   gpios checks dropped.
   some returns cannot be dropped, since drm panel framework return
   type required.

v8:
 * emil review commnets incorporated for jdi_panel_unprepare,
   dropped the returns (ref: panel-sharp-lq101r1sx01.c) and
   for jdi_panel_prepare(panel_on) it does not return prematurely
   and goes to poweroff if not success
 * few dev_err's for panel_init

v9:
 * function drm_panel_create_dsi_backlight made as static

v10:
 * proper naming conventions and sequence wrt panel datasheet
   (vddp-supply, iovcc-supply,
enable-gpios, reset-gpios, dcdc-en-gpios)
 * GPIO_ACTIVE_LOW polarity logic for reset-gpios
---
 drivers/gpu/drm/panel/Kconfig  |  11 +
 drivers/gpu/drm/panel/Makefile |   1 +
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 532 +
 3 files changed, 544 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 1500ab9..62aba97 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -18,6 +18,17 @@ config DRM_PANEL_SIMPLE
  that it can be automatically turned off when the panel goes into a
  low power state.
 
+config DRM_PANEL_JDI_LT070ME05000
+   tristate "JDI LT070ME05000 WUXGA DSI panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for JDI DSI video mode
+ panel as found in Google Nexus 7 (2013) devices.
+ The panel has a 1200(RGB)×1920 (WUXGA) resolution and uses
+ 24 bit per pixel.
+
 config DRM_PANEL_SAMSUNG_LD9040
tristate "Samsung LD9040 RGB/SPI panel"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index f277eed..a5c7ec0 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
+obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
 obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += 
panel-panasonic-vvx10f034n00.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c 
b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
new file mode 100644
index 000..5b2340e
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -0,0 +1,532 @@
+/*
+ * Copyright (C) 2016 InforceComputing
+ * Author: Vinay Simha BN <simha...@gmail.com

[PATCH v3 2/3] dt-bindings: Add jdi lt070me05000 panel bindings

2016-08-25 Thread Vinay Simha BN
Add documentation for lt070me05000 panel

Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: John Stultz <john.stu...@linaro.org>
Cc: Thierry Reding <thierry.red...@gmail.com>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
Acked-by: Rob Herring <r...@kernel.org>

---
v2:
 * incorporated rob herring and thierry reviews
   gpio to gpios, gpio to regulator using fixed regulators
   and pwm backlight is removed, since it is controlled by
   dcs commands

v3:
 * incorporated thierry reviews
   - Added gpio polarity details for reset-gpios
   - proper naming conventions and sequence wrt panel datasheet
 (vddp-supply, iovcc-supply,
  enable-gpios, reset-gpios, dcdc-en-gpios)
---
 .../bindings/display/panel/jdi,lt070me05000.txt| 33 ++
 1 file changed, 33 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
new file mode 100644
index 000..4724952
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
@@ -0,0 +1,33 @@
+JDI model LT070ME05000 1200x1920 7" DSI Panel
+
+Required properties:
+- compatible: should be "jdi,lt070me05000"
+- vddp-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply (3-5V)
+- iovcc-supply: phandle of the regulator that provides the supply voltage
+  IOVCC , power supply for LCM (1.8V)
+- enable-gpios: phandle of gpio for enable line
+  LED_EN, LED backlight enable, High active
+- reset-gpios: phandle of gpio for reset line
+  This should be 8mA, gpio can be configured using mux, pinctrl, pinctrl-names
+  XRES, Reset, Low active
+- dcdc-en-gpios: phandle of the gpio for power ic line
+  Power IC supply enable, High active
+
+Example:
+
+   dsi0: qcom,mdss_dsi@470 {
+   panel@0 {
+   compatible = "jdi,lt070me05000";
+   reg = <0>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_panel_pinctrl>;
+
+   vddp-supply = <_l17>;
+   iovcc-supply = <_lvs7>;
+
+   enable-gpios = <_gpio 36 GPIO_ACTIVE_HIGH>;
+   reset-gpios = <_pinmux 54 GPIO_ACTIVE_LOW>;
+   dcdc-en-gpios = <_gpio 23 GPIO_ACTIVE_HIGH>;
+   };
+   };
-- 
2.1.2



[PATCH v10 3/3] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-08-25 Thread Vinay Simha BN
Add support for the JDI LT070ME05000 WUXGA DSI panel used in
Nexus 7 2013 devices.

Programming sequence for the panel is was originally found in the
android-msm-flo-3.4-lollipop-release branch from:
https://android.googlesource.com/kernel/msm.git

And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
file in:
git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27

Cc: Archit Taneja 
Cc: Rob Clark 
Cc: Sumit Semwal 
Cc: John Stultz 
Cc: Emil Velikov 
Cc: Thierry Reding 
Cc: David Airlie 
Signed-off-by: Sumit Semwal 
Signed-off-by: John Stultz 
Signed-off-by: Vinay Simha BN 
Tested-by: John Stultz 
Reviewed-by: Emil Velikov 

---
v1:
 * sumit ported to drm/panel framework, john cherry-picked to mainline,
   folded down other fixes from Vinay and Archit, vinay removed interface
   setting cmd mode, video mode panel selected

v2:
 * incorporated code reviews from theiry, archit
   code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
   arrays of u8, generic helper function, documentation bindings,

v3:
 * dcs backlight support added
 * tested this panel driver in nexus7 2013 device

v4:
 * backlight interface added in the panel driver
 * incorporated width_mm and height_mm suggested by rob herring

v5:
 * theirry review comments incorporated
   panel model naming consistent, alphabetical soring in Kconfig
   Makefile, MAX_BRIGHTNESS dropped, regulator_names, parameterize
   panel width and height, descprition for control display, cabc
   and interface setting, temporary variable removed, consistent
   error reporting and commit message
 * removed tear on/off, scanline, since these are required only
   for command mode panels

v6:
 * emil review comments incorporated
   PANEL_NUM_REGULATORS dropped, return ret added at necessary
   places, if checks dropped for backlight and gpios

v7:
 * emil review comments incorporated
   added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
   gpios checks dropped.
   some returns cannot be dropped, since drm panel framework return
   type required.

v8:
 * emil review commnets incorporated for jdi_panel_unprepare,
   dropped the returns (ref: panel-sharp-lq101r1sx01.c) and
   for jdi_panel_prepare(panel_on) it does not return prematurely
   and goes to poweroff if not success
 * few dev_err's for panel_init

v9:
 * function drm_panel_create_dsi_backlight made as static

v10:
 * proper naming conventions and sequence wrt panel datasheet
   (vddp-supply, iovcc-supply,
enable-gpios, reset-gpios, dcdc-en-gpios)
 * GPIO_ACTIVE_LOW polarity logic for reset-gpios
---
 drivers/gpu/drm/panel/Kconfig  |  11 +
 drivers/gpu/drm/panel/Makefile |   1 +
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 532 +
 3 files changed, 544 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 1500ab9..62aba97 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -18,6 +18,17 @@ config DRM_PANEL_SIMPLE
  that it can be automatically turned off when the panel goes into a
  low power state.
 
+config DRM_PANEL_JDI_LT070ME05000
+   tristate "JDI LT070ME05000 WUXGA DSI panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for JDI DSI video mode
+ panel as found in Google Nexus 7 (2013) devices.
+ The panel has a 1200(RGB)×1920 (WUXGA) resolution and uses
+ 24 bit per pixel.
+
 config DRM_PANEL_SAMSUNG_LD9040
tristate "Samsung LD9040 RGB/SPI panel"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index f277eed..a5c7ec0 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
+obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
 obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += 
panel-panasonic-vvx10f034n00.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c 
b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
new file mode 100644
index 000..5b2340e
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -0,0 +1,532 @@
+/*
+ * Copyright (C) 2016 InforceComputing
+ * Author: Vinay Simha BN 
+ *
+ * Copyright (C) 2016 Linaro Ltd
+ * Author: Sumit Semwal 
+ *
+ * From internet archives, the panel for Nexus 7 2nd Gen, 2013 model is a
+ * JDI model LT070ME05000, and its data sheet is at:
+ * http://panelone.net/en/7-0-inch/JDI_LT070ME05000_7.0_inch-datasheet
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of th

[PATCH v3 2/3] dt-bindings: Add jdi lt070me05000 panel bindings

2016-08-25 Thread Vinay Simha BN
Add documentation for lt070me05000 panel

Cc: Archit Taneja 
Cc: John Stultz 
Cc: Thierry Reding 
Cc: Sumit Semwal 
Signed-off-by: Vinay Simha BN 
Acked-by: Rob Herring 

---
v2:
 * incorporated rob herring and thierry reviews
   gpio to gpios, gpio to regulator using fixed regulators
   and pwm backlight is removed, since it is controlled by
   dcs commands

v3:
 * incorporated thierry reviews
   - Added gpio polarity details for reset-gpios
   - proper naming conventions and sequence wrt panel datasheet
 (vddp-supply, iovcc-supply,
  enable-gpios, reset-gpios, dcdc-en-gpios)
---
 .../bindings/display/panel/jdi,lt070me05000.txt| 33 ++
 1 file changed, 33 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
new file mode 100644
index 000..4724952
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
@@ -0,0 +1,33 @@
+JDI model LT070ME05000 1200x1920 7" DSI Panel
+
+Required properties:
+- compatible: should be "jdi,lt070me05000"
+- vddp-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply (3-5V)
+- iovcc-supply: phandle of the regulator that provides the supply voltage
+  IOVCC , power supply for LCM (1.8V)
+- enable-gpios: phandle of gpio for enable line
+  LED_EN, LED backlight enable, High active
+- reset-gpios: phandle of gpio for reset line
+  This should be 8mA, gpio can be configured using mux, pinctrl, pinctrl-names
+  XRES, Reset, Low active
+- dcdc-en-gpios: phandle of the gpio for power ic line
+  Power IC supply enable, High active
+
+Example:
+
+   dsi0: qcom,mdss_dsi@470 {
+   panel@0 {
+   compatible = "jdi,lt070me05000";
+   reg = <0>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_panel_pinctrl>;
+
+   vddp-supply = <_l17>;
+   iovcc-supply = <_lvs7>;
+
+   enable-gpios = <_gpio 36 GPIO_ACTIVE_HIGH>;
+   reset-gpios = <_pinmux 54 GPIO_ACTIVE_LOW>;
+   dcdc-en-gpios = <_gpio 23 GPIO_ACTIVE_HIGH>;
+   };
+   };
-- 
2.1.2



Re: [RESEND] [PATCH v2 2/4] dt-bindings: Add jdi lt070me05000 panel bindings

2016-08-24 Thread Vinay Simha
 - dcdc-en-gpios: power IC supply enable

i cannot make this as gpios, since pm8921_lvs7 is a regulator.
We can make gpio as regulator, but not regulator as gpio.

other option i have to map pm8921_lvs7 to iovcc-supply and pm8921_gpio
23 to dcdc-en-gpios.

Since we do not have nx7 schematic not sure which pins are mapped in
hardware, other than the src code reference. Even in the 3.4 source
code gpio/pin/regulator mappings and naming are not proper in
board-flo-display.c

What is your suggestion?

On Wed, Aug 24, 2016 at 6:02 PM, Thierry Reding
<thierry.red...@gmail.com> wrote:
> On Wed, Aug 24, 2016 at 05:34:55PM +0530, Vinay Simha wrote:
>> thierry,
>>
>> this is the reference pinouts of the panel
>> http://www.tonylabs.com/wp-content/uploads/LT070ME05000-pinouts.jpg
>
> I can't open that file.
>
>> as you suggest , i will change the vcc-supply,
>>
>>  - iovcc-supply: phandle of the regulator that supplies power to
>>   the IOVCC voltage input (1.8 V)
>>
>> will keep the other two(vddp-supply, dcdc_en-supply) remaining same.
>
> "dcdc_en" sounds to me like it should be a GPIO rather than a regulator.
>
> According to this datasheet:
>
> 
> http://kb.52solution.com/data/uploads/2016/04/07/3172846545705cc22d050e.pdf
>
> the input voltages are indeed VDD, VDDp and IOVCC, though with slightly
> larger tolerances than the previous datasheet. VDD and VDDp can both go
> from 3.0 V to 5.0 V. DCDC_EN is indeed an additional GPIO to enable the
> VDDp supply.
>
> I think you'd need something along these lines:
>
> - vdd-supply: LED power supply (3.0-5.0 V)
> - vddp-supply: power IC supply (3.0-5.0 V)
> - iovcc-supply: LCM power supply (1.8 V)
> - dcdc-en-gpios: power IC supply enable
> - led-en-gpios: LED backlight enable
>
> Or perhaps your vddp-supply should be a regulator that's controlled by
> the GPIO that you'd put in dcdc-en-gpios. That might work better. That
> would leave only led-en-gpios as the only enable GPIOs property, so it
> would be okay to keep the name "enable-gpios", I guess.
>
> Thierry
>
>> On Wed, Aug 24, 2016 at 5:15 PM, Thierry Reding
>> <thierry.red...@gmail.com> wrote:
>> > On Sun, Jul 31, 2016 at 08:45:21PM +0530, Vinay Simha BN wrote:
>> >> Add documentation for lt070me05000 panel
>> >>
>> >> Cc: Archit Taneja <archit.tan...@gmail.com>
>> >> Cc: John Stultz <john.stu...@linaro.org>
>> >> Cc: Thierry Reding <thierry.red...@gmail.com>
>> >> Cc: Sumit Semwal <sumit.sem...@linaro.org>
>> >> Signed-off-by: Vinay Simha BN <simha...@gmail.com>
>> >> Acked-by: Rob Herring <r...@kernel.org>
>> >>
>> >> ---
>> >> v2:
>> >>  * incorporated rob herring and thierry reviews
>> >>gpio to gpios, gpio to regulator using fixed regulators
>> >>and pwm backlight is removed, since it is controlled by
>> >>dcs commands
>> >> ---
>> >>  .../bindings/display/panel/jdi,lt070me05000.txt| 57 
>> >> ++
>> >>  1 file changed, 57 insertions(+)
>> >>  create mode 100644 
>> >> Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>> >>
>> >> diff --git 
>> >> a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
>> >> b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>> >> new file mode 100644
>> >> index 000..613b76f
>> >> --- /dev/null
>> >> +++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>> >> @@ -0,0 +1,57 @@
>> >> +JDI model LT070ME05000 1200x1920 7" DSI Panel
>> >> +
>> >> +Required properties:
>> >> +- compatible: should be "jdi,lt070me05000"
>> >> +- vddp-supply: phandle of the regulator that provides the supply voltage
>> >> +  Power IC supply (3-5V)
>> >> +- dcdc_en-supply: phandle of the regulator that provides the supply 
>> >> voltage
>> >> +  Power IC supply enable, High active
>> >> +- vcc-supply: phandle of the regulator that provides the supply voltage
>> >> +  IOVCC , power supply for LCM (1.8V)
>> >
>> > I was just going to apply this and wanted to add some information about
>> > how many lanes the panel uses, so I looked at the datasheet linked to in
>> > patch 4/4:
>> >
>> > http://panelone.net/en/7-0-inch/JDI_LT070ME05000

Re: [RESEND] [PATCH v2 2/4] dt-bindings: Add jdi lt070me05000 panel bindings

2016-08-24 Thread Vinay Simha
 - dcdc-en-gpios: power IC supply enable

i cannot make this as gpios, since pm8921_lvs7 is a regulator.
We can make gpio as regulator, but not regulator as gpio.

other option i have to map pm8921_lvs7 to iovcc-supply and pm8921_gpio
23 to dcdc-en-gpios.

Since we do not have nx7 schematic not sure which pins are mapped in
hardware, other than the src code reference. Even in the 3.4 source
code gpio/pin/regulator mappings and naming are not proper in
board-flo-display.c

What is your suggestion?

On Wed, Aug 24, 2016 at 6:02 PM, Thierry Reding
 wrote:
> On Wed, Aug 24, 2016 at 05:34:55PM +0530, Vinay Simha wrote:
>> thierry,
>>
>> this is the reference pinouts of the panel
>> http://www.tonylabs.com/wp-content/uploads/LT070ME05000-pinouts.jpg
>
> I can't open that file.
>
>> as you suggest , i will change the vcc-supply,
>>
>>  - iovcc-supply: phandle of the regulator that supplies power to
>>   the IOVCC voltage input (1.8 V)
>>
>> will keep the other two(vddp-supply, dcdc_en-supply) remaining same.
>
> "dcdc_en" sounds to me like it should be a GPIO rather than a regulator.
>
> According to this datasheet:
>
> 
> http://kb.52solution.com/data/uploads/2016/04/07/3172846545705cc22d050e.pdf
>
> the input voltages are indeed VDD, VDDp and IOVCC, though with slightly
> larger tolerances than the previous datasheet. VDD and VDDp can both go
> from 3.0 V to 5.0 V. DCDC_EN is indeed an additional GPIO to enable the
> VDDp supply.
>
> I think you'd need something along these lines:
>
> - vdd-supply: LED power supply (3.0-5.0 V)
> - vddp-supply: power IC supply (3.0-5.0 V)
> - iovcc-supply: LCM power supply (1.8 V)
> - dcdc-en-gpios: power IC supply enable
> - led-en-gpios: LED backlight enable
>
> Or perhaps your vddp-supply should be a regulator that's controlled by
> the GPIO that you'd put in dcdc-en-gpios. That might work better. That
> would leave only led-en-gpios as the only enable GPIOs property, so it
> would be okay to keep the name "enable-gpios", I guess.
>
> Thierry
>
>> On Wed, Aug 24, 2016 at 5:15 PM, Thierry Reding
>>  wrote:
>> > On Sun, Jul 31, 2016 at 08:45:21PM +0530, Vinay Simha BN wrote:
>> >> Add documentation for lt070me05000 panel
>> >>
>> >> Cc: Archit Taneja 
>> >> Cc: John Stultz 
>> >> Cc: Thierry Reding 
>> >> Cc: Sumit Semwal 
>> >> Signed-off-by: Vinay Simha BN 
>> >> Acked-by: Rob Herring 
>> >>
>> >> ---
>> >> v2:
>> >>  * incorporated rob herring and thierry reviews
>> >>gpio to gpios, gpio to regulator using fixed regulators
>> >>and pwm backlight is removed, since it is controlled by
>> >>dcs commands
>> >> ---
>> >>  .../bindings/display/panel/jdi,lt070me05000.txt| 57 
>> >> ++
>> >>  1 file changed, 57 insertions(+)
>> >>  create mode 100644 
>> >> Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>> >>
>> >> diff --git 
>> >> a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
>> >> b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>> >> new file mode 100644
>> >> index 000..613b76f
>> >> --- /dev/null
>> >> +++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>> >> @@ -0,0 +1,57 @@
>> >> +JDI model LT070ME05000 1200x1920 7" DSI Panel
>> >> +
>> >> +Required properties:
>> >> +- compatible: should be "jdi,lt070me05000"
>> >> +- vddp-supply: phandle of the regulator that provides the supply voltage
>> >> +  Power IC supply (3-5V)
>> >> +- dcdc_en-supply: phandle of the regulator that provides the supply 
>> >> voltage
>> >> +  Power IC supply enable, High active
>> >> +- vcc-supply: phandle of the regulator that provides the supply voltage
>> >> +  IOVCC , power supply for LCM (1.8V)
>> >
>> > I was just going to apply this and wanted to add some information about
>> > how many lanes the panel uses, so I looked at the datasheet linked to in
>> > patch 4/4:
>> >
>> > http://panelone.net/en/7-0-inch/JDI_LT070ME05000_7.0_inch-datasheet
>> >
>> > and noticed that the power supplies in the binding here don't match the
>> > ones listed in the datasheet. Granted, the datasheet is somewhat meager,
>> > but it list

Re: [RESEND] [PATCH v2 2/4] dt-bindings: Add jdi lt070me05000 panel bindings

2016-08-24 Thread Vinay Simha
if we do not set the polarity to 8mA, panel will have gibberish display.
(information to set 8mA is available only in
nexus7-msm-flo-3.4-lollipop-release_dsi kernel nx7 release)

i will add this
reset-gpios = <_pinmux 54 GPIO_ACTIVE_LOW>;

On Wed, Aug 24, 2016 at 5:26 PM, Thierry Reding
<thierry.red...@gmail.com> wrote:
> On Sun, Jul 31, 2016 at 08:45:21PM +0530, Vinay Simha BN wrote:
> [...]
>> diff --git 
>> a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
>> b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
> [...]
>> +- reset-gpios: phandle of gpio for reset line
>> +  This should be 8mA, gpio can be configured using mux, pinctrl, 
>> pinctrl-names
>> +  XRES, Reset, Low active
>> +- enable-gpios: phandle of gpio for enable line
>> +  LED_EN, LED backlight enable, High active
>
> This is a little confusing. Shouldn't we rather completely omit any
> mention of the polarity of these and let the board design handle this?
>
> If the reset is low active, then I'd expect that to be reflected in the
> GPIO specifier of the reset-gpios property, like so:
>
> panel@0 {
> ...
> reset-gpios = <_pinmux 54 GPIO_ACTIVE_LOW>;
> ...
> };
>
> With that a driver can simply deal with a high active reset, which it
> currently doesn't. The problem with the current description is that it
> is unclear who's to deal with the polarity. In order for this to work
> properly with the current driver you'll have to specify the GPIO as
> GPIO_ACTIVE_HIGH, which is not what the binding says it should be.
>
> Thierry



-- 
regards,
vinaysimha


Re: [RESEND] [PATCH v2 2/4] dt-bindings: Add jdi lt070me05000 panel bindings

2016-08-24 Thread Vinay Simha
if we do not set the polarity to 8mA, panel will have gibberish display.
(information to set 8mA is available only in
nexus7-msm-flo-3.4-lollipop-release_dsi kernel nx7 release)

i will add this
reset-gpios = <_pinmux 54 GPIO_ACTIVE_LOW>;

On Wed, Aug 24, 2016 at 5:26 PM, Thierry Reding
 wrote:
> On Sun, Jul 31, 2016 at 08:45:21PM +0530, Vinay Simha BN wrote:
> [...]
>> diff --git 
>> a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
>> b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
> [...]
>> +- reset-gpios: phandle of gpio for reset line
>> +  This should be 8mA, gpio can be configured using mux, pinctrl, 
>> pinctrl-names
>> +  XRES, Reset, Low active
>> +- enable-gpios: phandle of gpio for enable line
>> +  LED_EN, LED backlight enable, High active
>
> This is a little confusing. Shouldn't we rather completely omit any
> mention of the polarity of these and let the board design handle this?
>
> If the reset is low active, then I'd expect that to be reflected in the
> GPIO specifier of the reset-gpios property, like so:
>
> panel@0 {
> ...
> reset-gpios = <_pinmux 54 GPIO_ACTIVE_LOW>;
> ...
> };
>
> With that a driver can simply deal with a high active reset, which it
> currently doesn't. The problem with the current description is that it
> is unclear who's to deal with the polarity. In order for this to work
> properly with the current driver you'll have to specify the GPIO as
> GPIO_ACTIVE_HIGH, which is not what the binding says it should be.
>
> Thierry



-- 
regards,
vinaysimha


Re: [RESEND] [PATCH v2 2/4] dt-bindings: Add jdi lt070me05000 panel bindings

2016-08-24 Thread Vinay Simha
thierry,

this is the reference pinouts of the panel
http://www.tonylabs.com/wp-content/uploads/LT070ME05000-pinouts.jpg

as you suggest , i will change the vcc-supply,

 - iovcc-supply: phandle of the regulator that supplies power to
  the IOVCC voltage input (1.8 V)

will keep the other two(vddp-supply, dcdc_en-supply) remaining same.

On Wed, Aug 24, 2016 at 5:15 PM, Thierry Reding
<thierry.red...@gmail.com> wrote:
> On Sun, Jul 31, 2016 at 08:45:21PM +0530, Vinay Simha BN wrote:
>> Add documentation for lt070me05000 panel
>>
>> Cc: Archit Taneja <archit.tan...@gmail.com>
>> Cc: John Stultz <john.stu...@linaro.org>
>> Cc: Thierry Reding <thierry.red...@gmail.com>
>> Cc: Sumit Semwal <sumit.sem...@linaro.org>
>> Signed-off-by: Vinay Simha BN <simha...@gmail.com>
>> Acked-by: Rob Herring <r...@kernel.org>
>>
>> ---
>> v2:
>>  * incorporated rob herring and thierry reviews
>>gpio to gpios, gpio to regulator using fixed regulators
>>and pwm backlight is removed, since it is controlled by
>>dcs commands
>> ---
>>  .../bindings/display/panel/jdi,lt070me05000.txt| 57 
>> ++
>>  1 file changed, 57 insertions(+)
>>  create mode 100644 
>> Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
>> b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>> new file mode 100644
>> index 000..613b76f
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>> @@ -0,0 +1,57 @@
>> +JDI model LT070ME05000 1200x1920 7" DSI Panel
>> +
>> +Required properties:
>> +- compatible: should be "jdi,lt070me05000"
>> +- vddp-supply: phandle of the regulator that provides the supply voltage
>> +  Power IC supply (3-5V)
>> +- dcdc_en-supply: phandle of the regulator that provides the supply voltage
>> +  Power IC supply enable, High active
>> +- vcc-supply: phandle of the regulator that provides the supply voltage
>> +  IOVCC , power supply for LCM (1.8V)
>
> I was just going to apply this and wanted to add some information about
> how many lanes the panel uses, so I looked at the datasheet linked to in
> patch 4/4:
>
> http://panelone.net/en/7-0-inch/JDI_LT070ME05000_7.0_inch-datasheet
>
> and noticed that the power supplies in the binding here don't match the
> ones listed in the datasheet. Granted, the datasheet is somewhat meager,
> but it lists the following three input voltages:
>
> - IOVCC at 1.8 V
> - VDD at 3.0 V
> - VDDP at 3.0 V
>
> This matches in part what the above binding describes, but it's not
> quite right, so I'm wondering if the name for dcdc_en-supply came from
> the board schematics and reflects the name of the rail on the board
> design that provides this rather than the input voltage on the panel.
>
> I think we should follow the names in the panel datasheet so that people
> can more easily reference the correct regulators when using this panel
> on a different board. I'd suggest:
>
> - iovcc-supply: phandle of the regulator that supplies power to
>   the IOVCC voltage input (1.8 V)
> - vdd-supply: phandle of the regulator that supplies power to
>   the VDD voltage input (3.0 V)
> - vddp-supply: phandle of the regulator that supplies power to
>   the VDDP voltage input (3.0 V)
>
> Any objections?
>
> Thierry



-- 
regards,
vinaysimha


Re: [RESEND] [PATCH v2 2/4] dt-bindings: Add jdi lt070me05000 panel bindings

2016-08-24 Thread Vinay Simha
thierry,

this is the reference pinouts of the panel
http://www.tonylabs.com/wp-content/uploads/LT070ME05000-pinouts.jpg

as you suggest , i will change the vcc-supply,

 - iovcc-supply: phandle of the regulator that supplies power to
  the IOVCC voltage input (1.8 V)

will keep the other two(vddp-supply, dcdc_en-supply) remaining same.

On Wed, Aug 24, 2016 at 5:15 PM, Thierry Reding
 wrote:
> On Sun, Jul 31, 2016 at 08:45:21PM +0530, Vinay Simha BN wrote:
>> Add documentation for lt070me05000 panel
>>
>> Cc: Archit Taneja 
>> Cc: John Stultz 
>> Cc: Thierry Reding 
>> Cc: Sumit Semwal 
>> Signed-off-by: Vinay Simha BN 
>> Acked-by: Rob Herring 
>>
>> ---
>> v2:
>>  * incorporated rob herring and thierry reviews
>>gpio to gpios, gpio to regulator using fixed regulators
>>and pwm backlight is removed, since it is controlled by
>>dcs commands
>> ---
>>  .../bindings/display/panel/jdi,lt070me05000.txt| 57 
>> ++
>>  1 file changed, 57 insertions(+)
>>  create mode 100644 
>> Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
>> b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>> new file mode 100644
>> index 000..613b76f
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
>> @@ -0,0 +1,57 @@
>> +JDI model LT070ME05000 1200x1920 7" DSI Panel
>> +
>> +Required properties:
>> +- compatible: should be "jdi,lt070me05000"
>> +- vddp-supply: phandle of the regulator that provides the supply voltage
>> +  Power IC supply (3-5V)
>> +- dcdc_en-supply: phandle of the regulator that provides the supply voltage
>> +  Power IC supply enable, High active
>> +- vcc-supply: phandle of the regulator that provides the supply voltage
>> +  IOVCC , power supply for LCM (1.8V)
>
> I was just going to apply this and wanted to add some information about
> how many lanes the panel uses, so I looked at the datasheet linked to in
> patch 4/4:
>
> http://panelone.net/en/7-0-inch/JDI_LT070ME05000_7.0_inch-datasheet
>
> and noticed that the power supplies in the binding here don't match the
> ones listed in the datasheet. Granted, the datasheet is somewhat meager,
> but it lists the following three input voltages:
>
> - IOVCC at 1.8 V
> - VDD at 3.0 V
> - VDDP at 3.0 V
>
> This matches in part what the above binding describes, but it's not
> quite right, so I'm wondering if the name for dcdc_en-supply came from
> the board schematics and reflects the name of the rail on the board
> design that provides this rather than the input voltage on the panel.
>
> I think we should follow the names in the panel datasheet so that people
> can more easily reference the correct regulators when using this panel
> on a different board. I'd suggest:
>
> - iovcc-supply: phandle of the regulator that supplies power to
>   the IOVCC voltage input (1.8 V)
> - vdd-supply: phandle of the regulator that supplies power to
>   the VDD voltage input (3.0 V)
> - vddp-supply: phandle of the regulator that supplies power to
>   the VDDP voltage input (3.0 V)
>
> Any objections?
>
> Thierry



-- 
regards,
vinaysimha


[RESEND] [PATCH v3 3/4] drm/dsi: Implement dcs set/get display brightness

2016-07-31 Thread Vinay Simha BN
Provide a small convenience wrapper that set/get the
display brightness value

Cc: John Stultz <john.stu...@linaro.org>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: Rob Clark <robdcl...@gmail.com>
Cc: Jani Nikula <jani.nik...@linux.intel.com>
Cc: Thierry Reding <thierry.red...@gmail.com>
Cc: Emil Velikov <emil.l.veli...@gmail.com>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com>

---
v1:
 *tested in nexus7 2nd gen.

v2:
 * implemented jani review comments
   -functions name mapped accordingly
   -bl value increased from 0xff to 0x
   -backlight interface will be handled in panel driver,
so it is moved from the mipi_dsi helper function

v3:
 * emil review comments
   (err < 0) supposed to be (err <= 0)
---
 drivers/gpu/drm/drm_mipi_dsi.c | 49 ++
 include/drm/drm_mipi_dsi.h |  4 
 2 files changed, 53 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index af0d471..43aa743 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -1041,6 +1041,55 @@ int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device 
*dsi, u8 format)
 }
 EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format);
 
+/**
+ * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
+ * of the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
+   u16 *brightness)
+{
+   ssize_t err;
+
+   err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
+   brightness, sizeof(*brightness));
+   if (err <= 0) {
+   if (err == 0)
+   err = -ENODATA;
+
+   return err;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness);
+
+/**
+ * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of
+ * the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
+   u16 brightness)
+{
+   ssize_t err;
+   u8 bl_value[2] = { brightness & 0xff, brightness >> 8 };
+
+   err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
+bl_value, sizeof(bl_value));
+   if (err < 0)
+   return err;
+
+   return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness);
+
 static int mipi_dsi_drv_probe(struct device *dev)
 {
struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 47ac925..404c373 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -270,6 +270,10 @@ int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
 int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
 enum mipi_dsi_dcs_tear_mode mode);
 int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
+int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
+   u16 *brightness);
+int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
+   u16 brightness);
 
 /**
  * struct mipi_dsi_driver - DSI driver
-- 
2.1.2



[RESEND] [PATCH v3 3/4] drm/dsi: Implement dcs set/get display brightness

2016-07-31 Thread Vinay Simha BN
Provide a small convenience wrapper that set/get the
display brightness value

Cc: John Stultz 
Cc: Sumit Semwal 
Cc: Archit Taneja 
Cc: Rob Clark 
Cc: Jani Nikula 
Cc: Thierry Reding 
Cc: Emil Velikov 
Signed-off-by: Vinay Simha BN 
Reviewed-by: Emil Velikov 

---
v1:
 *tested in nexus7 2nd gen.

v2:
 * implemented jani review comments
   -functions name mapped accordingly
   -bl value increased from 0xff to 0x
   -backlight interface will be handled in panel driver,
so it is moved from the mipi_dsi helper function

v3:
 * emil review comments
   (err < 0) supposed to be (err <= 0)
---
 drivers/gpu/drm/drm_mipi_dsi.c | 49 ++
 include/drm/drm_mipi_dsi.h |  4 
 2 files changed, 53 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index af0d471..43aa743 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -1041,6 +1041,55 @@ int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device 
*dsi, u8 format)
 }
 EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format);
 
+/**
+ * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
+ * of the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
+   u16 *brightness)
+{
+   ssize_t err;
+
+   err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
+   brightness, sizeof(*brightness));
+   if (err <= 0) {
+   if (err == 0)
+   err = -ENODATA;
+
+   return err;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness);
+
+/**
+ * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of
+ * the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
+   u16 brightness)
+{
+   ssize_t err;
+   u8 bl_value[2] = { brightness & 0xff, brightness >> 8 };
+
+   err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
+bl_value, sizeof(bl_value));
+   if (err < 0)
+   return err;
+
+   return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness);
+
 static int mipi_dsi_drv_probe(struct device *dev)
 {
struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 47ac925..404c373 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -270,6 +270,10 @@ int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
 int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
 enum mipi_dsi_dcs_tear_mode mode);
 int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
+int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
+   u16 *brightness);
+int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
+   u16 brightness);
 
 /**
  * struct mipi_dsi_driver - DSI driver
-- 
2.1.2



[RESEND] [PATCH v2 2/4] dt-bindings: Add jdi lt070me05000 panel bindings

2016-07-31 Thread Vinay Simha BN
Add documentation for lt070me05000 panel

Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: John Stultz <john.stu...@linaro.org>
Cc: Thierry Reding <thierry.red...@gmail.com>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
Acked-by: Rob Herring <r...@kernel.org>

---
v2:
 * incorporated rob herring and thierry reviews
   gpio to gpios, gpio to regulator using fixed regulators
   and pwm backlight is removed, since it is controlled by
   dcs commands
---
 .../bindings/display/panel/jdi,lt070me05000.txt| 57 ++
 1 file changed, 57 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
new file mode 100644
index 000..613b76f
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
@@ -0,0 +1,57 @@
+JDI model LT070ME05000 1200x1920 7" DSI Panel
+
+Required properties:
+- compatible: should be "jdi,lt070me05000"
+- vddp-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply (3-5V)
+- dcdc_en-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply enable, High active
+- vcc-supply: phandle of the regulator that provides the supply voltage
+  IOVCC , power supply for LCM (1.8V)
+- reset-gpios: phandle of gpio for reset line
+  This should be 8mA, gpio can be configured using mux, pinctrl, pinctrl-names
+  XRES, Reset, Low active
+- enable-gpios: phandle of gpio for enable line
+  LED_EN, LED backlight enable, High active
+
+Example:
+
+   vcc_1p8v: regulator-fixed@2 {
+   compatible = "regulator-fixed";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-name = "vcc_1p8v";
+   regulator-type = "voltage";
+   startup-delay-us = <0>;
+   gpio = <_gpio 23 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   regulator-boot-on;
+   };
+
+   tlmm_pinmux: pinctrl@80 {
+
+   dsi_panel_pinctrl: dsi-panel-pinctrl {
+   mux {
+   pins = "gpio54";
+   function = "gpio";
+   bias-pull-up;
+   drive-strength = <8>;
+   };
+   };
+   };
+
+   dsi0: qcom,mdss_dsi@470 {
+   panel@0 {
+   compatible = "jdi,lt070me05000";
+   reg = <0>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_panel_pinctrl>;
+
+   vddp-supply = <_l17>;
+   dcdc_en-supply = <_lvs7>;
+   vcc-supply = <_1p8v>;
+
+   reset-gpios = <_pinmux 54 0>;
+   enable-gpios = <_gpio 36 GPIO_ACTIVE_HIGH>;
+   };
+   };
-- 
2.1.2



[RESEND] [PATCH v2 2/4] dt-bindings: Add jdi lt070me05000 panel bindings

2016-07-31 Thread Vinay Simha BN
Add documentation for lt070me05000 panel

Cc: Archit Taneja 
Cc: John Stultz 
Cc: Thierry Reding 
Cc: Sumit Semwal 
Signed-off-by: Vinay Simha BN 
Acked-by: Rob Herring 

---
v2:
 * incorporated rob herring and thierry reviews
   gpio to gpios, gpio to regulator using fixed regulators
   and pwm backlight is removed, since it is controlled by
   dcs commands
---
 .../bindings/display/panel/jdi,lt070me05000.txt| 57 ++
 1 file changed, 57 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
new file mode 100644
index 000..613b76f
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
@@ -0,0 +1,57 @@
+JDI model LT070ME05000 1200x1920 7" DSI Panel
+
+Required properties:
+- compatible: should be "jdi,lt070me05000"
+- vddp-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply (3-5V)
+- dcdc_en-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply enable, High active
+- vcc-supply: phandle of the regulator that provides the supply voltage
+  IOVCC , power supply for LCM (1.8V)
+- reset-gpios: phandle of gpio for reset line
+  This should be 8mA, gpio can be configured using mux, pinctrl, pinctrl-names
+  XRES, Reset, Low active
+- enable-gpios: phandle of gpio for enable line
+  LED_EN, LED backlight enable, High active
+
+Example:
+
+   vcc_1p8v: regulator-fixed@2 {
+   compatible = "regulator-fixed";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-name = "vcc_1p8v";
+   regulator-type = "voltage";
+   startup-delay-us = <0>;
+   gpio = <_gpio 23 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   regulator-boot-on;
+   };
+
+   tlmm_pinmux: pinctrl@80 {
+
+   dsi_panel_pinctrl: dsi-panel-pinctrl {
+   mux {
+   pins = "gpio54";
+   function = "gpio";
+   bias-pull-up;
+   drive-strength = <8>;
+   };
+   };
+   };
+
+   dsi0: qcom,mdss_dsi@470 {
+   panel@0 {
+   compatible = "jdi,lt070me05000";
+   reg = <0>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_panel_pinctrl>;
+
+   vddp-supply = <_l17>;
+   dcdc_en-supply = <_lvs7>;
+   vcc-supply = <_1p8v>;
+
+   reset-gpios = <_pinmux 54 0>;
+   enable-gpios = <_gpio 36 GPIO_ACTIVE_HIGH>;
+   };
+   };
-- 
2.1.2



[RESEND] [PATCH 1/4] dt-bindings: Add Japan Display Inc vendor id

2016-07-31 Thread Vinay Simha BN
Add vendor id for Japan Display Inc.

Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: John Stultz <john.stu...@linaro.org>
Cc: Thierry Reding <thierry.red...@gmail.com>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
Acked-by: Rob Herring <r...@kernel.org>
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index ecc8cf4..1b134f3 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -138,6 +138,7 @@ invensense  InvenSense Inc.
 isee   ISEE 2007 S.L.
 isil   Intersil
 issi   Integrated Silicon Solutions Inc.
+jdiJapan Display Inc.
 jedec  JEDEC Solid State Technology Association
 karo   Ka-Ro electronics GmbH
 keymileKeymile GmbH
-- 
2.1.2



[RESEND] [PATCH 1/4] dt-bindings: Add Japan Display Inc vendor id

2016-07-31 Thread Vinay Simha BN
Add vendor id for Japan Display Inc.

Cc: Archit Taneja 
Cc: John Stultz 
Cc: Thierry Reding 
Cc: Sumit Semwal 
Signed-off-by: Vinay Simha BN 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index ecc8cf4..1b134f3 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -138,6 +138,7 @@ invensense  InvenSense Inc.
 isee   ISEE 2007 S.L.
 isil   Intersil
 issi   Integrated Silicon Solutions Inc.
+jdiJapan Display Inc.
 jedec  JEDEC Solid State Technology Association
 karo   Ka-Ro electronics GmbH
 keymileKeymile GmbH
-- 
2.1.2



[RESEND] [PATCH v9 4/4] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-07-31 Thread Vinay Simha BN
Add support for the JDI LT070ME05000 WUXGA DSI panel used in
Nexus 7 2013 devices.

Programming sequence for the panel is was originally found in the
android-msm-flo-3.4-lollipop-release branch from:
https://android.googlesource.com/kernel/msm.git

And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
file in:
git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27

Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: Rob Clark <robdcl...@gmail.com>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Cc: John Stultz <john.stu...@linaro.org>
Cc: Emil Velikov <emil.l.veli...@gmail.com>
Cc: Thierry Reding <thierry.red...@gmail.com>
Cc: David Airlie <airl...@linux.ie>
Signed-off-by: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: John Stultz <john.stu...@linaro.org>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
Tested-by: John Stultz <john.stu...@linaro.org>
Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com>

---
v1:
 * sumit ported to drm/panel framework, john cherry-picked to mainline,
   folded down other fixes from Vinay and Archit, vinay removed interface
   setting cmd mode, video mode panel selected

v2:
 * incorporated code reviews from theiry, archit
   code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
   arrays of u8, generic helper function, documentation bindings,

v3:
 * dcs backlight support added
 * tested this panel driver in nexus7 2013 device

v4:
 * backlight interface added in the panel driver
 * incorporated width_mm and height_mm suggested by rob herring

v5:
 * theirry review comments incorporated
   panel model naming consistent, alphabetical soring in Kconfig
   Makefile, MAX_BRIGHTNESS dropped, regulator_names, parameterize
   panel width and height, descprition for control display, cabc
   and interface setting, temporary variable removed, consistent
   error reporting and commit message
 * removed tear on/off, scanline, since these are required only
   for command mode panels

v6:
 * emil review comments incorporated
   PANEL_NUM_REGULATORS dropped, return ret added at necessary
   places, if checks dropped for backlight and gpios

v7:
 * emil review comments incorporated
   added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
   gpios checks dropped.
   some returns cannot be dropped, since drm panel framework return
   type required.

v8:
 * emil review commnets incorporated for jdi_panel_unprepare,
   dropped the returns (ref: panel-sharp-lq101r1sx01.c) and
   for jdi_panel_prepare(panel_on) it does not return prematurely
   and goes to poweroff if not success
 * few dev_err's for panel_init

v9:
 * function drm_panel_create_dsi_backlight made as static
---
 drivers/gpu/drm/panel/Kconfig  |  11 +
 drivers/gpu/drm/panel/Makefile |   1 +
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 518 +
 3 files changed, 530 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 1500ab9..62aba97 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -18,6 +18,17 @@ config DRM_PANEL_SIMPLE
  that it can be automatically turned off when the panel goes into a
  low power state.
 
+config DRM_PANEL_JDI_LT070ME05000
+   tristate "JDI LT070ME05000 WUXGA DSI panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for JDI DSI video mode
+ panel as found in Google Nexus 7 (2013) devices.
+ The panel has a 1200(RGB)×1920 (WUXGA) resolution and uses
+ 24 bit per pixel.
+
 config DRM_PANEL_SAMSUNG_LD9040
tristate "Samsung LD9040 RGB/SPI panel"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index f277eed..a5c7ec0 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
+obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
 obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += 
panel-panasonic-vvx10f034n00.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c 
b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
new file mode 100644
index 000..517fa89
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -0,0 +1,518 @@
+/*
+ * Copyright (C) 2016 InforceComputing
+ * Author: Vinay Simha BN <simha...@gmail.com>
+ *
+ * Copyright (C) 2016 Linaro Ltd
+ * Author: Sumit Semwal <sumit.sem...@linaro.org>
+ *
+ * From internet archives, the panel for Nexus 7 2nd Gen, 2013 model is a
+ * JDI model

[RESEND] [PATCH v9 4/4] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-07-31 Thread Vinay Simha BN
Add support for the JDI LT070ME05000 WUXGA DSI panel used in
Nexus 7 2013 devices.

Programming sequence for the panel is was originally found in the
android-msm-flo-3.4-lollipop-release branch from:
https://android.googlesource.com/kernel/msm.git

And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
file in:
git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27

Cc: Archit Taneja 
Cc: Rob Clark 
Cc: Sumit Semwal 
Cc: John Stultz 
Cc: Emil Velikov 
Cc: Thierry Reding 
Cc: David Airlie 
Signed-off-by: Sumit Semwal 
Signed-off-by: John Stultz 
Signed-off-by: Vinay Simha BN 
Tested-by: John Stultz 
Reviewed-by: Emil Velikov 

---
v1:
 * sumit ported to drm/panel framework, john cherry-picked to mainline,
   folded down other fixes from Vinay and Archit, vinay removed interface
   setting cmd mode, video mode panel selected

v2:
 * incorporated code reviews from theiry, archit
   code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
   arrays of u8, generic helper function, documentation bindings,

v3:
 * dcs backlight support added
 * tested this panel driver in nexus7 2013 device

v4:
 * backlight interface added in the panel driver
 * incorporated width_mm and height_mm suggested by rob herring

v5:
 * theirry review comments incorporated
   panel model naming consistent, alphabetical soring in Kconfig
   Makefile, MAX_BRIGHTNESS dropped, regulator_names, parameterize
   panel width and height, descprition for control display, cabc
   and interface setting, temporary variable removed, consistent
   error reporting and commit message
 * removed tear on/off, scanline, since these are required only
   for command mode panels

v6:
 * emil review comments incorporated
   PANEL_NUM_REGULATORS dropped, return ret added at necessary
   places, if checks dropped for backlight and gpios

v7:
 * emil review comments incorporated
   added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
   gpios checks dropped.
   some returns cannot be dropped, since drm panel framework return
   type required.

v8:
 * emil review commnets incorporated for jdi_panel_unprepare,
   dropped the returns (ref: panel-sharp-lq101r1sx01.c) and
   for jdi_panel_prepare(panel_on) it does not return prematurely
   and goes to poweroff if not success
 * few dev_err's for panel_init

v9:
 * function drm_panel_create_dsi_backlight made as static
---
 drivers/gpu/drm/panel/Kconfig  |  11 +
 drivers/gpu/drm/panel/Makefile |   1 +
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 518 +
 3 files changed, 530 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 1500ab9..62aba97 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -18,6 +18,17 @@ config DRM_PANEL_SIMPLE
  that it can be automatically turned off when the panel goes into a
  low power state.
 
+config DRM_PANEL_JDI_LT070ME05000
+   tristate "JDI LT070ME05000 WUXGA DSI panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for JDI DSI video mode
+ panel as found in Google Nexus 7 (2013) devices.
+ The panel has a 1200(RGB)×1920 (WUXGA) resolution and uses
+ 24 bit per pixel.
+
 config DRM_PANEL_SAMSUNG_LD9040
tristate "Samsung LD9040 RGB/SPI panel"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index f277eed..a5c7ec0 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
+obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
 obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += 
panel-panasonic-vvx10f034n00.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c 
b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
new file mode 100644
index 000..517fa89
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -0,0 +1,518 @@
+/*
+ * Copyright (C) 2016 InforceComputing
+ * Author: Vinay Simha BN 
+ *
+ * Copyright (C) 2016 Linaro Ltd
+ * Author: Sumit Semwal 
+ *
+ * From internet archives, the panel for Nexus 7 2nd Gen, 2013 model is a
+ * JDI model LT070ME05000, and its data sheet is at:
+ * http://panelone.net/en/7-0-inch/JDI_LT070ME05000_7.0_inch-datasheet
+ *
+ * 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; witho

Re: [PATCH v3 1/2] drm/dsi: Implement dcs set/get display brightness

2016-07-19 Thread Vinay Simha
just to be inline with the existing code (funcs:
mipi_dsi_dcs_get_power_mode, mipi_dsi_dcs_get_pixel_format) in
drivers/gpu/drm/drm_mipi_dsi.c followed the same for
mipi_dsi_dcs_get_display_brightness

We may need to change as you suggested for other two functions also.
please suggest.




On Tue, Jul 19, 2016 at 3:00 PM, Sean Paul <seanp...@google.com> wrote:
> On Mon, Jul 18, 2016 at 4:28 AM, Vinay Simha BN <simha...@gmail.com> wrote:
>> Provide a small convenience wrapper that set/get the
>> display brightness value
>>
>> Cc: John Stultz <john.stu...@linaro.org>
>> Cc: Sumit Semwal <sumit.sem...@linaro.org>
>> Cc: Archit Taneja <archit.tan...@gmail.com>
>> Cc: Rob Clark <robdcl...@gmail.com>
>> Cc: Jani Nikula <jani.nik...@linux.intel.com>
>> Cc: Thierry Reding <thierry.red...@gmail.com>
>> Cc: Emil Velikov <emil.l.veli...@gmail.com>
>> Signed-off-by: Vinay Simha BN <simha...@gmail.com>
>>
>> ---
>> v1:
>>  *tested in nexus7 2nd gen.
>>
>> v2:
>>  * implemented jani review comments
>>-functions name mapped accordingly
>>-bl value increased from 0xff to 0x
>>-backlight interface will be handled in panel driver,
>> so it is moved from the mipi_dsi helper function
>>
>> v3:
>>  * emil review comments
>>(err < 0) supposed to be (err <= 0)
>> ---
>>  drivers/gpu/drm/drm_mipi_dsi.c | 49 
>> ++
>>  include/drm/drm_mipi_dsi.h |  4 
>>  2 files changed, 53 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
>> index af0d471..43aa743 100644
>> --- a/drivers/gpu/drm/drm_mipi_dsi.c
>> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
>> @@ -1041,6 +1041,55 @@ int mipi_dsi_dcs_set_pixel_format(struct 
>> mipi_dsi_device *dsi, u8 format)
>>  }
>>  EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format);
>>
>> +/**
>> + * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
>> + * of the display
>> + * @dsi: DSI peripheral device
>> + * @brightness: brightness value
>> + *
>> + * Return: 0 on success or a negative error code on failure.
>> + */
>> +int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
>> +   u16 *brightness)
>> +{
>> +   ssize_t err;
>> +
>> +   err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
>> +   brightness, sizeof(*brightness));
>> +   if (err <= 0) {
>> +   if (err == 0)
>> +   err = -ENODATA;
>> +
>> +   return err;
>> +   }
>> +
>> +   return 0;
>
> IMO, this is still pretty awkward. I think the following is a bit more
> conventional:
>
> err = mipi_dsi_dcs_...
> if (err == 0)
> return -ENODATA;
> else if (err < 0)
> return err;
>
> return 0;
>
>> +}
>> +EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness);
>> +
>> +/**
>> + * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of
>> + * the display
>> + * @dsi: DSI peripheral device
>> + * @brightness: brightness value
>> + *
>> + * Return: 0 on success or a negative error code on failure.
>> + */
>> +int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
>> +   u16 brightness)
>> +{
>> +   ssize_t err;
>> +   u8 bl_value[2] = { brightness & 0xff, brightness >> 8 };
>> +
>> +   err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
>> +bl_value, sizeof(bl_value));
>> +   if (err < 0)
>> +   return err;
>> +
>> +   return 0;
>> +}
>> +EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness);
>> +
>>  static int mipi_dsi_drv_probe(struct device *dev)
>>  {
>> struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
>> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
>> index 47ac925..404c373 100644
>> --- a/include/drm/drm_mipi_dsi.h
>> +++ b/include/drm/drm_mipi_dsi.h
>> @@ -270,6 +270,10 @@ int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device 
>> *dsi);
>>  int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
>>  enum mipi_dsi_dcs_tear_mode mode);
>>  int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
>> +int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
>> +   u16 *brightness);
>> +int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
>> +   u16 brightness);
>>
>>  /**
>>   * struct mipi_dsi_driver - DSI driver
>> --
>> 2.1.2
>>



-- 
Regards,

Vinay Simha.B.N.


Re: [PATCH v3 1/2] drm/dsi: Implement dcs set/get display brightness

2016-07-19 Thread Vinay Simha
just to be inline with the existing code (funcs:
mipi_dsi_dcs_get_power_mode, mipi_dsi_dcs_get_pixel_format) in
drivers/gpu/drm/drm_mipi_dsi.c followed the same for
mipi_dsi_dcs_get_display_brightness

We may need to change as you suggested for other two functions also.
please suggest.




On Tue, Jul 19, 2016 at 3:00 PM, Sean Paul  wrote:
> On Mon, Jul 18, 2016 at 4:28 AM, Vinay Simha BN  wrote:
>> Provide a small convenience wrapper that set/get the
>> display brightness value
>>
>> Cc: John Stultz 
>> Cc: Sumit Semwal 
>> Cc: Archit Taneja 
>> Cc: Rob Clark 
>> Cc: Jani Nikula 
>> Cc: Thierry Reding 
>> Cc: Emil Velikov 
>> Signed-off-by: Vinay Simha BN 
>>
>> ---
>> v1:
>>  *tested in nexus7 2nd gen.
>>
>> v2:
>>  * implemented jani review comments
>>-functions name mapped accordingly
>>-bl value increased from 0xff to 0x
>>-backlight interface will be handled in panel driver,
>> so it is moved from the mipi_dsi helper function
>>
>> v3:
>>  * emil review comments
>>(err < 0) supposed to be (err <= 0)
>> ---
>>  drivers/gpu/drm/drm_mipi_dsi.c | 49 
>> ++
>>  include/drm/drm_mipi_dsi.h |  4 
>>  2 files changed, 53 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
>> index af0d471..43aa743 100644
>> --- a/drivers/gpu/drm/drm_mipi_dsi.c
>> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
>> @@ -1041,6 +1041,55 @@ int mipi_dsi_dcs_set_pixel_format(struct 
>> mipi_dsi_device *dsi, u8 format)
>>  }
>>  EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format);
>>
>> +/**
>> + * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
>> + * of the display
>> + * @dsi: DSI peripheral device
>> + * @brightness: brightness value
>> + *
>> + * Return: 0 on success or a negative error code on failure.
>> + */
>> +int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
>> +   u16 *brightness)
>> +{
>> +   ssize_t err;
>> +
>> +   err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
>> +   brightness, sizeof(*brightness));
>> +   if (err <= 0) {
>> +   if (err == 0)
>> +   err = -ENODATA;
>> +
>> +   return err;
>> +   }
>> +
>> +   return 0;
>
> IMO, this is still pretty awkward. I think the following is a bit more
> conventional:
>
> err = mipi_dsi_dcs_...
> if (err == 0)
> return -ENODATA;
> else if (err < 0)
> return err;
>
> return 0;
>
>> +}
>> +EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness);
>> +
>> +/**
>> + * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of
>> + * the display
>> + * @dsi: DSI peripheral device
>> + * @brightness: brightness value
>> + *
>> + * Return: 0 on success or a negative error code on failure.
>> + */
>> +int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
>> +   u16 brightness)
>> +{
>> +   ssize_t err;
>> +   u8 bl_value[2] = { brightness & 0xff, brightness >> 8 };
>> +
>> +   err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
>> +bl_value, sizeof(bl_value));
>> +   if (err < 0)
>> +   return err;
>> +
>> +   return 0;
>> +}
>> +EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness);
>> +
>>  static int mipi_dsi_drv_probe(struct device *dev)
>>  {
>> struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
>> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
>> index 47ac925..404c373 100644
>> --- a/include/drm/drm_mipi_dsi.h
>> +++ b/include/drm/drm_mipi_dsi.h
>> @@ -270,6 +270,10 @@ int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device 
>> *dsi);
>>  int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
>>  enum mipi_dsi_dcs_tear_mode mode);
>>  int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
>> +int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
>> +   u16 *brightness);
>> +int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
>> +   u16 brightness);
>>
>>  /**
>>   * struct mipi_dsi_driver - DSI driver
>> --
>> 2.1.2
>>



-- 
Regards,

Vinay Simha.B.N.


[PATCH v8 2/2] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-07-18 Thread Vinay Simha BN
Add support for the JDI LT070ME05000 WUXGA DSI panel used in
Nexus 7 2013 devices.

Programming sequence for the panel is was originally found in the
android-msm-flo-3.4-lollipop-release branch from:
https://android.googlesource.com/kernel/msm.git

And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
file in:
git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27

Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: Rob Clark <robdcl...@gmail.com>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Cc: John Stultz <john.stu...@linaro.org>
Cc: Emil Velikov <emil.l.veli...@gmail.com>
Cc: Thierry Reding <thierry.red...@gmail.com>
Cc: David Airlie <airl...@linux.ie>
Signed-off-by: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: John Stultz <john.stu...@linaro.org>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
Tested-by: John Stultz <john.stu...@linaro.org>
Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com>

---
v1:
 * sumit ported to drm/panel framework, john cherry-picked to mainline,
   folded down other fixes from Vinay and Archit, vinay removed interface
   setting cmd mode, video mode panel selected

v2:
 * incorporated code reviews from theiry, archit
   code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
   arrays of u8, generic helper function, documentation bindings,

v3:
 * dcs backlight support added
 * tested this panel driver in nexus7 2013 device

v4:
 * backlight interface added in the panel driver
 * incorporated width_mm and height_mm suggested by rob herring

v5:
 * theirry review comments incorporated
   panel model naming consistent, alphabetical soring in Kconfig
   Makefile, MAX_BRIGHTNESS dropped, regulator_names, parameterize
   panel width and height, descprition for control display, cabc
   and interface setting, temporary variable removed, consistent
   error reporting and commit message
 * removed tear on/off, scanline, since these are required only
   for command mode panels

v6:
 * emil review comments incorporated
   PANEL_NUM_REGULATORS dropped, return ret added at necessary
   places, if checks dropped for backlight and gpios

v7:
 * emil review comments incorporated
   added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
   gpios checks dropped.
   some returns cannot be dropped, since drm panel framework return
   type required.

v8:
 * emil review commnets incorporated for jdi_panel_unprepare,
   dropped the returns (ref: panel-sharp-lq101r1sx01.c) and
   for jdi_panel_prepare(panel_on) it does not return prematurely
   and goes to poweroff if not success
 * few dev_err's for panel_init
---
 drivers/gpu/drm/panel/Kconfig  |  11 +
 drivers/gpu/drm/panel/Makefile |   1 +
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 518 +
 3 files changed, 530 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 1500ab9..62aba97 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -18,6 +18,17 @@ config DRM_PANEL_SIMPLE
  that it can be automatically turned off when the panel goes into a
  low power state.
 
+config DRM_PANEL_JDI_LT070ME05000
+   tristate "JDI LT070ME05000 WUXGA DSI panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for JDI DSI video mode
+ panel as found in Google Nexus 7 (2013) devices.
+ The panel has a 1200(RGB)×1920 (WUXGA) resolution and uses
+ 24 bit per pixel.
+
 config DRM_PANEL_SAMSUNG_LD9040
tristate "Samsung LD9040 RGB/SPI panel"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index f277eed..a5c7ec0 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
+obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
 obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += 
panel-panasonic-vvx10f034n00.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c 
b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
new file mode 100644
index 000..3af35ad
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -0,0 +1,518 @@
+/*
+ * Copyright (C) 2016 InforceComputing
+ * Author: Vinay Simha BN <simha...@gmail.com>
+ *
+ * Copyright (C) 2016 Linaro Ltd
+ * Author: Sumit Semwal <sumit.sem...@linaro.org>
+ *
+ * From internet archives, the panel for Nexus 7 2nd Gen, 2013 model is a
+ * JDI model LT070ME05000, and its data sheet is at:
+ * http://panelone

[PATCH v8 2/2] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-07-18 Thread Vinay Simha BN
Add support for the JDI LT070ME05000 WUXGA DSI panel used in
Nexus 7 2013 devices.

Programming sequence for the panel is was originally found in the
android-msm-flo-3.4-lollipop-release branch from:
https://android.googlesource.com/kernel/msm.git

And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
file in:
git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27

Cc: Archit Taneja 
Cc: Rob Clark 
Cc: Sumit Semwal 
Cc: John Stultz 
Cc: Emil Velikov 
Cc: Thierry Reding 
Cc: David Airlie 
Signed-off-by: Sumit Semwal 
Signed-off-by: John Stultz 
Signed-off-by: Vinay Simha BN 
Tested-by: John Stultz 
Reviewed-by: Emil Velikov 

---
v1:
 * sumit ported to drm/panel framework, john cherry-picked to mainline,
   folded down other fixes from Vinay and Archit, vinay removed interface
   setting cmd mode, video mode panel selected

v2:
 * incorporated code reviews from theiry, archit
   code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
   arrays of u8, generic helper function, documentation bindings,

v3:
 * dcs backlight support added
 * tested this panel driver in nexus7 2013 device

v4:
 * backlight interface added in the panel driver
 * incorporated width_mm and height_mm suggested by rob herring

v5:
 * theirry review comments incorporated
   panel model naming consistent, alphabetical soring in Kconfig
   Makefile, MAX_BRIGHTNESS dropped, regulator_names, parameterize
   panel width and height, descprition for control display, cabc
   and interface setting, temporary variable removed, consistent
   error reporting and commit message
 * removed tear on/off, scanline, since these are required only
   for command mode panels

v6:
 * emil review comments incorporated
   PANEL_NUM_REGULATORS dropped, return ret added at necessary
   places, if checks dropped for backlight and gpios

v7:
 * emil review comments incorporated
   added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
   gpios checks dropped.
   some returns cannot be dropped, since drm panel framework return
   type required.

v8:
 * emil review commnets incorporated for jdi_panel_unprepare,
   dropped the returns (ref: panel-sharp-lq101r1sx01.c) and
   for jdi_panel_prepare(panel_on) it does not return prematurely
   and goes to poweroff if not success
 * few dev_err's for panel_init
---
 drivers/gpu/drm/panel/Kconfig  |  11 +
 drivers/gpu/drm/panel/Makefile |   1 +
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 518 +
 3 files changed, 530 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 1500ab9..62aba97 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -18,6 +18,17 @@ config DRM_PANEL_SIMPLE
  that it can be automatically turned off when the panel goes into a
  low power state.
 
+config DRM_PANEL_JDI_LT070ME05000
+   tristate "JDI LT070ME05000 WUXGA DSI panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for JDI DSI video mode
+ panel as found in Google Nexus 7 (2013) devices.
+ The panel has a 1200(RGB)×1920 (WUXGA) resolution and uses
+ 24 bit per pixel.
+
 config DRM_PANEL_SAMSUNG_LD9040
tristate "Samsung LD9040 RGB/SPI panel"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index f277eed..a5c7ec0 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
+obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
 obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += 
panel-panasonic-vvx10f034n00.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c 
b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
new file mode 100644
index 000..3af35ad
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -0,0 +1,518 @@
+/*
+ * Copyright (C) 2016 InforceComputing
+ * Author: Vinay Simha BN 
+ *
+ * Copyright (C) 2016 Linaro Ltd
+ * Author: Sumit Semwal 
+ *
+ * From internet archives, the panel for Nexus 7 2nd Gen, 2013 model is a
+ * JDI model LT070ME05000, and its data sheet is at:
+ * http://panelone.net/en/7-0-inch/JDI_LT070ME05000_7.0_inch-datasheet
+ *
+ * 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 FO

[PATCH v3 1/2] drm/dsi: Implement dcs set/get display brightness

2016-07-18 Thread Vinay Simha BN
Provide a small convenience wrapper that set/get the
display brightness value

Cc: John Stultz <john.stu...@linaro.org>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: Rob Clark <robdcl...@gmail.com>
Cc: Jani Nikula <jani.nik...@linux.intel.com>
Cc: Thierry Reding <thierry.red...@gmail.com>
Cc: Emil Velikov <emil.l.veli...@gmail.com>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>

---
v1:
 *tested in nexus7 2nd gen.

v2:
 * implemented jani review comments
   -functions name mapped accordingly
   -bl value increased from 0xff to 0x
   -backlight interface will be handled in panel driver,
so it is moved from the mipi_dsi helper function

v3:
 * emil review comments
   (err < 0) supposed to be (err <= 0)
---
 drivers/gpu/drm/drm_mipi_dsi.c | 49 ++
 include/drm/drm_mipi_dsi.h |  4 
 2 files changed, 53 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index af0d471..43aa743 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -1041,6 +1041,55 @@ int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device 
*dsi, u8 format)
 }
 EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format);
 
+/**
+ * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
+ * of the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
+   u16 *brightness)
+{
+   ssize_t err;
+
+   err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
+   brightness, sizeof(*brightness));
+   if (err <= 0) {
+   if (err == 0)
+   err = -ENODATA;
+
+   return err;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness);
+
+/**
+ * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of
+ * the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
+   u16 brightness)
+{
+   ssize_t err;
+   u8 bl_value[2] = { brightness & 0xff, brightness >> 8 };
+
+   err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
+bl_value, sizeof(bl_value));
+   if (err < 0)
+   return err;
+
+   return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness);
+
 static int mipi_dsi_drv_probe(struct device *dev)
 {
struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 47ac925..404c373 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -270,6 +270,10 @@ int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
 int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
 enum mipi_dsi_dcs_tear_mode mode);
 int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
+int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
+   u16 *brightness);
+int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
+   u16 brightness);
 
 /**
  * struct mipi_dsi_driver - DSI driver
-- 
2.1.2



[PATCH v3 1/2] drm/dsi: Implement dcs set/get display brightness

2016-07-18 Thread Vinay Simha BN
Provide a small convenience wrapper that set/get the
display brightness value

Cc: John Stultz 
Cc: Sumit Semwal 
Cc: Archit Taneja 
Cc: Rob Clark 
Cc: Jani Nikula 
Cc: Thierry Reding 
Cc: Emil Velikov 
Signed-off-by: Vinay Simha BN 

---
v1:
 *tested in nexus7 2nd gen.

v2:
 * implemented jani review comments
   -functions name mapped accordingly
   -bl value increased from 0xff to 0x
   -backlight interface will be handled in panel driver,
so it is moved from the mipi_dsi helper function

v3:
 * emil review comments
   (err < 0) supposed to be (err <= 0)
---
 drivers/gpu/drm/drm_mipi_dsi.c | 49 ++
 include/drm/drm_mipi_dsi.h |  4 
 2 files changed, 53 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index af0d471..43aa743 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -1041,6 +1041,55 @@ int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device 
*dsi, u8 format)
 }
 EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format);
 
+/**
+ * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
+ * of the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
+   u16 *brightness)
+{
+   ssize_t err;
+
+   err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
+   brightness, sizeof(*brightness));
+   if (err <= 0) {
+   if (err == 0)
+   err = -ENODATA;
+
+   return err;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness);
+
+/**
+ * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of
+ * the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
+   u16 brightness)
+{
+   ssize_t err;
+   u8 bl_value[2] = { brightness & 0xff, brightness >> 8 };
+
+   err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
+bl_value, sizeof(bl_value));
+   if (err < 0)
+   return err;
+
+   return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness);
+
 static int mipi_dsi_drv_probe(struct device *dev)
 {
struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 47ac925..404c373 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -270,6 +270,10 @@ int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
 int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
 enum mipi_dsi_dcs_tear_mode mode);
 int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
+int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
+   u16 *brightness);
+int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
+   u16 brightness);
 
 /**
  * struct mipi_dsi_driver - DSI driver
-- 
2.1.2



[PATCH 1/4] dt-bindings: Add Japan Display Inc vendor id

2016-07-13 Thread Vinay Simha BN
Add vendor id for Japan Display Inc.

Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: John Stultz <john.stu...@linaro.org>
Cc: Thierry Reding <thierry.red...@gmail.com>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
Acked-by: Rob Herring <r...@kernel.org>
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index ecc8cf4..1b134f3 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -138,6 +138,7 @@ invensense  InvenSense Inc.
 isee   ISEE 2007 S.L.
 isil   Intersil
 issi   Integrated Silicon Solutions Inc.
+jdiJapan Display Inc.
 jedec  JEDEC Solid State Technology Association
 karo   Ka-Ro electronics GmbH
 keymileKeymile GmbH
-- 
1.9.1



[PATCH 1/4] dt-bindings: Add Japan Display Inc vendor id

2016-07-13 Thread Vinay Simha BN
Add vendor id for Japan Display Inc.

Cc: Archit Taneja 
Cc: John Stultz 
Cc: Thierry Reding 
Cc: Sumit Semwal 
Signed-off-by: Vinay Simha BN 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index ecc8cf4..1b134f3 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -138,6 +138,7 @@ invensense  InvenSense Inc.
 isee   ISEE 2007 S.L.
 isil   Intersil
 issi   Integrated Silicon Solutions Inc.
+jdiJapan Display Inc.
 jedec  JEDEC Solid State Technology Association
 karo   Ka-Ro electronics GmbH
 keymileKeymile GmbH
-- 
1.9.1



[PATCH v8 4/4] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-07-13 Thread Vinay Simha BN
Add support for the JDI LT070ME05000 WUXGA DSI panel used in
Nexus 7 2013 devices.

Programming sequence for the panel is was originally found in the
android-msm-flo-3.4-lollipop-release branch from:
https://android.googlesource.com/kernel/msm.git

And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
file in:
git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27

Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: Rob Clark <robdcl...@gmail.com>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Cc: John Stultz <john.stu...@linaro.org>
Cc: Emil Velikov <emil.l.veli...@gmail.com>
Cc: Thierry Reding <thierry.red...@gmail.com>
Cc: David Airlie <airl...@linux.ie>
Signed-off-by: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: John Stultz <john.stu...@linaro.org>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>

---
v1:
 * sumit ported to drm/panel framework, john cherry-picked to mainline,
   folded down other fixes from Vinay and Archit, vinay removed interface
   setting cmd mode, video mode panel selected

v2:
 * incorporated code reviews from theiry, archit
   code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
   arrays of u8, generic helper function, documentation bindings,

v3:
 * dcs backlight support added
 * tested this panel driver in nexus7 2013 device

v4:
 * backlight interface added in the panel driver
 * incorporated width_mm and height_mm suggested by rob herring

v5:
 * theirry review comments incorporated
   panel model naming consistent, alphabetical soring in Kconfig
   Makefile, MAX_BRIGHTNESS dropped, regulator_names, parameterize
   panel width and height, descprition for control display, cabc
   and interface setting, temporary variable removed, consistent
   error reporting and commit message
 * removed tear on/off, scanline, since these are required only
   for command mode panels

v6:
 * emil review comments incorporated
   PANEL_NUM_REGULATORS dropped, return ret added at necessary
   places, if checks dropped for backlight and gpios

v7:
 * emil review comments incorporated
   added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
   gpios checks dropped.
   some returns cannot be dropped, since drm panel framework return
   type required.

v8:
 * emil review commnets incorporated for jdi_panel_unprepare,
   dropped the returns (ref: panel-sharp-lq101r1sx01.c) and
   for jdi_panel_prepare(panel_on) it does not return prematurely
   and goes to poweroff if not success
 * few dev_err's for panel_init
---
 drivers/gpu/drm/panel/Kconfig  |  11 +
 drivers/gpu/drm/panel/Makefile |   1 +
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 518 +
 3 files changed, 530 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 1500ab9..62aba97 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -18,6 +18,17 @@ config DRM_PANEL_SIMPLE
  that it can be automatically turned off when the panel goes into a
  low power state.
 
+config DRM_PANEL_JDI_LT070ME05000
+   tristate "JDI LT070ME05000 WUXGA DSI panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for JDI DSI video mode
+ panel as found in Google Nexus 7 (2013) devices.
+ The panel has a 1200(RGB)×1920 (WUXGA) resolution and uses
+ 24 bit per pixel.
+
 config DRM_PANEL_SAMSUNG_LD9040
tristate "Samsung LD9040 RGB/SPI panel"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index f277eed..a5c7ec0 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
+obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
 obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += 
panel-panasonic-vvx10f034n00.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c 
b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
new file mode 100644
index 000..d54c472
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -0,0 +1,518 @@
+/*
+ * Copyright (C) 2016 InforceComputing
+ * Author: Vinay Simha BN <simha...@gmail.com>
+ *
+ * Copyright (C) 2016 Linaro Ltd
+ * Author: Sumit Semwal <sumit.sem...@linaro.org>
+ *
+ * From internet archives, the panel for Nexus 7 2nd Gen, 2013 model is a
+ * JDI model LT070ME05000, and its data sheet is at:
+ * http://panelone.net/en/7-0-inch/JDI_LT070ME05000_7.0_inch-datasheet
+ *
+ * This program is free software; you can redistrib

[PATCH v2 3/4] drm/dsi: Implement dcs set/get display brightness

2016-07-13 Thread Vinay Simha BN
Provide a small convenience wrapper that set/get the
display brightness value

Cc: John Stultz <john.stu...@linaro.org>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: Rob Clark <robdcl...@gmail.com>
Cc: Jani Nikula <jani.nik...@linux.intel.com>
Cc: Thierry Reding <thierry.red...@gmail.com>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>

---
v1:
 *tested in nexus7 2nd gen.

v2:
 * implemented jani review comments
   -functions name mapped accordingly
   -bl value increased from 0xff to 0x
   -backlight interface will be handled in panel driver,
so it is moved from the mipi_dsi helper function
---
 drivers/gpu/drm/drm_mipi_dsi.c | 49 ++
 include/drm/drm_mipi_dsi.h |  4 
 2 files changed, 53 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index af0d471..7c22f64 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -1041,6 +1041,55 @@ int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device 
*dsi, u8 format)
 }
 EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format);
 
+/**
+ * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
+ * of the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
+   u16 *brightness)
+{
+   ssize_t err;
+
+   err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
+   brightness, sizeof(*brightness));
+   if (err < 0) {
+   if (err == 0)
+   err = -ENODATA;
+
+   return err;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness);
+
+/**
+ * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of
+ * the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
+   u16 brightness)
+{
+   ssize_t err;
+   u8 bl_value[2] = { brightness & 0xff, brightness >> 8 };
+
+   err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
+bl_value, sizeof(bl_value));
+   if (err < 0)
+   return err;
+
+   return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness);
+
 static int mipi_dsi_drv_probe(struct device *dev)
 {
struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 47ac925..404c373 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -270,6 +270,10 @@ int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
 int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
 enum mipi_dsi_dcs_tear_mode mode);
 int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
+int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
+   u16 *brightness);
+int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
+   u16 brightness);
 
 /**
  * struct mipi_dsi_driver - DSI driver
-- 
1.9.1



[PATCH v2 3/4] drm/dsi: Implement dcs set/get display brightness

2016-07-13 Thread Vinay Simha BN
Provide a small convenience wrapper that set/get the
display brightness value

Cc: John Stultz 
Cc: Sumit Semwal 
Cc: Archit Taneja 
Cc: Rob Clark 
Cc: Jani Nikula 
Cc: Thierry Reding 
Signed-off-by: Vinay Simha BN 

---
v1:
 *tested in nexus7 2nd gen.

v2:
 * implemented jani review comments
   -functions name mapped accordingly
   -bl value increased from 0xff to 0x
   -backlight interface will be handled in panel driver,
so it is moved from the mipi_dsi helper function
---
 drivers/gpu/drm/drm_mipi_dsi.c | 49 ++
 include/drm/drm_mipi_dsi.h |  4 
 2 files changed, 53 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index af0d471..7c22f64 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -1041,6 +1041,55 @@ int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device 
*dsi, u8 format)
 }
 EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format);
 
+/**
+ * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
+ * of the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
+   u16 *brightness)
+{
+   ssize_t err;
+
+   err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
+   brightness, sizeof(*brightness));
+   if (err < 0) {
+   if (err == 0)
+   err = -ENODATA;
+
+   return err;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness);
+
+/**
+ * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of
+ * the display
+ * @dsi: DSI peripheral device
+ * @brightness: brightness value
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
+   u16 brightness)
+{
+   ssize_t err;
+   u8 bl_value[2] = { brightness & 0xff, brightness >> 8 };
+
+   err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
+bl_value, sizeof(bl_value));
+   if (err < 0)
+   return err;
+
+   return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness);
+
 static int mipi_dsi_drv_probe(struct device *dev)
 {
struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 47ac925..404c373 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -270,6 +270,10 @@ int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
 int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
 enum mipi_dsi_dcs_tear_mode mode);
 int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
+int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
+   u16 *brightness);
+int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
+   u16 brightness);
 
 /**
  * struct mipi_dsi_driver - DSI driver
-- 
1.9.1



[PATCH v8 4/4] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-07-13 Thread Vinay Simha BN
Add support for the JDI LT070ME05000 WUXGA DSI panel used in
Nexus 7 2013 devices.

Programming sequence for the panel is was originally found in the
android-msm-flo-3.4-lollipop-release branch from:
https://android.googlesource.com/kernel/msm.git

And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
file in:
git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27

Cc: Archit Taneja 
Cc: Rob Clark 
Cc: Sumit Semwal 
Cc: John Stultz 
Cc: Emil Velikov 
Cc: Thierry Reding 
Cc: David Airlie 
Signed-off-by: Sumit Semwal 
Signed-off-by: John Stultz 
Signed-off-by: Vinay Simha BN 

---
v1:
 * sumit ported to drm/panel framework, john cherry-picked to mainline,
   folded down other fixes from Vinay and Archit, vinay removed interface
   setting cmd mode, video mode panel selected

v2:
 * incorporated code reviews from theiry, archit
   code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
   arrays of u8, generic helper function, documentation bindings,

v3:
 * dcs backlight support added
 * tested this panel driver in nexus7 2013 device

v4:
 * backlight interface added in the panel driver
 * incorporated width_mm and height_mm suggested by rob herring

v5:
 * theirry review comments incorporated
   panel model naming consistent, alphabetical soring in Kconfig
   Makefile, MAX_BRIGHTNESS dropped, regulator_names, parameterize
   panel width and height, descprition for control display, cabc
   and interface setting, temporary variable removed, consistent
   error reporting and commit message
 * removed tear on/off, scanline, since these are required only
   for command mode panels

v6:
 * emil review comments incorporated
   PANEL_NUM_REGULATORS dropped, return ret added at necessary
   places, if checks dropped for backlight and gpios

v7:
 * emil review comments incorporated
   added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
   gpios checks dropped.
   some returns cannot be dropped, since drm panel framework return
   type required.

v8:
 * emil review commnets incorporated for jdi_panel_unprepare,
   dropped the returns (ref: panel-sharp-lq101r1sx01.c) and
   for jdi_panel_prepare(panel_on) it does not return prematurely
   and goes to poweroff if not success
 * few dev_err's for panel_init
---
 drivers/gpu/drm/panel/Kconfig  |  11 +
 drivers/gpu/drm/panel/Makefile |   1 +
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 518 +
 3 files changed, 530 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 1500ab9..62aba97 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -18,6 +18,17 @@ config DRM_PANEL_SIMPLE
  that it can be automatically turned off when the panel goes into a
  low power state.
 
+config DRM_PANEL_JDI_LT070ME05000
+   tristate "JDI LT070ME05000 WUXGA DSI panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for JDI DSI video mode
+ panel as found in Google Nexus 7 (2013) devices.
+ The panel has a 1200(RGB)×1920 (WUXGA) resolution and uses
+ 24 bit per pixel.
+
 config DRM_PANEL_SAMSUNG_LD9040
tristate "Samsung LD9040 RGB/SPI panel"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index f277eed..a5c7ec0 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
+obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
 obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += 
panel-panasonic-vvx10f034n00.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c 
b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
new file mode 100644
index 000..d54c472
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -0,0 +1,518 @@
+/*
+ * Copyright (C) 2016 InforceComputing
+ * Author: Vinay Simha BN 
+ *
+ * Copyright (C) 2016 Linaro Ltd
+ * Author: Sumit Semwal 
+ *
+ * From internet archives, the panel for Nexus 7 2nd Gen, 2013 model is a
+ * JDI model LT070ME05000, and its data sheet is at:
+ * http://panelone.net/en/7-0-inch/JDI_LT070ME05000_7.0_inch-datasheet
+ *
+ * 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 

[PATCH v2 2/4] dt-bindings: Add jdi lt070me05000 panel bindings

2016-07-13 Thread Vinay Simha BN
Add documentation for lt070me05000 panel

Cc: Archit Taneja <archit.tan...@gmail.com>
Cc: John Stultz <john.stu...@linaro.org>
Cc: Thierry Reding <thierry.red...@gmail.com>
Cc: Sumit Semwal <sumit.sem...@linaro.org>
Signed-off-by: Vinay Simha BN <simha...@gmail.com>
Acked-by: Rob Herring <r...@kernel.org>

---
v2:
 * incorporated rob herring and thierry reviews
   gpio to gpios, gpio to regulator using fixed regulators
   and pwm backlight is removed, since it is controlled by
   dcs commands
---
 .../bindings/display/panel/jdi,lt070me05000.txt| 57 ++
 1 file changed, 57 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
new file mode 100644
index 000..613b76f
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
@@ -0,0 +1,57 @@
+JDI model LT070ME05000 1200x1920 7" DSI Panel
+
+Required properties:
+- compatible: should be "jdi,lt070me05000"
+- vddp-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply (3-5V)
+- dcdc_en-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply enable, High active
+- vcc-supply: phandle of the regulator that provides the supply voltage
+  IOVCC , power supply for LCM (1.8V)
+- reset-gpios: phandle of gpio for reset line
+  This should be 8mA, gpio can be configured using mux, pinctrl, pinctrl-names
+  XRES, Reset, Low active
+- enable-gpios: phandle of gpio for enable line
+  LED_EN, LED backlight enable, High active
+
+Example:
+
+   vcc_1p8v: regulator-fixed@2 {
+   compatible = "regulator-fixed";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-name = "vcc_1p8v";
+   regulator-type = "voltage";
+   startup-delay-us = <0>;
+   gpio = <_gpio 23 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   regulator-boot-on;
+   };
+
+   tlmm_pinmux: pinctrl@80 {
+
+   dsi_panel_pinctrl: dsi-panel-pinctrl {
+   mux {
+   pins = "gpio54";
+   function = "gpio";
+   bias-pull-up;
+   drive-strength = <8>;
+   };
+   };
+   };
+
+   dsi0: qcom,mdss_dsi@470 {
+   panel@0 {
+   compatible = "jdi,lt070me05000";
+   reg = <0>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_panel_pinctrl>;
+
+   vddp-supply = <_l17>;
+   dcdc_en-supply = <_lvs7>;
+   vcc-supply = <_1p8v>;
+
+   reset-gpios = <_pinmux 54 0>;
+   enable-gpios = <_gpio 36 GPIO_ACTIVE_HIGH>;
+   };
+   };
-- 
1.9.1



[PATCH v2 2/4] dt-bindings: Add jdi lt070me05000 panel bindings

2016-07-13 Thread Vinay Simha BN
Add documentation for lt070me05000 panel

Cc: Archit Taneja 
Cc: John Stultz 
Cc: Thierry Reding 
Cc: Sumit Semwal 
Signed-off-by: Vinay Simha BN 
Acked-by: Rob Herring 

---
v2:
 * incorporated rob herring and thierry reviews
   gpio to gpios, gpio to regulator using fixed regulators
   and pwm backlight is removed, since it is controlled by
   dcs commands
---
 .../bindings/display/panel/jdi,lt070me05000.txt| 57 ++
 1 file changed, 57 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt 
b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
new file mode 100644
index 000..613b76f
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
@@ -0,0 +1,57 @@
+JDI model LT070ME05000 1200x1920 7" DSI Panel
+
+Required properties:
+- compatible: should be "jdi,lt070me05000"
+- vddp-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply (3-5V)
+- dcdc_en-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply enable, High active
+- vcc-supply: phandle of the regulator that provides the supply voltage
+  IOVCC , power supply for LCM (1.8V)
+- reset-gpios: phandle of gpio for reset line
+  This should be 8mA, gpio can be configured using mux, pinctrl, pinctrl-names
+  XRES, Reset, Low active
+- enable-gpios: phandle of gpio for enable line
+  LED_EN, LED backlight enable, High active
+
+Example:
+
+   vcc_1p8v: regulator-fixed@2 {
+   compatible = "regulator-fixed";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-name = "vcc_1p8v";
+   regulator-type = "voltage";
+   startup-delay-us = <0>;
+   gpio = <_gpio 23 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   regulator-boot-on;
+   };
+
+   tlmm_pinmux: pinctrl@80 {
+
+   dsi_panel_pinctrl: dsi-panel-pinctrl {
+   mux {
+   pins = "gpio54";
+   function = "gpio";
+   bias-pull-up;
+   drive-strength = <8>;
+   };
+   };
+   };
+
+   dsi0: qcom,mdss_dsi@470 {
+   panel@0 {
+   compatible = "jdi,lt070me05000";
+   reg = <0>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_panel_pinctrl>;
+
+   vddp-supply = <_l17>;
+   dcdc_en-supply = <_lvs7>;
+   vcc-supply = <_1p8v>;
+
+   reset-gpios = <_pinmux 54 0>;
+   enable-gpios = <_gpio 36 GPIO_ACTIVE_HIGH>;
+   };
+   };
-- 
1.9.1



Re: [PATCH v7 2/2] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-07-11 Thread Vinay Simha
emil,

As you had suggested to drop the spurious returns in
jdi_panel_unprepare and drop the return itself.
But as i had mentioned earlier , we cannot drop the return function
and void for jdi_panel_unprepare , since the drm fun* requires int as
return type (drm_panel_funcs .unprepare).

please do re-point out if i had still missed anything.

fyi,
v7:
 * emil review comments incorporated
   added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
   gpios checks dropped.
   some returns cannot be dropped, since drm panel framework return
   type required.

On Mon, Jul 11, 2016 at 5:50 PM, Thierry Reding
<thierry.red...@gmail.com> wrote:
> On Sun, Jul 03, 2016 at 11:52:11PM +0100, Emil Velikov wrote:
>> On 28 June 2016 at 16:59, Vinay Simha <simha...@gmail.com> wrote:
>> > hi,
>> >
>> > Any further comments or reviews?
>> >
>> You still haven't covered my earlier suggestions, as such I cannot
>> give you a r-b :-( They are not blockers by any means, but it'll be
>> up-to the maintainer to ack/pick this up.
>>
>> Thierry ?
>
> Vinay, please address Emil's comments and resend. I also see that you
> stopped sending the device tree bindings patch at some point. Please do
> include that when you repost as I don't seem to be able to find a recent
> version anywhere.
>
> Thierry



-- 
Regards,

Vinay Simha.B.N.


Re: [PATCH v7 2/2] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-07-11 Thread Vinay Simha
emil,

As you had suggested to drop the spurious returns in
jdi_panel_unprepare and drop the return itself.
But as i had mentioned earlier , we cannot drop the return function
and void for jdi_panel_unprepare , since the drm fun* requires int as
return type (drm_panel_funcs .unprepare).

please do re-point out if i had still missed anything.

fyi,
v7:
 * emil review comments incorporated
   added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
   gpios checks dropped.
   some returns cannot be dropped, since drm panel framework return
   type required.

On Mon, Jul 11, 2016 at 5:50 PM, Thierry Reding
 wrote:
> On Sun, Jul 03, 2016 at 11:52:11PM +0100, Emil Velikov wrote:
>> On 28 June 2016 at 16:59, Vinay Simha  wrote:
>> > hi,
>> >
>> > Any further comments or reviews?
>> >
>> You still haven't covered my earlier suggestions, as such I cannot
>> give you a r-b :-( They are not blockers by any means, but it'll be
>> up-to the maintainer to ack/pick this up.
>>
>> Thierry ?
>
> Vinay, please address Emil's comments and resend. I also see that you
> stopped sending the device tree bindings patch at some point. Please do
> include that when you repost as I don't seem to be able to find a recent
> version anywhere.
>
> Thierry



-- 
Regards,

Vinay Simha.B.N.


Re: [PATCH v7 2/2] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-07-04 Thread Vinay Simha
On Mon, Jul 4, 2016 at 4:22 AM, Emil Velikov <emil.l.veli...@gmail.com> wrote:
> On 28 June 2016 at 16:59, Vinay Simha <simha...@gmail.com> wrote:
>> hi,
>>
>> Any further comments or reviews?
>>
> You still haven't covered my earlier suggestions, as such I cannot
> give you a r-b :-( They are not blockers by any means, but it'll be
> up-to the maintainer to ack/pick this up.
i do have covered the suggestions from you.
As i had mentioned earlier we cannot drop few returns and keep it
void(drm_panel_funcs - unprepare), since drm framework requires
return. if do you have any alternate solution please suggest, will
incorporate.
>
> Thierry ?
>
> Regards,
> Emil



-- 
Regards,

Vinay Simha.B.N.


Re: [PATCH v7 2/2] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-07-04 Thread Vinay Simha
On Mon, Jul 4, 2016 at 4:22 AM, Emil Velikov  wrote:
> On 28 June 2016 at 16:59, Vinay Simha  wrote:
>> hi,
>>
>> Any further comments or reviews?
>>
> You still haven't covered my earlier suggestions, as such I cannot
> give you a r-b :-( They are not blockers by any means, but it'll be
> up-to the maintainer to ack/pick this up.
i do have covered the suggestions from you.
As i had mentioned earlier we cannot drop few returns and keep it
void(drm_panel_funcs - unprepare), since drm framework requires
return. if do you have any alternate solution please suggest, will
incorporate.
>
> Thierry ?
>
> Regards,
> Emil



-- 
Regards,

Vinay Simha.B.N.


Re: [PATCH v7 2/2] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-06-28 Thread Vinay Simha
hi,

Any further comments or reviews?

On Mon, Jun 20, 2016 at 11:23 AM, Vinay Simha BN <simha...@gmail.com> wrote:
> Add support for the JDI LT070ME05000 WUXGA DSI panel used in
> Nexus 7 2013 devices.
>
> Programming sequence for the panel is was originally found in the
> android-msm-flo-3.4-lollipop-release branch from:
> https://android.googlesource.com/kernel/msm.git
>
> And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
> file in:
> git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27
>
> Cc: Archit Taneja <archit.tan...@gmail.com>
> Cc: Rob Clark <robdcl...@gmail.com>
> Cc: Sumit Semwal <sumit.sem...@linaro.org>
> Cc: John Stultz <john.stu...@linaro.org>
> Cc: Emil Velikov <emil.l.veli...@gmail.com>
> Cc: Thierry Reding <thierry.red...@gmail.com>
> Cc: David Airlie <airl...@linux.ie>
> Signed-off-by: Sumit Semwal <sumit.sem...@linaro.org>
> Signed-off-by: John Stultz <john.stu...@linaro.org>
> Signed-off-by: Vinay Simha BN <simha...@gmail.com>
>
> ---
> v1:
>  * sumit ported to drm/panel framework, john cherry-picked to mainline,
>folded down other fixes from Vinay and Archit, vinay removed interface
>setting cmd mode, video mode panel selected
>
> v2:
>  * incorporated code reviews from theiry, archit
>code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
>arrays of u8, generic helper function, documentation bindings,
>
> v3:
>  * dcs backlight support added
>  * tested this panel driver in nexus7 2013 device
>
> v4:
>  * backlight interface added in the panel driver
>  * incorporated width_mm and height_mm suggested by rob herring
>
> v5:
>  * theirry review comments incorporated
>panel model naming consistent, alphabetical soring in Kconfig
>Makefile, MAX_BRIGHTNESS dropped, regulator_names, parameterize
>panel width and height, descprition for control display, cabc
>and interface setting, temporary variable removed, consistent
>error reporting and commit message
>  * removed tear on/off, scanline, since these are required only
>for command mode panels
>
> v6:
>  * emil review comments incorporated
>PANEL_NUM_REGULATORS dropped, return ret added at necessary
>places, if checks dropped for backlight and gpios
>
> v7:
>  * emil review comments incorporated
>added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
>gpios checks dropped.
>some returns cannot be dropped, since drm panel framework return
>type required.
> ---
>  drivers/gpu/drm/panel/Kconfig  |  11 +
>  drivers/gpu/drm/panel/Makefile |   1 +
>  drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 495 
> +
>  3 files changed, 507 insertions(+)
>  create mode 100644 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
>
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 1500ab9..62aba97 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -18,6 +18,17 @@ config DRM_PANEL_SIMPLE
>   that it can be automatically turned off when the panel goes into a
>   low power state.
>
> +config DRM_PANEL_JDI_LT070ME05000
> +   tristate "JDI LT070ME05000 WUXGA DSI panel"
> +   depends on OF
> +   depends on DRM_MIPI_DSI
> +   depends on BACKLIGHT_CLASS_DEVICE
> +   help
> + Say Y here if you want to enable support for JDI DSI video mode
> + panel as found in Google Nexus 7 (2013) devices.
> + The panel has a 1200(RGB)×1920 (WUXGA) resolution and uses
> + 24 bit per pixel.
> +
>  config DRM_PANEL_SAMSUNG_LD9040
> tristate "Samsung LD9040 RGB/SPI panel"
> depends on OF && SPI
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index f277eed..a5c7ec0 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -1,4 +1,5 @@
>  obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
> +obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
>  obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
>  obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += 
> panel-panasonic-vvx10f034n00.o
>  obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
> diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c 
> b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> new file mode 100644
> index 000..888fe2b
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> @@ -0,0 +1,495 @@
> +/*
> + * Copyright (C) 2016 InforceComputing
> + *

Re: [PATCH v7 2/2] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-06-28 Thread Vinay Simha
hi,

Any further comments or reviews?

On Mon, Jun 20, 2016 at 11:23 AM, Vinay Simha BN  wrote:
> Add support for the JDI LT070ME05000 WUXGA DSI panel used in
> Nexus 7 2013 devices.
>
> Programming sequence for the panel is was originally found in the
> android-msm-flo-3.4-lollipop-release branch from:
> https://android.googlesource.com/kernel/msm.git
>
> And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
> file in:
> git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27
>
> Cc: Archit Taneja 
> Cc: Rob Clark 
> Cc: Sumit Semwal 
> Cc: John Stultz 
> Cc: Emil Velikov 
> Cc: Thierry Reding 
> Cc: David Airlie 
> Signed-off-by: Sumit Semwal 
> Signed-off-by: John Stultz 
> Signed-off-by: Vinay Simha BN 
>
> ---
> v1:
>  * sumit ported to drm/panel framework, john cherry-picked to mainline,
>folded down other fixes from Vinay and Archit, vinay removed interface
>setting cmd mode, video mode panel selected
>
> v2:
>  * incorporated code reviews from theiry, archit
>code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
>arrays of u8, generic helper function, documentation bindings,
>
> v3:
>  * dcs backlight support added
>  * tested this panel driver in nexus7 2013 device
>
> v4:
>  * backlight interface added in the panel driver
>  * incorporated width_mm and height_mm suggested by rob herring
>
> v5:
>  * theirry review comments incorporated
>panel model naming consistent, alphabetical soring in Kconfig
>Makefile, MAX_BRIGHTNESS dropped, regulator_names, parameterize
>panel width and height, descprition for control display, cabc
>and interface setting, temporary variable removed, consistent
>error reporting and commit message
>  * removed tear on/off, scanline, since these are required only
>for command mode panels
>
> v6:
>  * emil review comments incorporated
>PANEL_NUM_REGULATORS dropped, return ret added at necessary
>places, if checks dropped for backlight and gpios
>
> v7:
>  * emil review comments incorporated
>added ARRAY_SIZE in struct, regulator_bulk_disable in poweroff,
>gpios checks dropped.
>some returns cannot be dropped, since drm panel framework return
>type required.
> ---
>  drivers/gpu/drm/panel/Kconfig  |  11 +
>  drivers/gpu/drm/panel/Makefile |   1 +
>  drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 495 
> +
>  3 files changed, 507 insertions(+)
>  create mode 100644 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
>
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 1500ab9..62aba97 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -18,6 +18,17 @@ config DRM_PANEL_SIMPLE
>   that it can be automatically turned off when the panel goes into a
>   low power state.
>
> +config DRM_PANEL_JDI_LT070ME05000
> +   tristate "JDI LT070ME05000 WUXGA DSI panel"
> +   depends on OF
> +   depends on DRM_MIPI_DSI
> +   depends on BACKLIGHT_CLASS_DEVICE
> +   help
> + Say Y here if you want to enable support for JDI DSI video mode
> + panel as found in Google Nexus 7 (2013) devices.
> + The panel has a 1200(RGB)×1920 (WUXGA) resolution and uses
> + 24 bit per pixel.
> +
>  config DRM_PANEL_SAMSUNG_LD9040
> tristate "Samsung LD9040 RGB/SPI panel"
> depends on OF && SPI
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index f277eed..a5c7ec0 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -1,4 +1,5 @@
>  obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
> +obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
>  obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
>  obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += 
> panel-panasonic-vvx10f034n00.o
>  obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
> diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c 
> b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> new file mode 100644
> index 000..888fe2b
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
> @@ -0,0 +1,495 @@
> +/*
> + * Copyright (C) 2016 InforceComputing
> + * Author: Vinay Simha BN 
> + *
> + * Copyright (C) 2016 Linaro Ltd
> + * Author: Sumit Semwal 
> + *
> + * From internet archives, the panel for Nexus 7 2nd Gen, 2013 model is a
> + * JDI model LT070ME05000, and its data sheet is at:
> + * http://panelone.net/en/7-0-inch/JDI_LT070ME05000_7.0_inch-datashe

Re: [PATCH v2 1/2] drm/dsi: Implement dcs set/get display brightness

2016-06-28 Thread Vinay Simha
hi,

Any further comments or reviews?

On Mon, Jun 20, 2016 at 11:23 AM, Vinay Simha BN <simha...@gmail.com> wrote:
> Provide a small convenience wrapper that set/get the
> display brightness value
>
> Cc: John Stultz <john.stu...@linaro.org>
> Cc: Sumit Semwal <sumit.sem...@linaro.org>
> Cc: Archit Taneja <archit.tan...@gmail.com>
> Cc: Rob Clark <robdcl...@gmail.com>
> Cc: Jani Nikula <jani.nik...@linux.intel.com>
> Cc: Thierry Reding <thierry.red...@gmail.com>
> Signed-off-by: Vinay Simha BN <simha...@gmail.com>
> ---
> v1:
>  *tested in nexus7 2nd gen.
>
> v2:
>  * implemented jani review comments
>-functions name mapped accordingly
>-bl value increased from 0xff to 0x
>-backlight interface will be handled in panel driver,
> so it is moved from the mipi_dsi helper function
> ---
>  drivers/gpu/drm/drm_mipi_dsi.c | 49 
> ++
>  include/drm/drm_mipi_dsi.h |  4 
>  2 files changed, 53 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index 49311fc..2c03784 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -1041,6 +1041,55 @@ int mipi_dsi_dcs_set_pixel_format(struct 
> mipi_dsi_device *dsi, u8 format)
>  }
>  EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format);
>
> +/**
> + * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
> + * of the display
> + * @dsi: DSI peripheral device
> + * @brightness: brightness value
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
> +   u16 *brightness)
> +{
> +   ssize_t err;
> +
> +   err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
> +   brightness, sizeof(*brightness));
> +   if (err < 0) {
> +   if (err == 0)
> +   err = -ENODATA;
> +
> +   return err;
> +   }
> +
> +   return 0;
> +}
> +EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness);
> +
> +/**
> + * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of
> + * the display
> + * @dsi: DSI peripheral device
> + * @brightness: brightness value
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
> +   u16 brightness)
> +{
> +   ssize_t err;
> +   u8 bl_value[2] = { brightness & 0xff, brightness >> 8 };
> +
> +   err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
> +bl_value, sizeof(bl_value));
> +   if (err < 0)
> +   return err;
> +
> +   return 0;
> +}
> +EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness);
> +
>  static int mipi_dsi_drv_probe(struct device *dev)
>  {
> struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index 72f5b15..4d77bb0 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -270,6 +270,10 @@ int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device 
> *dsi);
>  int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
>  enum mipi_dsi_dcs_tear_mode mode);
>  int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
> +int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
> +   u16 *brightness);
> +int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
> +   u16 brightness);
>
>  /**
>   * struct mipi_dsi_driver - DSI driver
> --
> 2.1.2
>



-- 
Regards,

Vinay Simha.B.N.


Re: [PATCH v2 1/2] drm/dsi: Implement dcs set/get display brightness

2016-06-28 Thread Vinay Simha
hi,

Any further comments or reviews?

On Mon, Jun 20, 2016 at 11:23 AM, Vinay Simha BN  wrote:
> Provide a small convenience wrapper that set/get the
> display brightness value
>
> Cc: John Stultz 
> Cc: Sumit Semwal 
> Cc: Archit Taneja 
> Cc: Rob Clark 
> Cc: Jani Nikula 
> Cc: Thierry Reding 
> Signed-off-by: Vinay Simha BN 
> ---
> v1:
>  *tested in nexus7 2nd gen.
>
> v2:
>  * implemented jani review comments
>-functions name mapped accordingly
>-bl value increased from 0xff to 0x
>-backlight interface will be handled in panel driver,
> so it is moved from the mipi_dsi helper function
> ---
>  drivers/gpu/drm/drm_mipi_dsi.c | 49 
> ++
>  include/drm/drm_mipi_dsi.h |  4 
>  2 files changed, 53 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index 49311fc..2c03784 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -1041,6 +1041,55 @@ int mipi_dsi_dcs_set_pixel_format(struct 
> mipi_dsi_device *dsi, u8 format)
>  }
>  EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format);
>
> +/**
> + * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
> + * of the display
> + * @dsi: DSI peripheral device
> + * @brightness: brightness value
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
> +   u16 *brightness)
> +{
> +   ssize_t err;
> +
> +   err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
> +   brightness, sizeof(*brightness));
> +   if (err < 0) {
> +   if (err == 0)
> +   err = -ENODATA;
> +
> +   return err;
> +   }
> +
> +   return 0;
> +}
> +EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness);
> +
> +/**
> + * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of
> + * the display
> + * @dsi: DSI peripheral device
> + * @brightness: brightness value
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
> +   u16 brightness)
> +{
> +   ssize_t err;
> +   u8 bl_value[2] = { brightness & 0xff, brightness >> 8 };
> +
> +   err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
> +bl_value, sizeof(bl_value));
> +   if (err < 0)
> +   return err;
> +
> +   return 0;
> +}
> +EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness);
> +
>  static int mipi_dsi_drv_probe(struct device *dev)
>  {
> struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index 72f5b15..4d77bb0 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -270,6 +270,10 @@ int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device 
> *dsi);
>  int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
>  enum mipi_dsi_dcs_tear_mode mode);
>  int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
> +int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
> +   u16 *brightness);
> +int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
> +   u16 brightness);
>
>  /**
>   * struct mipi_dsi_driver - DSI driver
> --
> 2.1.2
>



-- 
Regards,

Vinay Simha.B.N.


  1   2   3   >