Re: [PATCH v3 4/7] mfd: cros_ec: add proto v3 skeleton

2015-05-27 Thread Lee Jones
On Fri, 22 May 2015, Javier Martinez Canillas wrote:

 From: Stephen Barber smbar...@chromium.org
 
 Add support in cros_ec.c to handle EC host command protocol v3.
 For v3+, probe for maximum shared protocol version and max
 request, response, and passthrough sizes. For now, this will
 always fall back to v2, since there is no bus-specific code
 for handling proto v3 packets.
 
 Signed-off-by: Stephen Barber smbar...@chromium.org
 Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 Reviewed-by: Gwendal Grignou gwen...@chromium.org
 Tested-by: Gwendal Grignou gwen...@chromium.org
 ---
 
 Changes since v2:
  - Add the helpers to the drivers/platform/chrome/cros_ec_proto.c driver
instead of drivers/mfd/cros_ec.c. Suggested by Lee Jones.
  - Rename the proto probe functions for proto_query since probe has a
special meaning in Linux so is confusing.
 
 Changes since v1:
  - Squash change https://chromium-review.googlesource.com/#/c/262870/ in
the patch. Suggested by Gwendal Grignou
  - Add Reviewed-by and Tested-by tags from Gwendal Grignou
 ---
  drivers/mfd/cros_ec.c   |  23 ++-
  drivers/mfd/cros_ec_i2c.c   |   4 +
  drivers/mfd/cros_ec_spi.c   |   7 +-

Acked-by: Lee Jones lee.jo...@linaro.org

  drivers/platform/chrome/cros_ec_lpc.c   |   4 +
  drivers/platform/chrome/cros_ec_proto.c | 339 
 
  include/linux/mfd/cros_ec.h |  28 ++-
  6 files changed, 355 insertions(+), 50 deletions(-)
 
 diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c
 index d857f6a2b57b..08d82bfc5268 100644
 --- a/drivers/mfd/cros_ec.c
 +++ b/drivers/mfd/cros_ec.c
 @@ -36,19 +36,22 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
   struct device *dev = ec_dev-dev;
   int err = 0;
  
 - if (ec_dev-din_size) {
 - ec_dev-din = devm_kzalloc(dev, ec_dev-din_size, GFP_KERNEL);
 - if (!ec_dev-din)
 - return -ENOMEM;
 - }
 - if (ec_dev-dout_size) {
 - ec_dev-dout = devm_kzalloc(dev, ec_dev-dout_size, GFP_KERNEL);
 - if (!ec_dev-dout)
 - return -ENOMEM;
 - }
 + ec_dev-max_request = sizeof(struct ec_params_hello);
 + ec_dev-max_response = sizeof(struct ec_response_get_protocol_info);
 + ec_dev-max_passthru = 0;
 +
 + ec_dev-din = devm_kzalloc(dev, ec_dev-din_size, GFP_KERNEL);
 + if (!ec_dev-din)
 + return -ENOMEM;
 +
 + ec_dev-dout = devm_kzalloc(dev, ec_dev-dout_size, GFP_KERNEL);
 + if (!ec_dev-dout)
 + return -ENOMEM;
  
   mutex_init(ec_dev-lock);
  
 + cros_ec_query_all(ec_dev);
 +
   err = mfd_add_devices(dev, 0, cros_devs,
 ARRAY_SIZE(cros_devs),
 NULL, ec_dev-irq, NULL);
 diff --git a/drivers/mfd/cros_ec_i2c.c b/drivers/mfd/cros_ec_i2c.c
 index fbf7819f5de5..b400bfa2772a 100644
 --- a/drivers/mfd/cros_ec_i2c.c
 +++ b/drivers/mfd/cros_ec_i2c.c
 @@ -143,8 +143,12 @@ static int cros_ec_i2c_probe(struct i2c_client *client,
   ec_dev-priv = client;
   ec_dev-irq = client-irq;
   ec_dev-cmd_xfer = cros_ec_cmd_xfer_i2c;
 + ec_dev-pkt_xfer = NULL;
   ec_dev-ec_name = client-name;
   ec_dev-phys_name = client-adapter-name;
 + ec_dev-din_size = sizeof(struct ec_host_response) +
 +sizeof(struct ec_response_get_protocol_info);
 + ec_dev-dout_size = sizeof(struct ec_host_request);
  
   err = cros_ec_register(ec_dev);
   if (err) {
 diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c
 index 573730fec947..04da2f288ef8 100644
 --- a/drivers/mfd/cros_ec_spi.c
 +++ b/drivers/mfd/cros_ec_spi.c
 @@ -361,10 +361,13 @@ static int cros_ec_spi_probe(struct spi_device *spi)
   ec_dev-priv = ec_spi;
   ec_dev-irq = spi-irq;
   ec_dev-cmd_xfer = cros_ec_cmd_xfer_spi;
 + ec_dev-pkt_xfer = NULL;
   ec_dev-ec_name = ec_spi-spi-modalias;
   ec_dev-phys_name = dev_name(ec_spi-spi-dev);
 - ec_dev-din_size = EC_MSG_BYTES + EC_MSG_PREAMBLE_COUNT;
 - ec_dev-dout_size = EC_MSG_BYTES;
 + ec_dev-din_size = EC_MSG_PREAMBLE_COUNT +
 +sizeof(struct ec_host_response) +
 +sizeof(struct ec_response_get_protocol_info);
 + ec_dev-dout_size = sizeof(struct ec_host_request);
  
   err = cros_ec_register(ec_dev);
   if (err) {
 diff --git a/drivers/platform/chrome/cros_ec_lpc.c 
 b/drivers/platform/chrome/cros_ec_lpc.c
 index 4c7f0df33bf8..05aeb559275f 100644
 --- a/drivers/platform/chrome/cros_ec_lpc.c
 +++ b/drivers/platform/chrome/cros_ec_lpc.c
 @@ -215,7 +215,11 @@ static int cros_ec_lpc_probe(struct platform_device 
 *pdev)
   ec_dev-ec_name = pdev-name;
   ec_dev-phys_name = dev_name(dev);
   ec_dev-cmd_xfer = cros_ec_cmd_xfer_lpc;
 + ec_dev-pkt_xfer = NULL;
   ec_dev-cmd_readmem = cros_ec_lpc_readmem;
 + ec_dev-din_size = 

Re: [PATCH v3 7/7] mfd: cros_ec: spi: Add delay for asserting CS

2015-05-27 Thread Lee Jones
On Fri, 22 May 2015, Javier Martinez Canillas wrote:

 From: Alexandru M Stan ams...@chromium.org
 
 Some ECs need a little time for waking up before they can accept
 SPI data at a high speed. This is configurable via a DT property
 google,cros-ec-spi-pre-delay.
 
 If this property isn't set, then no delay will be added. However,
 if set it will cause a delay equal to the value passed to it to
 be inserted at the beginning of a transaction.
 
 Signed-off-by: Alexandru M Stan ams...@chromium.org
 Reviewed-by: Doug Anderson diand...@chromium.org
 Signed-off-by: Chris Zhong z...@rock-chips.com
 Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 ---
 
 Changes since v2: None
 
 Changes since v1: None, new patch
 ---
  Documentation/devicetree/bindings/mfd/cros-ec.txt |  4 
  drivers/mfd/cros_ec_spi.c | 21 +++--

These two should be separate patches.

  2 files changed, 23 insertions(+), 2 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/mfd/cros-ec.txt 
 b/Documentation/devicetree/bindings/mfd/cros-ec.txt
 index 8009c3d87f33..1777916e9e28 100644
 --- a/Documentation/devicetree/bindings/mfd/cros-ec.txt
 +++ b/Documentation/devicetree/bindings/mfd/cros-ec.txt
 @@ -18,6 +18,10 @@ Required properties (SPI):
  - reg: SPI chip select
  
  Optional properties (SPI):
 +- google,cros-ec-spi-pre-delay: Some implementations of the EC need a little
 +  time to wake up from sleep before they can receive SPI transfers at a high
 +  clock rate. This property specifies the delay, in usecs, between the
 +  assertion of the CS to the start of the first clock pulse.
  - google,cros-ec-spi-msg-delay: Some implementations of the EC require some
additional processing time in order to accept new transactions. If the 
 delay
between transactions is not long enough the EC may not be able to respond

When re-submitting as seperate patches:
  Acked-by: Lee Jones lee.jo...@linaro.org

 diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c
 index faba03e2f1ef..16f228dc243f 100644
 --- a/drivers/mfd/cros_ec_spi.c
 +++ b/drivers/mfd/cros_ec_spi.c
 @@ -71,12 +71,15 @@
   * @spi: SPI device we are connected to
   * @last_transfer_ns: time that we last finished a transfer, or 0 if there
   *   if no record
 + * @start_of_msg_delay: used to set the delay_usecs on the spi_transfer that
 + *  is sent when we want to turn on CS at the start of a transaction.
   * @end_of_msg_delay: used to set the delay_usecs on the spi_transfer that
   *  is sent when we want to turn off CS at the end of a transaction.
   */
  struct cros_ec_spi {
   struct spi_device *spi;
   s64 last_transfer_ns;
 + unsigned int start_of_msg_delay;
   unsigned int end_of_msg_delay;
  };
  
 @@ -366,7 +369,7 @@ static int cros_ec_pkt_xfer_spi(struct cros_ec_device 
 *ec_dev,
   struct ec_host_request *request;
   struct ec_host_response *response;
   struct cros_ec_spi *ec_spi = ec_dev-priv;
 - struct spi_transfer trans;
 + struct spi_transfer trans, trans_delay;
   struct spi_message msg;
   int i, len;
   u8 *ptr;
 @@ -393,13 +396,23 @@ static int cros_ec_pkt_xfer_spi(struct cros_ec_device 
 *ec_dev,
   goto exit;
   }
  
 + /*
 +  * Leave a gap between CS assertion and clocking of data to allow the
 +  * EC time to wakeup.
 +  */
 + spi_message_init(msg);
 + if (ec_spi-start_of_msg_delay) {
 + memset(trans_delay, 0, sizeof(trans_delay));
 + trans_delay.delay_usecs = ec_spi-start_of_msg_delay;
 + spi_message_add_tail(trans_delay, msg);
 + }
 +
   /* Transmit phase - send our message */
   memset(trans, 0, sizeof(trans));
   trans.tx_buf = ec_dev-dout;
   trans.rx_buf = rx_buf;
   trans.len = len;
   trans.cs_change = 1;
 - spi_message_init(msg);
   spi_message_add_tail(trans, msg);
   ret = spi_sync(ec_spi-spi, msg);
  
 @@ -602,6 +615,10 @@ static void cros_ec_spi_dt_probe(struct cros_ec_spi 
 *ec_spi, struct device *dev)
   u32 val;
   int ret;
  
 + ret = of_property_read_u32(np, google,cros-ec-spi-pre-delay, val);
 + if (!ret)
 + ec_spi-start_of_msg_delay = val;
 +
   ret = of_property_read_u32(np, google,cros-ec-spi-msg-delay, val);
   if (!ret)
   ec_spi-end_of_msg_delay = val;

And for this patch:
  Acked-by: Lee Jones lee.jo...@linaro.org

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 5/7] mfd: cros_ec: add bus-specific proto v3 code

2015-05-27 Thread Lee Jones
On Fri, 22 May 2015, Javier Martinez Canillas wrote:

 From: Stephen Barber smbar...@chromium.org
 
 Add proto v3 support to the SPI, I2C, and LPC.
 
 Signed-off-by: Stephen Barber smbar...@chromium.org
 Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 Tested-by: Heiko Stuebner he...@sntech.de
 Reviewed-by: Gwendal Grignou gwen...@chromium.org
 Tested-by: Gwendal Grignou gwen...@chromium.org
 ---
 
 Changes since v2: None
 
 Changes since v1:
  - Added Gwendal Grignou Reviewed-by and Tested-by tags
 ---
  drivers/mfd/cros_ec_i2c.c | 166 ++-
  drivers/mfd/cros_ec_spi.c | 382 
 +-
  drivers/platform/chrome/cros_ec_lpc.c |  73 ++-
  include/linux/mfd/cros_ec.h   |   6 +
  4 files changed, 569 insertions(+), 58 deletions(-)

I don't even know what to say; except, 600 lines of grimness!  I tried
to review, but now my eyes and brain hurt.  I feel sorry for the guys
who have to actively maintain this stuff.

However... you have enough vendor Acks and Tests to make me happy,
and if anything is wrong I'm sure you'll come back and fix it
promptyly.

Acked-by: Lee Jones lee.jo...@linaro.org

 diff --git a/drivers/mfd/cros_ec_i2c.c b/drivers/mfd/cros_ec_i2c.c
 index b400bfa2772a..22e8a4ae1711 100644
 --- a/drivers/mfd/cros_ec_i2c.c
 +++ b/drivers/mfd/cros_ec_i2c.c
 @@ -13,6 +13,7 @@
   * GNU General Public License for more details.
   */
  
 +#include linux/delay.h
  #include linux/kernel.h
  #include linux/module.h
  #include linux/i2c.h
 @@ -22,6 +23,32 @@
  #include linux/platform_device.h
  #include linux/slab.h
  
 +/**
 + * Request format for protocol v3
 + * byte 00xda (EC_COMMAND_PROTOCOL_3)
 + * byte 1-8  struct ec_host_request
 + * byte 10-  response data
 + */
 +struct ec_host_request_i2c {
 + /* Always 0xda to backward compatible with v2 struct */
 + uint8_t  command_protocol;
 + struct ec_host_request ec_request;
 +} __packed;
 +
 +
 +/*
 + * Response format for protocol v3
 + * byte 0result code
 + * byte 1packet_length
 + * byte 2-9  struct ec_host_response
 + * byte 10-  response data
 + */
 +struct ec_host_response_i2c {
 + uint8_t result;
 + uint8_t packet_length;
 + struct ec_host_response ec_response;
 +} __packed;
 +
  static inline struct cros_ec_device *to_ec_dev(struct device *dev)
  {
   struct i2c_client *client = to_i2c_client(dev);
 @@ -29,6 +56,134 @@ static inline struct cros_ec_device *to_ec_dev(struct 
 device *dev)
   return i2c_get_clientdata(client);
  }
  
 +static int cros_ec_pkt_xfer_i2c(struct cros_ec_device *ec_dev,
 + struct cros_ec_command *msg)
 +{
 + struct i2c_client *client = ec_dev-priv;
 + int ret = -ENOMEM;
 + int i;
 + int packet_len;
 + u8 *out_buf = NULL;
 + u8 *in_buf = NULL;
 + u8 sum;
 + struct i2c_msg i2c_msg[2];
 + struct ec_host_response *ec_response;
 + struct ec_host_request_i2c *ec_request_i2c;
 + struct ec_host_response_i2c *ec_response_i2c;
 + int request_header_size = sizeof(struct ec_host_request_i2c);
 + int response_header_size = sizeof(struct ec_host_response_i2c);
 +
 + i2c_msg[0].addr = client-addr;
 + i2c_msg[0].flags = 0;
 + i2c_msg[1].addr = client-addr;
 + i2c_msg[1].flags = I2C_M_RD;
 +
 + packet_len = msg-insize + response_header_size;
 + BUG_ON(packet_len  ec_dev-din_size);
 + in_buf = ec_dev-din;
 + i2c_msg[1].len = packet_len;
 + i2c_msg[1].buf = (char *) in_buf;
 +
 + packet_len = msg-outsize + request_header_size;
 + BUG_ON(packet_len  ec_dev-dout_size);
 + out_buf = ec_dev-dout;
 + i2c_msg[0].len = packet_len;
 + i2c_msg[0].buf = (char *) out_buf;
 +
 + /* create request data */
 + ec_request_i2c = (struct ec_host_request_i2c *) out_buf;
 + ec_request_i2c-command_protocol = EC_COMMAND_PROTOCOL_3;
 +
 + ec_dev-dout++;
 + ret = cros_ec_prepare_tx(ec_dev, msg);
 + ec_dev-dout--;
 +
 + /* send command to EC and read answer */
 + ret = i2c_transfer(client-adapter, i2c_msg, 2);
 + if (ret  0) {
 + dev_dbg(ec_dev-dev, i2c transfer failed: %d\n, ret);
 + goto done;
 + } else if (ret != 2) {
 + dev_err(ec_dev-dev, failed to get response: %d\n, ret);
 + ret = -EIO;
 + goto done;
 + }
 +
 + ec_response_i2c = (struct ec_host_response_i2c *) in_buf;
 + msg-result = ec_response_i2c-result;
 + ec_response = ec_response_i2c-ec_response;
 +
 + switch (msg-result) {
 + case EC_RES_SUCCESS:
 + break;
 + case EC_RES_IN_PROGRESS:
 + ret = -EAGAIN;
 + dev_dbg(ec_dev-dev, command 0x%02x in progress\n,
 + msg-command);
 + goto done;
 +
 + default:
 + dev_dbg(ec_dev-dev, command 0x%02x returned %d\n,
 + msg-command, msg-result);
 + /*
 +   

Re: [PATCH 5/5] Documentation: dt-bindings: add exynos-srom binding information

2015-05-27 Thread Krzysztof Kozlowski
2015-04-29 17:38 GMT+09:00 Pankaj Dubey pankaj.du...@samsung.com:
 This patch adds exynos-srom binding information for SROM Controller
 driver on Exynos SoCs.

 CC: Rob Herring robh...@kernel.org
 CC: Mark Rutland mark.rutl...@arm.com
 CC: Ian Campbell ijc+devicet...@hellion.org.uk
 Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
 ---
  .../devicetree/bindings/arm/samsung/exynos-srom.txt  | 12 
 
  1 file changed, 12 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/arm/samsung/exynos-srom.txt

 diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-srom.txt 
 b/Documentation/devicetree/bindings/arm/samsung/exynos-srom.txt
 new file mode 100644
 index 000..482d1cd
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/arm/samsung/exynos-srom.txt
 @@ -0,0 +1,12 @@
 +SAMSUNG Exynos SoCs SROM Controller driver.
 +
 +Required properties:
 +- compatible : Should at least contain samsung,exynos-srom.

At least - do you already expect other compatibles?

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


Re: [PATCH v6 03/12] drm/exynos: atomic phase 1: add .mode_set_nofb() callback

2015-05-27 Thread Joonyoung Shim
On 05/23/2015 12:33 AM, Gustavo Padovan wrote:
 Hi Joonyoung,
 
 2015-05-22 Joonyoung Shim jy0922.s...@samsung.com:
 
 On 05/22/2015 05:02 AM, Gustavo Padovan wrote:
 From: Gustavo Padovan gustavo.pado...@collabora.co.uk

 The new atomic infrastructure needs the .mode_set_nofb() callback to
 update CRTC timings before setting any plane.

 Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
 ---
  drivers/gpu/drm/exynos/exynos_drm_crtc.c | 60 
 +---
  1 file changed, 9 insertions(+), 51 deletions(-)

 diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
 b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
 index 61b8cfe..54b74e1 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
 @@ -81,59 +81,16 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
 return true;
  }
  
 -static int
 -exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode 
 *mode,
 - struct drm_display_mode *adjusted_mode, int x, int y,
 - struct drm_framebuffer *old_fb)
 -{
 -   struct drm_framebuffer *fb = crtc-primary-fb;
 -   unsigned int crtc_w;
 -   unsigned int crtc_h;
 -   int ret;
 -
 -   /*
 -* copy the mode data adjusted by mode_fixup() into crtc-mode
 -* so that hardware can be seet to proper mode.
 -*/
 -   memcpy(crtc-mode, adjusted_mode, sizeof(*adjusted_mode));

 This can cause any problem because exynos drm drivers use crtc-mode
 directly as adjusted_mode. It's necessary to consider using
 crtc_state-adjusted_mode in exynos drm drivers.
 
 Yes, we are moving to use adjusted_mode in exynos, see this patch from
 Tobias. It makes crtc uses the adjusted_mode instead. So I think it is
 okay to remove this memcpy from here.
 
 http://www.spinics.net/lists/linux-samsung-soc/msg44790.html

Yeah, but that is just one, it can be other missing points. It's better
to care all missing points with removing memcpy of adjusted_mode.
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 5/7] mfd: cros_ec: add bus-specific proto v3 code

2015-05-27 Thread Javier Martinez Canillas
Hello Lee,

On 05/27/2015 10:53 AM, Lee Jones wrote:
 On Fri, 22 May 2015, Javier Martinez Canillas wrote:
 
 From: Stephen Barber smbar...@chromium.org
 
 Add proto v3 support to the SPI, I2C, and LPC.
 
 Signed-off-by: Stephen Barber smbar...@chromium.org
 Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 Tested-by: Heiko Stuebner he...@sntech.de
 Reviewed-by: Gwendal Grignou gwen...@chromium.org
 Tested-by: Gwendal Grignou gwen...@chromium.org
 ---
 
 Changes since v2: None
 
 Changes since v1:
  - Added Gwendal Grignou Reviewed-by and Tested-by tags
 ---
  drivers/mfd/cros_ec_i2c.c | 166 ++-
  drivers/mfd/cros_ec_spi.c | 382 
 +-
  drivers/platform/chrome/cros_ec_lpc.c |  73 ++-
  include/linux/mfd/cros_ec.h   |   6 +
  4 files changed, 569 insertions(+), 58 deletions(-)
 
 I don't even know what to say; except, 600 lines of grimness!  I tried
 to review, but now my eyes and brain hurt.  I feel sorry for the guys
 who have to actively maintain this stuff.


Since I'm not the author of these drivers, it took me some time to
understand them as well. I've been trying to make it more suitable
for upstream and were improved a lot by following your suggestions
(thanks for a lot that!).

 However... you have enough vendor Acks and Tests to make me happy,
 and if anything is wrong I'm sure you'll come back and fix it
 promptyly.


Yes I will and I'm sure that being in mainline will make the code
more maintainable in the long term.

 Acked-by: Lee Jones lee.jo...@linaro.org


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


Re: [PATCH v7 02/13] drm/exynos: atomic phase 1: use drm_plane_helper_update()

2015-05-27 Thread Joonyoung Shim
On 05/23/2015 12:40 AM, Gustavo Padovan wrote:
 From: Gustavo Padovan gustavo.pado...@collabora.co.uk
 
 Rip out the check from exynos_update_plane() and create
 exynos_check_plane() for the check phase enabling use to use
 the atomic helpers to call our check and update phases when updating
 planes.
 
 Update all users of exynos_update_plane() accordingly to call
 exynos_check_plane() before.
 
 Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
 Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
 Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.dey
 ---
  drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 23 ++
  drivers/gpu/drm/exynos/exynos_drm_plane.c | 40 
 +++
  drivers/gpu/drm/exynos/exynos_drm_plane.h |  2 +-
  3 files changed, 50 insertions(+), 15 deletions(-)
 
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
 b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
 index 363b019..27cc450 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
 @@ -116,6 +116,7 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc 
 *crtc, int x, int y,
   struct drm_framebuffer *fb = crtc-primary-fb;
   unsigned int crtc_w;
   unsigned int crtc_h;
 + int ret;
  
   /* when framebuffer changing is requested, crtc's dpms should be on */
   if (exynos_crtc-dpms  DRM_MODE_DPMS_ON) {
 @@ -123,12 +124,17 @@ static int exynos_drm_crtc_mode_set_base(struct 
 drm_crtc *crtc, int x, int y,
   return -EPERM;
   }
  
 + ret = exynos_check_plane(crtc-primary, fb);
 + if (ret)
 + return ret;
 +
   crtc_w = fb-width - x;
   crtc_h = fb-height - y;
 + exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
 + crtc_w, crtc_h, x  16, y  16,
 + crtc_w  16, crtc_h  16);
  
 - return exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
 -crtc_w, crtc_h, x  16, y  16,
 -crtc_w  16, crtc_h  16);
 + return 0;
  }
  
  static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 @@ -165,7 +171,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
 *crtc,
  {
   struct drm_device *dev = crtc-dev;
   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 - struct drm_framebuffer *old_fb = crtc-primary-fb;
   unsigned int crtc_w, crtc_h;
   int ret;
  
 @@ -184,6 +189,10 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
 *crtc,
   goto out;
   }
  
 + ret = exynos_check_plane(crtc-primary, fb);
 + if (ret)
 + goto out;
 +
   ret = drm_vblank_get(dev, exynos_crtc-pipe);
   if (ret) {
   DRM_DEBUG(failed to acquire vblank counter\n);
 @@ -202,6 +211,7 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
 *crtc,
   crtc-primary-fb = fb;
   crtc_w = fb-width - crtc-x;
   crtc_h = fb-height - crtc-y;
 + HEAD
   ret = exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
 crtc_w, crtc_h, crtc-x  16, crtc-y  16,
 crtc_w  16, crtc_h  16);
 @@ -213,6 +223,11 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
 *crtc,
   spin_unlock_irq(dev-event_lock);
   return ret;
   }
 +===
 + exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
 + crtc_w, crtc_h, crtc-x, crtc-y,
 + crtc_w, crtc_h);
 + 2f6d1f4... drm/exynos: atomic phase 1: use drm_plane_helper_update()

Maybe unhandled output of merge, could you fix it?
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 12/13] drm/exynos: atomic dpms support

2015-05-27 Thread Joonyoung Shim
Hi Gustavo,

Sorry, i was missing some review points.

On 05/23/2015 12:40 AM, Gustavo Padovan wrote:
 From: Gustavo Padovan gustavo.pado...@collabora.co.uk
 
 Run dpms operations through the atomic intefaces. This basically removes
 the .dpms() callback from econders and crtcs and use .disable() and
 .enable() to turn the crtc on and off.
 
 v2: Address comments by Joonyoung:
   - make hdmi code call -disable() instead of -dpms()
   - do not use WARN_ON on crtc enable/disable
 
 v3: - Fix build failure after the hdmi change in v2
 - Change dpms helper of ptn3460 bridge
 
 Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
 Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
 Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
 ---
  drivers/gpu/drm/bridge/ps8622.c |  2 +-
  drivers/gpu/drm/bridge/ptn3460.c|  2 +-
  drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
  drivers/gpu/drm/exynos/exynos_drm_crtc.c| 95 
 -
  drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
  drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
  drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
  drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++--
  drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
  drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +-
  10 files changed, 69 insertions(+), 75 deletions(-)
 
 diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
 index b604326..d686235 100644
 --- a/drivers/gpu/drm/bridge/ps8622.c
 +++ b/drivers/gpu/drm/bridge/ps8622.c
 @@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct drm_connector 
 *connector)
  }
  
  static const struct drm_connector_funcs ps8622_connector_funcs = {
 - .dpms = drm_helper_connector_dpms,
 + .dpms = drm_atomic_helper_connector_dpms,
   .fill_modes = drm_helper_probe_single_connector_modes,
   .detect = ps8622_detect,
   .destroy = ps8622_connector_destroy,
 diff --git a/drivers/gpu/drm/bridge/ptn3460.c 
 b/drivers/gpu/drm/bridge/ptn3460.c
 index 8ed3617..260bc9f 100644
 --- a/drivers/gpu/drm/bridge/ptn3460.c
 +++ b/drivers/gpu/drm/bridge/ptn3460.c
 @@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct 
 drm_connector *connector)
  }
  
  static struct drm_connector_funcs ptn3460_connector_funcs = {
 - .dpms = drm_helper_connector_dpms,
 + .dpms = drm_atomic_helper_connector_dpms,
   .fill_modes = drm_helper_probe_single_connector_modes,
   .detect = ptn3460_detect,
   .destroy = ptn3460_connector_destroy,
 diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
 b/drivers/gpu/drm/exynos/exynos_dp_core.c
 index 195fe60..c9995b1 100644
 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
 +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
 @@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
 drm_connector *connector)
  }
  
  static struct drm_connector_funcs exynos_dp_connector_funcs = {
 - .dpms = drm_helper_connector_dpms,
 + .dpms = drm_atomic_helper_connector_dpms,
   .fill_modes = drm_helper_probe_single_connector_modes,
   .detect = exynos_dp_detect,
   .destroy = exynos_dp_connector_destroy,
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
 b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
 index fd5ef2c..ca501a9 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
 @@ -22,48 +22,54 @@
  #include exynos_drm_encoder.h
  #include exynos_drm_plane.h
  
 -static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
 +static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
  {
   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 + struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc-primary);
  
 - DRM_DEBUG_KMS(crtc[%d] mode[%d]\n, crtc-base.id, mode);
 -
 - if (exynos_crtc-dpms == mode) {
 - DRM_DEBUG_KMS(desired dpms mode is same as previous one.\n);
 + if (exynos_crtc-enabled)
   return;
 - }
 -
 - if (mode  DRM_MODE_DPMS_ON) {
 - /* wait for the completion of page flip. */
 - if (!wait_event_timeout(exynos_crtc-pending_flip_queue,
 - (exynos_crtc-event == NULL), HZ/20))
 - exynos_crtc-event = NULL;
 - drm_crtc_vblank_off(crtc);
 - }
  
   if (exynos_crtc-ops-dpms)
 - exynos_crtc-ops-dpms(exynos_crtc, mode);
 + exynos_crtc-ops-dpms(exynos_crtc, DRM_MODE_DPMS_ON);
  
 - exynos_crtc-dpms = mode;
 + exynos_crtc-enabled = true;
  
 - if (mode == DRM_MODE_DPMS_ON)
 - drm_crtc_vblank_on(crtc);
 -}
 + drm_crtc_vblank_on(crtc);
  
 -static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
 -{
 - /* drm framework doesn't check NULL. */
 + if (exynos_crtc-ops-win_commit)
 + exynos_crtc-ops-win_commit(exynos_crtc, exynos_plane-zpos);

Unnecessary also? because be called by 

Re: [PATCH v3 6/7] mfd: cros_ec: Support multiple EC in a system

2015-05-27 Thread Lee Jones
On Fri, 22 May 2015, Javier Martinez Canillas wrote:

 From: Gwendal Grignou gwen...@chromium.org
 
 Chromebooks can have more than one Embedded Controller so the
 cros_ec device id has to be incremented for each EC registered.
 
 Add code to handle multiple EC. First ec found is cros-ec0,
 second cros-ec1 and so on.
 
 Add a new structure to represent multiple EC as different char
 devices (e.g: /dev/cros_ec, /dev/cros_pd). It connects to
 cros_ec_device and allows sysfs inferface for cros_pd.
 
 Also reduce number of allocated objects, make chromeos sysfs
 class object a static and add refcounting to prevent object
 deletion while command is in progress.
 
 Signed-off-by: Gwendal Grignou gwen...@chromium.org
 Reviewed-by: Dmitry Torokhov d...@chromium.org
 Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 ---
 
 Changes since v2: None
 
 Changes since v1:
   - Squash patch that adds support to represent EC's as different
 char devices (e.g: /dev/cros_ec, /dev/cros_pd):
 https://chromium-review.googlesource.com/#/c/217297/
 Suggested by Gwendal Grignou
   - Use cros_ec instead of cros-ec in the subject line to be consistent.
 Suggested by Gwendal Grignou
 ---
  drivers/input/keyboard/cros_ec_keyb.c  |   2 +-
  drivers/mfd/cros_ec.c  |  66 +--
  drivers/mfd/cros_ec_i2c.c  |   1 -
  drivers/mfd/cros_ec_spi.c  |   1 -
  drivers/platform/chrome/cros_ec_dev.c  | 128 
 -
  drivers/platform/chrome/cros_ec_dev.h  |   7 --
  drivers/platform/chrome/cros_ec_lightbar.c |  75 +
  drivers/platform/chrome/cros_ec_lpc.c  |   1 -
  drivers/platform/chrome/cros_ec_sysfs.c|  48 +--
  include/linux/mfd/cros_ec.h|  44 --
  10 files changed, 247 insertions(+), 126 deletions(-)
 
 diff --git a/drivers/input/keyboard/cros_ec_keyb.c 
 b/drivers/input/keyboard/cros_ec_keyb.c
 index 974154a74505..b01966dc7eb3 100644
 --- a/drivers/input/keyboard/cros_ec_keyb.c
 +++ b/drivers/input/keyboard/cros_ec_keyb.c
 @@ -275,7 +275,7 @@ static int cros_ec_keyb_probe(struct platform_device 
 *pdev)
   ckdev-dev = dev;
   dev_set_drvdata(pdev-dev, ckdev);
  
 - idev-name = ec-ec_name;
 + idev-name = CROS_EC_DEV_NAME;
   idev-phys = ec-phys_name;
   __set_bit(EV_REP, idev-evbit);
  
 diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c
 index 08d82bfc5268..99292bc2fe5f 100644
 --- a/drivers/mfd/cros_ec.c
 +++ b/drivers/mfd/cros_ec.c
 @@ -24,12 +24,48 @@
  #include linux/mfd/core.h
  #include linux/mfd/cros_ec.h
  
 -static const struct mfd_cell cros_devs[] = {
 - {
 +static int dev_id;
 +
 +static int cros_ec_dev_register(struct cros_ec_device *ec_dev,
 + int dev_id, int devidx)

What's the difference between dev_id and devidx.

Confusing don't you think?

 +{
 + struct device *dev = ec_dev-dev;
 + struct cros_ec_platform ec_p = {
 + .cmd_offset = 0,
 + };
 +
 + struct mfd_cell ec_cell = {
   .name = cros-ec-ctl,
   .id = PLATFORM_DEVID_AUTO,
 - },
 -};
 + .platform_data = ec_p,
 + .pdata_size = sizeof(ec_p),
 + };

Why have you bought this into here?  The convention is usually to have
this at the top of the file, outside any functions.  Declaring and
initialising structs inside functions makes things looks messy IMHO.



 + switch (devidx) {
 + case 0:

Please define these.  I have no idea what devidx 0 or 1 is.

 + if (IS_ENABLED(CONFIG_OF)  dev-of_node) {
 + ec_p.ec_name = of_get_property(dev-of_node, devname,
 +NULL);
 + if (ec_p.ec_name == NULL) {

if (!ec_p.ec_name)

 + dev_dbg(dev,
 + Device name not found, using default);
 + ec_p.ec_name = CROS_EC_DEV_NAME;
 + }
 + } else {
 + ec_p.ec_name = CROS_EC_DEV_NAME;
 + }

I'd save yourself a few lines and do:

if (OF)
   name = get_name();

if (!name)
   name = DEFAULT_NAME;

Then rid the 'else'.  Rid the dev_dbg() too if you can.

 + break;
 + case 1:
 + ec_p.ec_name = CROS_EC_DEV_PD_NAME;
 + break;
 + default:
 + return -EINVAL;
 + }
 +
 + ec_p.cmd_offset = EC_CMD_PASSTHRU_OFFSET(devidx);

'\n' here.

 + return mfd_add_devices(dev, dev_id, ec_cell, 1,
 +NULL, ec_dev-irq, NULL);
 +}
  
  int cros_ec_register(struct cros_ec_device *ec_dev)
  {
 @@ -52,14 +88,28 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
  
   cros_ec_query_all(ec_dev);
  
 - err = mfd_add_devices(dev, 0, cros_devs,
 -   ARRAY_SIZE(cros_devs),
 -   NULL, ec_dev-irq, 

Re: [PATCH v3 1/7] mfd: cros_ec: Use a zero-length array for command data

2015-05-27 Thread Javier Martinez Canillas
Hello Lee,

On 05/27/2015 10:36 AM, Lee Jones wrote:
 ---
  drivers/i2c/busses/i2c-cros-ec-tunnel.c|  45 ++---
  drivers/input/keyboard/cros_ec_keyb.c  |  29 --
  drivers/mfd/cros_ec.c  |  28 --
  drivers/mfd/cros_ec_i2c.c  |   4 +-
  drivers/mfd/cros_ec_spi.c  |   2 +-
 
 For the MFD changes:
  Acked-by: Lee Jones lee.jo...@linaro.org
 

Thanks!

Best regards,
Javier

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


Re: [PATCH v3 3/7] mfd: cros_ec: Move protocol helpers out of the MFD driver

2015-05-27 Thread Lee Jones
On Fri, 22 May 2015, Javier Martinez Canillas wrote:

 The MFD driver should only have the logic to instantiate its child devices
 and setup any shared resources that will be used by the subdevices drivers.
 
 The cros_ec MFD is more complex than expected since it also has helpers to
 communicate with the EC. So the driver will only get more bigger as other
 protocols are supported in the future. So move the communication protocol
 helpers to its own driver as drivers/platform/chrome/cros_ec_proto.c.
 
 Suggested-by: Lee Jones lee.jo...@linaro.org
 Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 ---
 
 Changes since v2: None, new patch.
 ---
  drivers/i2c/busses/Kconfig  |   2 +-
  drivers/input/keyboard/Kconfig  |   2 +-
  drivers/mfd/Kconfig |   5 +-
  drivers/mfd/cros_ec.c   |  96 --

:)

Acked-by: Lee Jones lee.jo...@linaro.org

  drivers/platform/chrome/Kconfig |   9 ++-
  drivers/platform/chrome/Makefile|   1 +
  drivers/platform/chrome/cros_ec_proto.c | 115 
 
  7 files changed, 128 insertions(+), 102 deletions(-)
  create mode 100644 drivers/platform/chrome/cros_ec_proto.c
 
 diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
 index 2255af23b9c7..5f1c1c4f5d87 100644
 --- a/drivers/i2c/busses/Kconfig
 +++ b/drivers/i2c/busses/Kconfig
 @@ -1103,7 +1103,7 @@ config I2C_SIBYTE
  
  config I2C_CROS_EC_TUNNEL
   tristate ChromeOS EC tunnel I2C bus
 - depends on MFD_CROS_EC
 + depends on CROS_EC_PROTO
   help
 If you say yes here you get an I2C bus that will tunnel i2c commands
 through to the other side of the ChromeOS EC to the i2c bus
 diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
 index 106fbac7f8c5..e8eb60c6d83e 100644
 --- a/drivers/input/keyboard/Kconfig
 +++ b/drivers/input/keyboard/Kconfig
 @@ -677,7 +677,7 @@ config KEYBOARD_W90P910
  config KEYBOARD_CROS_EC
   tristate ChromeOS EC keyboard
   select INPUT_MATRIXKMAP
 - depends on MFD_CROS_EC
 + depends on CROS_EC_PROTO
   help
 Say Y here to enable the matrix keyboard used by ChromeOS devices
 and implemented on the ChromeOS EC. You must enable one bus option
 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
 index d5ad04dad081..927ba61e5bf9 100644
 --- a/drivers/mfd/Kconfig
 +++ b/drivers/mfd/Kconfig
 @@ -94,6 +94,7 @@ config MFD_AXP20X
  config MFD_CROS_EC
   tristate ChromeOS Embedded Controller
   select MFD_CORE
 + select CROS_EC_PROTO
   help
 If you say Y here you get support for the ChromeOS Embedded
 Controller (EC) providing keyboard, battery and power services.
 @@ -102,7 +103,7 @@ config MFD_CROS_EC
  
  config MFD_CROS_EC_I2C
   tristate ChromeOS Embedded Controller (I2C)
 - depends on MFD_CROS_EC  I2C
 + depends on MFD_CROS_EC  CROS_EC_PROTO  I2C
  
   help
 If you say Y here, you get support for talking to the ChromeOS
 @@ -112,7 +113,7 @@ config MFD_CROS_EC_I2C
  
  config MFD_CROS_EC_SPI
   tristate ChromeOS Embedded Controller (SPI)
 - depends on MFD_CROS_EC  SPI  OF
 + depends on MFD_CROS_EC  CROS_EC_PROTO  SPI  OF
  
   ---help---
 If you say Y here, you get support for talking to the ChromeOS EC
 diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c
 index 4a0f6dfcd376..d857f6a2b57b 100644
 --- a/drivers/mfd/cros_ec.c
 +++ b/drivers/mfd/cros_ec.c
 @@ -23,102 +23,6 @@
  #include linux/module.h
  #include linux/mfd/core.h
  #include linux/mfd/cros_ec.h
 -#include linux/mfd/cros_ec_commands.h
 -#include linux/delay.h
 -
 -#define EC_COMMAND_RETRIES   50
 -
 -int cros_ec_prepare_tx(struct cros_ec_device *ec_dev,
 -struct cros_ec_command *msg)
 -{
 - uint8_t *out;
 - int csum, i;
 -
 - BUG_ON(msg-outsize  EC_PROTO2_MAX_PARAM_SIZE);
 - out = ec_dev-dout;
 - out[0] = EC_CMD_VERSION0 + msg-version;
 - out[1] = msg-command;
 - out[2] = msg-outsize;
 - csum = out[0] + out[1] + out[2];
 - for (i = 0; i  msg-outsize; i++)
 - csum += out[EC_MSG_TX_HEADER_BYTES + i] = msg-data[i];
 - out[EC_MSG_TX_HEADER_BYTES + msg-outsize] = (uint8_t)(csum  0xff);
 -
 - return EC_MSG_TX_PROTO_BYTES + msg-outsize;
 -}
 -EXPORT_SYMBOL(cros_ec_prepare_tx);
 -
 -int cros_ec_check_result(struct cros_ec_device *ec_dev,
 -  struct cros_ec_command *msg)
 -{
 - switch (msg-result) {
 - case EC_RES_SUCCESS:
 - return 0;
 - case EC_RES_IN_PROGRESS:
 - dev_dbg(ec_dev-dev, command 0x%02x in progress\n,
 - msg-command);
 - return -EAGAIN;
 - default:
 - dev_dbg(ec_dev-dev, command 0x%02x returned %d\n,
 - msg-command, msg-result);
 - return 0;
 - }
 -}
 -EXPORT_SYMBOL(cros_ec_check_result);
 -
 -int 

Re: [PATCH v3 1/7] mfd: cros_ec: Use a zero-length array for command data

2015-05-27 Thread Lee Jones
On Fri, 22 May 2015, Javier Martinez Canillas wrote:

 Commit 1b84f2a4cd4a (mfd: cros_ec: Use fixed size arrays to transfer
 data with the EC) modified the struct cros_ec_command fields to not
 use pointers for the input and output buffers and use fixed length
 arrays instead.
 
 This change was made because the cros_ec ioctl API uses that struct
 cros_ec_command to allow user-space to send commands to the EC and
 to get data from the EC. So using pointers made the API not 64-bit
 safe. Unfortunately this approach was not flexible enough for all
 the use-cases since there may be a need to send larger commands
 on newer versions of the EC command protocol.
 
 So to avoid to choose a constant length that it may be too big for
 most commands and thus wasting memory and CPU cycles on copy from
 and to user-space or having a size that is too small for some big
 commands, use a zero-length array that is both 64-bit safe and
 flexible. The same buffer is used for both output and input data
 so the maximum of these values should be used to allocate it.
 
 Suggested-by: Gwendal Grignou gwen...@chromium.org
 Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 Tested-by: Heiko Stuebner he...@sntech.de
 ---
 
 Changes since v2:
  - Set the version field in the cros_ec_command. Reported by Heiko Stuebner
  - Use kmalloc/kfree instead of pre-allocating using variables in the stack.
Suggested by Lee Jones.
 
 Changes since v1:
  - Add Heiko Stuebner Tested-by tag
  - Removed a new blank line at EOF warning. Reported by Heiko Stuebner
  - Use kmalloc instead of kzalloc when the message is later initialized
Suggested by Gwendal Grignou
  - Pre-allocate struct cros_ec_command instead of dynamically allocate it
whenever is possible. Suggested by Gwendal Grignou
  - Pre-allocate buffers for the usual cases and only allocate dynamically
in the heap for bigger sizes. Suggested by Gwendal Grignou
  - Don't access the cros_ec_command received from user-space before doing
a copy_from_user. Suggested by Gwendal Grignou
  - Only copy from user-space outsize bytes and copy_to_user insize bytes
Suggested by Gwendal Grignou
  - ec_device_ioctl_xcmd() must return the numbers of bytes read and not 0
on success. Suggested by Gwendal Grignou
  - Rename alloc_cmd_msg to alloc_lightbar_cmd_msg. Suggested by Gwendal 
 Grignou
 ---
  drivers/i2c/busses/i2c-cros-ec-tunnel.c|  45 ++---
  drivers/input/keyboard/cros_ec_keyb.c  |  29 --
  drivers/mfd/cros_ec.c  |  28 --
  drivers/mfd/cros_ec_i2c.c  |   4 +-
  drivers/mfd/cros_ec_spi.c  |   2 +-

For the MFD changes:
 Acked-by: Lee Jones lee.jo...@linaro.org

  drivers/platform/chrome/cros_ec_dev.c  |  65 +++-
  drivers/platform/chrome/cros_ec_lightbar.c | 152 +++-
  drivers/platform/chrome/cros_ec_lpc.c  |   8 +-
  drivers/platform/chrome/cros_ec_sysfs.c| 154 
 ++---
  include/linux/mfd/cros_ec.h|   6 +-
  10 files changed, 318 insertions(+), 175 deletions(-)
 
 diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c 
 b/drivers/i2c/busses/i2c-cros-ec-tunnel.c
 index fa8dedd8c3a2..a0d95ff682ae 100644
 --- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c
 +++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c
 @@ -182,8 +182,9 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct 
 i2c_msg i2c_msgs[],
   const u16 bus_num = bus-remote_bus;
   int request_len;
   int response_len;
 + int alloc_size;
   int result;
 - struct cros_ec_command msg = { };
 + struct cros_ec_command *msg;
  
   request_len = ec_i2c_count_message(i2c_msgs, num);
   if (request_len  0) {
 @@ -198,25 +199,39 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct 
 i2c_msg i2c_msgs[],
   return response_len;
   }
  
 - result = ec_i2c_construct_message(msg.outdata, i2c_msgs, num, bus_num);
 - if (result)
 - return result;
 + alloc_size = max(request_len, response_len);
 + msg = kmalloc(sizeof(*msg) + alloc_size, GFP_KERNEL);
 + if (!msg)
 + return -ENOMEM;
  
 - msg.version = 0;
 - msg.command = EC_CMD_I2C_PASSTHRU;
 - msg.outsize = request_len;
 - msg.insize = response_len;
 + result = ec_i2c_construct_message(msg-data, i2c_msgs, num, bus_num);
 + if (result) {
 + dev_err(dev, Error constructing EC i2c message %d\n, result);
 + goto exit;
 + }
  
 - result = cros_ec_cmd_xfer(bus-ec, msg);
 - if (result  0)
 - return result;
 + msg-version = 0;
 + msg-command = EC_CMD_I2C_PASSTHRU;
 + msg-outsize = request_len;
 + msg-insize = response_len;
  
 - result = ec_i2c_parse_response(msg.indata, i2c_msgs, num);
 - if (result  0)
 - return result;
 + result = cros_ec_cmd_xfer(bus-ec, msg);
 + if (result  0) {
 + 

Re: [PATCH v7 12/13] drm/exynos: atomic dpms support

2015-05-27 Thread Inki Dae
Hi Gustavo,

On 2015년 05월 23일 00:40, Gustavo Padovan wrote:
 From: Gustavo Padovan gustavo.pado...@collabora.co.uk
 
 Run dpms operations through the atomic intefaces. This basically removes
 the .dpms() callback from econders and crtcs and use .disable() and
 .enable() to turn the crtc on and off.
 
 v2: Address comments by Joonyoung:
   - make hdmi code call -disable() instead of -dpms()
   - do not use WARN_ON on crtc enable/disable
 
 v3: - Fix build failure after the hdmi change in v2
 - Change dpms helper of ptn3460 bridge
 
 Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
 Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
 Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
 ---
  drivers/gpu/drm/bridge/ps8622.c |  2 +-
  drivers/gpu/drm/bridge/ptn3460.c|  2 +-
  drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
  drivers/gpu/drm/exynos/exynos_drm_crtc.c| 95 
 -
  drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
  drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
  drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
  drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++--
  drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
  drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +-
  10 files changed, 69 insertions(+), 75 deletions(-)
 
 diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
 index b604326..d686235 100644
 --- a/drivers/gpu/drm/bridge/ps8622.c
 +++ b/drivers/gpu/drm/bridge/ps8622.c
 @@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct drm_connector 
 *connector)
  }
  
  static const struct drm_connector_funcs ps8622_connector_funcs = {
 - .dpms = drm_helper_connector_dpms,
 + .dpms = drm_atomic_helper_connector_dpms,
   .fill_modes = drm_helper_probe_single_connector_modes,
   .detect = ps8622_detect,
   .destroy = ps8622_connector_destroy,
 diff --git a/drivers/gpu/drm/bridge/ptn3460.c 
 b/drivers/gpu/drm/bridge/ptn3460.c
 index 8ed3617..260bc9f 100644
 --- a/drivers/gpu/drm/bridge/ptn3460.c
 +++ b/drivers/gpu/drm/bridge/ptn3460.c
 @@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct 
 drm_connector *connector)
  }
  
  static struct drm_connector_funcs ptn3460_connector_funcs = {
 - .dpms = drm_helper_connector_dpms,
 + .dpms = drm_atomic_helper_connector_dpms,
   .fill_modes = drm_helper_probe_single_connector_modes,
   .detect = ptn3460_detect,
   .destroy = ptn3460_connector_destroy,
 diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
 b/drivers/gpu/drm/exynos/exynos_dp_core.c
 index 195fe60..c9995b1 100644
 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
 +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
 @@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
 drm_connector *connector)
  }
  

[--snip--]

  
  static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
 - .dpms   = exynos_drm_crtc_dpms,
 - .prepare= exynos_drm_crtc_prepare,
 - .commit = exynos_drm_crtc_commit,
 + .enable = exynos_drm_crtc_enable,
 + .disable= exynos_drm_crtc_disable,
   .mode_fixup = exynos_drm_crtc_mode_fixup,
   .mode_set   = drm_helper_crtc_mode_set,
   .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,

I think it'd be better to use atomic_flush callback to enable global dma
like commit callback did. Is there any reason that you don't use
atomic_begin and atomic_flush callbacks?

atomic relevant codes I looked into do as follows,

atomic_begin();

atomic_update();  /* this will call win_commit callback to set a overlay
relevant registers and enable its dma channel. */

atomic_flush();

So atomic overlay updating between atomic_begin() ~ atomic_flush() will
be guaranteed.

Thanks,
Inki Dae

   .mode_set_base  = drm_helper_crtc_mode_set_base,
 - .disable= exynos_drm_crtc_disable,
 + .atomic_check   = exynos_crtc_atomic_check,
  };
  

[--snip--]

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


Re: [PATCH v2] clocksource: exynos_mct: fix for sleeping in atomic ctx handling cpu hotplug notif.

2015-05-27 Thread Daniel Lezcano

On 05/25/2015 05:24 PM, Damian Eppel wrote:

On Mon, 2015-05-11 at 13:18 +0200, Daniel Lezcano wrote:


[ ... ]


The code sounds very complex for what it is supposed to do.

Perhaps I am missing something but you have more or less the same
functionality than the smp_twd timers and these ones don't look so complex.

Could you please look at the smp_twd.c implementation ?


Hi Daniel,

exynos_mct.c driver looks more complex as it supports two types of timer
interrupts - private and shared peripheral interrupts (for exynos4412
and exynos4210 accordingly). In smp_twd.c driver I can see only PPI type
of irqs supported. SPI and PPI irqs differs slightly in setup - thus two
different code paths appears in the driver in initialization and
handling of CPU notifications. The fix is addressing issue that appears
only for hardware using SPI irqs so it is hard to compare it to
smp_twd.c.
BTW, If we remove support for SPI irqs in exynos_mct.c it would look
almost the same as smp_twd.c.


Ok, thanks.

I will have a deeper look this afternoon.

  -- Daniel


--
 http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  http://www.facebook.com/pages/Linaro Facebook |
http://twitter.com/#!/linaroorg Twitter |
http://www.linaro.org/linaro-blog/ Blog

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


Re: [PATCH 1/5] drivers: soc: add support for exynos SROM driver

2015-05-27 Thread Krzysztof Kozlowski
W dniu 29.04.2015 o 17:38, Pankaj Dubey pisze:
 This patch adds Exynos SROM controller driver which will handle
 save restore of SROM registers during S2R.
 
 Change-Id: Iaddaaebc1d7090c9889e948e68e886519562c43c

Please remove it.

 Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
 ---
  drivers/soc/Kconfig   |   1 +
  drivers/soc/Makefile  |   1 +
  drivers/soc/samsung/Kconfig   |  14 
  drivers/soc/samsung/Makefile  |   1 +
  drivers/soc/samsung/exynos-srom.c | 142 
 ++
  drivers/soc/samsung/exynos-srom.h |  51 ++
  6 files changed, 210 insertions(+)
  create mode 100644 drivers/soc/samsung/Kconfig
  create mode 100644 drivers/soc/samsung/Makefile
  create mode 100644 drivers/soc/samsung/exynos-srom.c
  create mode 100644 drivers/soc/samsung/exynos-srom.h
 
 diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
 index 76d6bd4..c3abfbe 100644
 --- a/drivers/soc/Kconfig
 +++ b/drivers/soc/Kconfig
 @@ -1,6 +1,7 @@
  menu SOC (System On Chip) specific Drivers
  
  source drivers/soc/qcom/Kconfig
 +source drivers/soc/samsung/Kconfig
  source drivers/soc/ti/Kconfig
  source drivers/soc/versatile/Kconfig
  
 diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
 index 063113d..620366f 100644
 --- a/drivers/soc/Makefile
 +++ b/drivers/soc/Makefile
 @@ -3,6 +3,7 @@
  #
  
  obj-$(CONFIG_ARCH_QCOM)  += qcom/
 +obj-$(CONFIG_SOC_SAMSUNG)+= samsung/
  obj-$(CONFIG_ARCH_TEGRA) += tegra/
  obj-$(CONFIG_SOC_TI) += ti/
  obj-$(CONFIG_PLAT_VERSATILE) += versatile/
 diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig
 new file mode 100644
 index 000..b6fa4e6
 --- /dev/null
 +++ b/drivers/soc/samsung/Kconfig
 @@ -0,0 +1,14 @@
 +#
 +# SAMSUNG SoC drivers
 +#
 +menu Samsung SOC driver support
 +
 +config SOC_SAMSUNG
 + bool

Any reason for not using menuconfig?

 +
 +config EXYNOS_SROM
 + bool
 + depends on ARM  ARCH_EXYNOS
 + select SOC_BUS

Why we need to select SOC_BUS?

 +
 +endmenu
 diff --git a/drivers/soc/samsung/Makefile b/drivers/soc/samsung/Makefile
 new file mode 100644
 index 000..9c554d5
 --- /dev/null
 +++ b/drivers/soc/samsung/Makefile
 @@ -0,0 +1 @@
 +obj-$(CONFIG_EXYNOS_SROM)+= exynos-srom.o
 diff --git a/drivers/soc/samsung/exynos-srom.c 
 b/drivers/soc/samsung/exynos-srom.c
 new file mode 100644
 index 000..8aae762
 --- /dev/null
 +++ b/drivers/soc/samsung/exynos-srom.c
 @@ -0,0 +1,142 @@
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + * http://www.samsung.com/
 + *
 + * EXYNOS - SROM Controller support
 + * Author: Pankaj Dubey pankaj.du...@samsung.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +
 +#include linux/io.h
 +#include linux/of.h
 +#include linux/of_address.h
 +#include linux/of_platform.h
 +#include linux/platform_device.h
 +#include linux/slab.h
 +#include exynos-srom.h
 +
 +static void __iomem *exynos_srom_base;
 +
 +static unsigned long exynos_srom_offsets[] = {

static const

 + /* SROM side */
 + S5P_SROM_BW,
 + S5P_SROM_BC0,
 + S5P_SROM_BC1,
 + S5P_SROM_BC2,
 + S5P_SROM_BC3,
 +};
 +
 +/**
 + * struct exynos_srom_reg_dump: register dump of SROM Controller registers.
 + * @offset: srom register offset from the controller base address.
 + * @value: the value to be register at offset.

Maybe:
@value: the value of register under the offset

 + */
 +struct exynos_srom_reg_dump {
 + u32 offset;
 + u32 value;
 +};
 +
 +static struct exynos_srom_reg_dump *exynos_srom_regs;
 +
 +static struct exynos_srom_reg_dump *exynos_srom_alloc_reg_dump(
 + const unsigned long *rdump,
 + unsigned long nr_rdump)
 +{
 + struct exynos_srom_reg_dump *rd;
 + unsigned int i;
 +
 + rd = kcalloc(nr_rdump, sizeof(*rd), GFP_KERNEL);
 + if (!rd)
 + return NULL;
 +
 + for (i = 0; i  nr_rdump; ++i)
 + rd[i].offset = rdump[i];
 +
 + return rd;
 +}
 +
 +static void exynos_srom_save(void __iomem *base,
 + struct exynos_srom_reg_dump *rd,
 + unsigned int num_regs)
 +{
 + for (; num_regs  0; --num_regs, ++rd)
 + rd-value = readl(base + rd-offset);
 +
 +}
 +
 +static void exynos_srom_restore(void __iomem *base,
 +   const struct exynos_srom_reg_dump *rd,
 +   unsigned int num_regs)
 +{
 + for (; num_regs  0; --num_regs, ++rd)
 + writel(rd-value, base + rd-offset);
 +
 +}
 +
 +static const struct of_device_id of_exynos_srom_ids[] = {
 + {
 + .compatible = samsung,exynos-srom,
 + },
 + {},
 +};
 +
 +static int exynos_srom_probe(struct platform_device *pdev)
 +{
 + struct device_node 

Re: [PATCH 4/5] ARM: EXYNOS: DTS: add SROM device node for exynos5

2015-05-27 Thread Krzysztof Kozlowski
W dniu 29.04.2015 o 17:38, Pankaj Dubey pisze:
 Add SROM device node for exynos5.

All comments from 3/5 apply here also.

Best regards,
Krzysztof

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


Re: [PATCH 3/5] ARM: EXYNOS: DTS: add SROM device node for exynos4

2015-05-27 Thread Krzysztof Kozlowski
W dniu 29.04.2015 o 17:38, Pankaj Dubey pisze:
 Add SROM device node for exynos4.

Subject prefix: ARM: dts:

 
 CC: Rob Herring robh...@kernel.org
 CC: Mark Rutland mark.rutl...@arm.com
 CC: Ian Campbell ijc+devicet...@hellion.org.uk
 Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
 ---
  arch/arm/boot/dts/exynos4.dtsi | 5 +
  1 file changed, 5 insertions(+)
 
 diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
 index 77ea547..48490ea 100644
 --- a/arch/arm/boot/dts/exynos4.dtsi
 +++ b/arch/arm/boot/dts/exynos4.dtsi
 @@ -76,6 +76,11 @@
   reg = 0x1000 0x100;
   };
  
 + sromc@1257 {
 + compatible = samsung,exynos-srom;
 + reg = 0x1257 0x100;

There are 5 registers, so size of 0x100 seems to be bigger than needed.
Maybe limit it to actual length?

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


Re: [PATCH 2/5] ARM: EXYNOS: Remove SROM related register settings from mach-exynos

2015-05-27 Thread Krzysztof Kozlowski
W dniu 29.04.2015 o 17:38, Pankaj Dubey pisze:
 As now we have dedicated driver for SROM controller, it will take care
 of saving register banks during S2R so we can safely remove these
 settings from mach-exynos.
 
 Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com
 ---
  arch/arm/mach-exynos/Kconfig   |  2 +
  arch/arm/mach-exynos/exynos.c  | 10 -
  arch/arm/mach-exynos/include/mach/map.h|  3 --
  arch/arm/mach-exynos/suspend.c | 20 +-
  arch/arm/plat-samsung/include/plat/map-s5p.h   |  1 -
  arch/arm/plat-samsung/include/plat/regs-srom.h | 54 
 --
  6 files changed, 4 insertions(+), 86 deletions(-)
  delete mode 100644 arch/arm/plat-samsung/include/plat/regs-srom.h
 
 diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
 index 603820e..e842b23 100644
 --- a/arch/arm/mach-exynos/Kconfig
 +++ b/arch/arm/mach-exynos/Kconfig
 @@ -25,6 +25,8 @@ menuconfig ARCH_EXYNOS
   select S5P_DEV_MFC
   select SRAM
   select MFD_SYSCON
 + select SOC_SAMSUNG
 + select EXYNOS_SROM

What about the difference of execution time? The suspend/resume of
device may not be called in the same time as previous syscore ops. Does
this have any impact?

Best regards,
Krzysztof

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


[PATCH] ARM: dts: add exynos5422.dtsi to correct cpu order

2015-05-27 Thread Chanho Park
The odroid-xu3 board which is based on exynos5422 not exynos5800 is
booted from cortex-a7 core unlike exynos5800. The odroid-xu3's cpu order
is quite strange. cpu0 and cpu5-7 are cortex-a7 cores and cpu1-4 are
cortex-a15 cores. To correct this mis-odering, I added exynos5422.dtsi
and reversing cpu orders from exynos5420. Now, cpu0-3 are cortex-a7 and
cpu4-7 are cortex-a15.

Signed-off-by: Chanho Park chanho61.p...@samsung.com
---
 arch/arm/boot/dts/exynos5422-odroidxu3.dts |  5 +-
 arch/arm/boot/dts/exynos5422.dtsi  | 88 ++
 2 files changed, 91 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/boot/dts/exynos5422.dtsi

diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts 
b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
index edc25cf..0f0784b 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts
+++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
@@ -11,11 +11,12 @@
 */
 
 /dts-v1/;
-#include exynos5800.dtsi
+#include exynos5422.dtsi
 
 / {
model = Hardkernel Odroid XU3;
-   compatible = hardkernel,odroid-xu3, samsung,exynos5800, 
samsung,exynos5;
+   compatible = hardkernel,odroid-xu3, samsung,exynos5800,
+samsung,exynos5422, samsung,exynos5;
 
memory {
reg = 0x4000 0x7EA0;
diff --git a/arch/arm/boot/dts/exynos5422.dtsi 
b/arch/arm/boot/dts/exynos5422.dtsi
new file mode 100644
index 000..3ac12bc
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5422.dtsi
@@ -0,0 +1,88 @@
+/*
+ * SAMSUNG EXYNOS5422 SoC device tree source
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * The only difference between EXYNOS5422 and EXYNOS5800 is cpu ordering. The
+ * EXYNOS5422 is booting from Cortex-A7 core while the EXYNOS5800 is booting
+ * from Cortex-A15 core.
+ *
+ * EXYNOS5422 based board files can include this file and provide
+ * values for board specfic bindings.
+ *
+ * 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.
+ */
+
+#include exynos5800.dtsi
+
+/ {
+   compatible = samsung,exynos5800, samsung,exynos5422,
+samsung,exynos5;
+};
+
+cpu0 {
+   device_type = cpu;
+   compatible = arm,cortex-a7;
+   reg = 0x100;
+   clock-frequency = 10;
+   cci-control-port = cci_control0;
+};
+
+cpu1 {
+   device_type = cpu;
+   compatible = arm,cortex-a7;
+   reg = 0x101;
+   clock-frequency = 10;
+   cci-control-port = cci_control0;
+};
+
+cpu2 {
+   device_type = cpu;
+   compatible = arm,cortex-a7;
+   reg = 0x102;
+   clock-frequency = 10;
+   cci-control-port = cci_control0;
+};
+
+cpu3 {
+   device_type = cpu;
+   compatible = arm,cortex-a7;
+   reg = 0x103;
+   clock-frequency = 10;
+   cci-control-port = cci_control0;
+};
+
+cpu4 {
+   device_type = cpu;
+   compatible = arm,cortex-a15;
+   reg = 0x0;
+   clock-frequency = 18;
+   cci-control-port = cci_control1;
+};
+
+cpu5 {
+   device_type = cpu;
+   compatible = arm,cortex-a15;
+   reg = 0x1;
+   clock-frequency = 18;
+   cci-control-port = cci_control1;
+};
+
+cpu6 {
+   device_type = cpu;
+   compatible = arm,cortex-a15;
+   reg = 0x2;
+   clock-frequency = 18;
+   cci-control-port = cci_control1;
+};
+
+cpu7 {
+   device_type = cpu;
+   compatible = arm,cortex-a15;
+   reg = 0x3;
+   clock-frequency = 18;
+   cci-control-port = cci_control1;
+};
-- 
1.9.1

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


Re: [PATCH v7 02/13] drm/exynos: atomic phase 1: use drm_plane_helper_update()

2015-05-27 Thread Gustavo Padovan
Hi Joonyoung,

2015-05-27 Joonyoung Shim jy0922.s...@samsung.com:

 On 05/23/2015 12:40 AM, Gustavo Padovan wrote:
  From: Gustavo Padovan gustavo.pado...@collabora.co.uk
  
  Rip out the check from exynos_update_plane() and create
  exynos_check_plane() for the check phase enabling use to use
  the atomic helpers to call our check and update phases when updating
  planes.
  
  Update all users of exynos_update_plane() accordingly to call
  exynos_check_plane() before.
  
  Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
  Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
  Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.dey
  ---
   drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 23 ++
   drivers/gpu/drm/exynos/exynos_drm_plane.c | 40 
  +++
   drivers/gpu/drm/exynos/exynos_drm_plane.h |  2 +-
   3 files changed, 50 insertions(+), 15 deletions(-)
  
  diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
  b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
  index 363b019..27cc450 100644
  --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
  +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
  @@ -116,6 +116,7 @@ static int exynos_drm_crtc_mode_set_base(struct 
  drm_crtc *crtc, int x, int y,
  struct drm_framebuffer *fb = crtc-primary-fb;
  unsigned int crtc_w;
  unsigned int crtc_h;
  +   int ret;
   
  /* when framebuffer changing is requested, crtc's dpms should be on */
  if (exynos_crtc-dpms  DRM_MODE_DPMS_ON) {
  @@ -123,12 +124,17 @@ static int exynos_drm_crtc_mode_set_base(struct 
  drm_crtc *crtc, int x, int y,
  return -EPERM;
  }
   
  +   ret = exynos_check_plane(crtc-primary, fb);
  +   if (ret)
  +   return ret;
  +
  crtc_w = fb-width - x;
  crtc_h = fb-height - y;
  +   exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
  +   crtc_w, crtc_h, x  16, y  16,
  +   crtc_w  16, crtc_h  16);
   
  -   return exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
  -  crtc_w, crtc_h, x  16, y  16,
  -  crtc_w  16, crtc_h  16);
  +   return 0;
   }
   
   static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
  @@ -165,7 +171,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
  *crtc,
   {
  struct drm_device *dev = crtc-dev;
  struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
  -   struct drm_framebuffer *old_fb = crtc-primary-fb;
  unsigned int crtc_w, crtc_h;
  int ret;
   
  @@ -184,6 +189,10 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
  *crtc,
  goto out;
  }
   
  +   ret = exynos_check_plane(crtc-primary, fb);
  +   if (ret)
  +   goto out;
  +
  ret = drm_vblank_get(dev, exynos_crtc-pipe);
  if (ret) {
  DRM_DEBUG(failed to acquire vblank counter\n);
  @@ -202,6 +211,7 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
  *crtc,
  crtc-primary-fb = fb;
  crtc_w = fb-width - crtc-x;
  crtc_h = fb-height - crtc-y;
  + HEAD
  ret = exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
crtc_w, crtc_h, crtc-x  16, crtc-y  16,
crtc_w  16, crtc_h  16);
  @@ -213,6 +223,11 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
  *crtc,
  spin_unlock_irq(dev-event_lock);
  return ret;
  }
  +===
  +   exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
  +   crtc_w, crtc_h, crtc-x, crtc-y,
  +   crtc_w, crtc_h);
  + 2f6d1f4... drm/exynos: atomic phase 1: use 
  drm_plane_helper_update()
 
 Maybe unhandled output of merge, could you fix it?

Sure. Fixed.

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


Re: [PATCH v7 12/13] drm/exynos: atomic dpms support

2015-05-27 Thread Gustavo Padovan
Hi Joonyoung,

2015-05-27 Joonyoung Shim jy0922.s...@samsung.com:

 Hi Gustavo,
 
 Sorry, i was missing some review points.
 
 On 05/23/2015 12:40 AM, Gustavo Padovan wrote:
  From: Gustavo Padovan gustavo.pado...@collabora.co.uk
  
  Run dpms operations through the atomic intefaces. This basically removes
  the .dpms() callback from econders and crtcs and use .disable() and
  .enable() to turn the crtc on and off.
  
  v2: Address comments by Joonyoung:
  - make hdmi code call -disable() instead of -dpms()
  - do not use WARN_ON on crtc enable/disable
  
  v3: - Fix build failure after the hdmi change in v2
  - Change dpms helper of ptn3460 bridge
  
  Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
  Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
  Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
  ---
   drivers/gpu/drm/bridge/ps8622.c |  2 +-
   drivers/gpu/drm/bridge/ptn3460.c|  2 +-
   drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
   drivers/gpu/drm/exynos/exynos_drm_crtc.c| 95 
  -
   drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
   drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
   drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
   drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++--
   drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
   drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +-
   10 files changed, 69 insertions(+), 75 deletions(-)
  
  diff --git a/drivers/gpu/drm/bridge/ps8622.c 
  b/drivers/gpu/drm/bridge/ps8622.c
  index b604326..d686235 100644
  --- a/drivers/gpu/drm/bridge/ps8622.c
  +++ b/drivers/gpu/drm/bridge/ps8622.c
  @@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct 
  drm_connector *connector)
   }
   
   static const struct drm_connector_funcs ps8622_connector_funcs = {
  -   .dpms = drm_helper_connector_dpms,
  +   .dpms = drm_atomic_helper_connector_dpms,
  .fill_modes = drm_helper_probe_single_connector_modes,
  .detect = ps8622_detect,
  .destroy = ps8622_connector_destroy,
  diff --git a/drivers/gpu/drm/bridge/ptn3460.c 
  b/drivers/gpu/drm/bridge/ptn3460.c
  index 8ed3617..260bc9f 100644
  --- a/drivers/gpu/drm/bridge/ptn3460.c
  +++ b/drivers/gpu/drm/bridge/ptn3460.c
  @@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct 
  drm_connector *connector)
   }
   
   static struct drm_connector_funcs ptn3460_connector_funcs = {
  -   .dpms = drm_helper_connector_dpms,
  +   .dpms = drm_atomic_helper_connector_dpms,
  .fill_modes = drm_helper_probe_single_connector_modes,
  .detect = ptn3460_detect,
  .destroy = ptn3460_connector_destroy,
  diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
  b/drivers/gpu/drm/exynos/exynos_dp_core.c
  index 195fe60..c9995b1 100644
  --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
  +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
  @@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
  drm_connector *connector)
   }
   
   static struct drm_connector_funcs exynos_dp_connector_funcs = {
  -   .dpms = drm_helper_connector_dpms,
  +   .dpms = drm_atomic_helper_connector_dpms,
  .fill_modes = drm_helper_probe_single_connector_modes,
  .detect = exynos_dp_detect,
  .destroy = exynos_dp_connector_destroy,
  diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
  b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
  index fd5ef2c..ca501a9 100644
  --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
  +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
  @@ -22,48 +22,54 @@
   #include exynos_drm_encoder.h
   #include exynos_drm_plane.h
   
  -static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
  +static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
   {
  struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
  +   struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc-primary);
   
  -   DRM_DEBUG_KMS(crtc[%d] mode[%d]\n, crtc-base.id, mode);
  -
  -   if (exynos_crtc-dpms == mode) {
  -   DRM_DEBUG_KMS(desired dpms mode is same as previous one.\n);
  +   if (exynos_crtc-enabled)
  return;
  -   }
  -
  -   if (mode  DRM_MODE_DPMS_ON) {
  -   /* wait for the completion of page flip. */
  -   if (!wait_event_timeout(exynos_crtc-pending_flip_queue,
  -   (exynos_crtc-event == NULL), HZ/20))
  -   exynos_crtc-event = NULL;
  -   drm_crtc_vblank_off(crtc);
  -   }
   
  if (exynos_crtc-ops-dpms)
  -   exynos_crtc-ops-dpms(exynos_crtc, mode);
  +   exynos_crtc-ops-dpms(exynos_crtc, DRM_MODE_DPMS_ON);
   
  -   exynos_crtc-dpms = mode;
  +   exynos_crtc-enabled = true;
   
  -   if (mode == DRM_MODE_DPMS_ON)
  -   drm_crtc_vblank_on(crtc);
  -}
  +   drm_crtc_vblank_on(crtc);
   
  -static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
  -{
  -   /* drm framework doesn't check NULL. */
  +   if (exynos_crtc-ops-win_commit)
  + 

Re: [PATCH v7 12/13] drm/exynos: atomic dpms support

2015-05-27 Thread Gustavo Padovan
Hi Inki,

2015-05-27 Inki Dae inki@samsung.com:

 Hi Gustavo,
 
 On 2015년 05월 23일 00:40, Gustavo Padovan wrote:
  From: Gustavo Padovan gustavo.pado...@collabora.co.uk
  
  Run dpms operations through the atomic intefaces. This basically removes
  the .dpms() callback from econders and crtcs and use .disable() and
  .enable() to turn the crtc on and off.
  
  v2: Address comments by Joonyoung:
  - make hdmi code call -disable() instead of -dpms()
  - do not use WARN_ON on crtc enable/disable
  
  v3: - Fix build failure after the hdmi change in v2
  - Change dpms helper of ptn3460 bridge
  
  Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
  Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
  Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
  ---
   drivers/gpu/drm/bridge/ps8622.c |  2 +-
   drivers/gpu/drm/bridge/ptn3460.c|  2 +-
   drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
   drivers/gpu/drm/exynos/exynos_drm_crtc.c| 95 
  -
   drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
   drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
   drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
   drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++--
   drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
   drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +-
   10 files changed, 69 insertions(+), 75 deletions(-)
  
  diff --git a/drivers/gpu/drm/bridge/ps8622.c 
  b/drivers/gpu/drm/bridge/ps8622.c
  index b604326..d686235 100644
  --- a/drivers/gpu/drm/bridge/ps8622.c
  +++ b/drivers/gpu/drm/bridge/ps8622.c
  @@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct 
  drm_connector *connector)
   }
   
   static const struct drm_connector_funcs ps8622_connector_funcs = {
  -   .dpms = drm_helper_connector_dpms,
  +   .dpms = drm_atomic_helper_connector_dpms,
  .fill_modes = drm_helper_probe_single_connector_modes,
  .detect = ps8622_detect,
  .destroy = ps8622_connector_destroy,
  diff --git a/drivers/gpu/drm/bridge/ptn3460.c 
  b/drivers/gpu/drm/bridge/ptn3460.c
  index 8ed3617..260bc9f 100644
  --- a/drivers/gpu/drm/bridge/ptn3460.c
  +++ b/drivers/gpu/drm/bridge/ptn3460.c
  @@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct 
  drm_connector *connector)
   }
   
   static struct drm_connector_funcs ptn3460_connector_funcs = {
  -   .dpms = drm_helper_connector_dpms,
  +   .dpms = drm_atomic_helper_connector_dpms,
  .fill_modes = drm_helper_probe_single_connector_modes,
  .detect = ptn3460_detect,
  .destroy = ptn3460_connector_destroy,
  diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
  b/drivers/gpu/drm/exynos/exynos_dp_core.c
  index 195fe60..c9995b1 100644
  --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
  +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
  @@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
  drm_connector *connector)
   }
   
 
 [--snip--]
 
   
   static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
  -   .dpms   = exynos_drm_crtc_dpms,
  -   .prepare= exynos_drm_crtc_prepare,
  -   .commit = exynos_drm_crtc_commit,
  +   .enable = exynos_drm_crtc_enable,
  +   .disable= exynos_drm_crtc_disable,
  .mode_fixup = exynos_drm_crtc_mode_fixup,
  .mode_set   = drm_helper_crtc_mode_set,
  .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
 
 I think it'd be better to use atomic_flush callback to enable global dma
 like commit callback did. Is there any reason that you don't use
 atomic_begin and atomic_flush callbacks?
 
 atomic relevant codes I looked into do as follows,
 
 atomic_begin();
 
 atomic_update();  /* this will call win_commit callback to set a overlay
 relevant registers and enable its dma channel. */
 
 atomic_flush();
 
 So atomic overlay updating between atomic_begin() ~ atomic_flush() will
 be guaranteed.

I think we can go down that road, but I'd suggest we push the atomic
patches v8 (with the lastest comments from Joonyoung fixed) and then 
work on the change you are proposing as a follow-up together with the 
other improvements for atomic I already have queued here. This way
we don't take the risk of missing one more merge window.

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


[PATCH v8 02/14] drm/exynos: atomic phase 1: use drm_plane_helper_update()

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Rip out the check from exynos_update_plane() and create
exynos_check_plane() for the check phase enabling use to use
the atomic helpers to call our check and update phases when updating
planes.

Update all users of exynos_update_plane() accordingly to call
exynos_check_plane() before.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.dey
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 31 
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 40 +++
 drivers/gpu/drm/exynos/exynos_drm_plane.h |  2 +-
 3 files changed, 47 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 363b019..ba44c9b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -116,6 +116,7 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc 
*crtc, int x, int y,
struct drm_framebuffer *fb = crtc-primary-fb;
unsigned int crtc_w;
unsigned int crtc_h;
+   int ret;
 
/* when framebuffer changing is requested, crtc's dpms should be on */
if (exynos_crtc-dpms  DRM_MODE_DPMS_ON) {
@@ -123,12 +124,17 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc 
*crtc, int x, int y,
return -EPERM;
}
 
+   ret = exynos_check_plane(crtc-primary, fb);
+   if (ret)
+   return ret;
+
crtc_w = fb-width - x;
crtc_h = fb-height - y;
+   exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
+   crtc_w, crtc_h, x  16, y  16,
+   crtc_w  16, crtc_h  16);
 
-   return exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
-  crtc_w, crtc_h, x  16, y  16,
-  crtc_w  16, crtc_h  16);
+   return 0;
 }
 
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
@@ -165,7 +171,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
 {
struct drm_device *dev = crtc-dev;
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct drm_framebuffer *old_fb = crtc-primary-fb;
unsigned int crtc_w, crtc_h;
int ret;
 
@@ -184,6 +189,10 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
goto out;
}
 
+   ret = exynos_check_plane(crtc-primary, fb);
+   if (ret)
+   goto out;
+
ret = drm_vblank_get(dev, exynos_crtc-pipe);
if (ret) {
DRM_DEBUG(failed to acquire vblank counter\n);
@@ -202,17 +211,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
crtc-primary-fb = fb;
crtc_w = fb-width - crtc-x;
crtc_h = fb-height - crtc-y;
-   ret = exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
- crtc_w, crtc_h, crtc-x  16, crtc-y  16,
- crtc_w  16, crtc_h  16);
-   if (ret) {
-   crtc-primary-fb = old_fb;
-   spin_lock_irq(dev-event_lock);
-   exynos_crtc-event = NULL;
-   drm_vblank_put(dev, exynos_crtc-pipe);
-   spin_unlock_irq(dev-event_lock);
-   return ret;
-   }
+   exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
+   crtc_w, crtc_h, crtc-x  16, crtc-y  16,
+   crtc_w  16, crtc_h  16);
 
return 0;
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index b1180fb..b218b7a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -144,21 +144,15 @@ void exynos_plane_mode_set(struct drm_plane *plane, 
struct drm_crtc *crtc,
plane-crtc = crtc;
 }
 
-int
+void
 exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 struct drm_framebuffer *fb, int crtc_x, int crtc_y,
 unsigned int crtc_w, unsigned int crtc_h,
 uint32_t src_x, uint32_t src_y,
 uint32_t src_w, uint32_t src_h)
 {
-
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-   int ret;
-
-   ret = exynos_check_plane(plane, fb);
-   if (ret  0)
-   return ret;
 
exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
  crtc_w, crtc_h, src_x  16, src_y  16,
@@ -166,8 +160,6 @@ exynos_update_plane(struct drm_plane *plane, struct 
drm_crtc *crtc,
 
if (exynos_crtc-ops-win_commit)
exynos_crtc-ops-win_commit(exynos_crtc, exynos_plane-zpos);
-
-   return 0;
 }
 
 static int exynos_disable_plane(struct drm_plane *plane)
@@ 

[PATCH v8 03/14] drm/exynos: atomic phase 1: use drm_plane_helper_disable()

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

The atomic helper to disable planes also uses the optional
.atomic_disable() helper. The unique operation it does is calling
.win_disable()

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 32 ++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index b218b7a..a0fdfe2 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -67,6 +67,9 @@ int exynos_check_plane(struct drm_plane *plane, struct 
drm_framebuffer *fb)
int nr;
int i;
 
+   if (!fb)
+   return 0;
+
nr = exynos_drm_fb_get_buf_cnt(fb);
for (i = 0; i  nr; i++) {
struct exynos_drm_gem_buf *buffer = exynos_drm_fb_buffer(fb, i);
@@ -162,21 +165,9 @@ exynos_update_plane(struct drm_plane *plane, struct 
drm_crtc *crtc,
exynos_crtc-ops-win_commit(exynos_crtc, exynos_plane-zpos);
 }
 
-static int exynos_disable_plane(struct drm_plane *plane)
-{
-   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(plane-crtc);
-
-   if (exynos_crtc  exynos_crtc-ops-win_disable)
-   exynos_crtc-ops-win_disable(exynos_crtc,
- exynos_plane-zpos);
-
-   return 0;
-}
-
 static struct drm_plane_funcs exynos_plane_funcs = {
.update_plane   = drm_plane_helper_update,
-   .disable_plane  = exynos_disable_plane,
+   .disable_plane  = drm_plane_helper_disable,
.destroy= drm_plane_cleanup,
 };
 
@@ -201,9 +192,24 @@ static void exynos_plane_atomic_update(struct drm_plane 
*plane,
state-src_w  16, state-src_h  16);
 }
 
+static void exynos_plane_atomic_disable(struct drm_plane *plane,
+   struct drm_plane_state *old_state)
+{
+   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
+   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(old_state-crtc);
+
+   if (!old_state-crtc)
+   return;
+
+   if (exynos_crtc-ops-win_disable)
+   exynos_crtc-ops-win_disable(exynos_crtc,
+ exynos_plane-zpos);
+}
+
 static const struct drm_plane_helper_funcs plane_helper_funcs = {
.atomic_check = exynos_plane_atomic_check,
.atomic_update = exynos_plane_atomic_update,
+   .atomic_disable = exynos_plane_atomic_disable,
 };
 
 static void exynos_plane_attach_zpos_property(struct drm_plane *plane,
-- 
2.1.0

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


[PATCH v8 00/14] drm/exynos: atomic modesetting support

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Hi,

Here goes the full support for atomic modesetting on exynos. I've
split the patches in the various phases of atomic support.

v2: fixes comments by Joonyoung
- remove unused var in patch 09
- use -disable instead of outdated -dpms in hdmi code
- remove WARN_ON from crtc enable/disable

v3: fixes comment by Joonyoung
- move the removal of drm_helper_disable_unused_functions() to
separated patch

v4: add patches that remove unnecessary calls to disable_plane()

v5: fixes NULL CRTC crash on planes updates (reported by Inki and Tobias)

v6: rebase on latest exynos_drm_next

v7: fix comments by Joonyoung
- fix two checkpatch errors
- remove extra crtc-commit() call
- check for null fb on exynos_check_plane()

v8: fix comments by Joonyoung
- fix merge error
- move drm_crtc_vblank_get to the commit that introduces atomic 
pageflip 
- remove .prepare() in the apropiated patch
- add a new patch to move exynos_drm_crtc_disable()

Gustavo Padovan (13):
  drm/exynos: atomic phase 1: use drm_plane_helper_update()
  drm/exynos: atomic phase 1: use drm_plane_helper_disable()
  drm/exynos: atomic phase 1: add .mode_set_nofb() callback
  drm/exynos: atomic phase 2: wire up state reset(), duplicate() and
destroy()
  drm/exynos: atomic phase 2: keep track of framebuffer pointer
  drm/exynos: atomic phase 3: atomic updates of planes
  drm/exynos: atomic phase 3: use atomic .set_config helper
  drm/exynos: atomic phase 3: convert page flips
  drm/exynos: remove exported functions from exynos_drm_plane
  drm/exynos: don't disable unused functions at init
  drm/exynos: move exynos_drm_crtc_disable()
  drm/exynos: atomic dpms support
  drm/exynos: remove unnecessary calls to disable_plane()

Joonyoung Shim (1):
  drm/exynos: fix source data argument for plane

 drivers/gpu/drm/bridge/ps8622.c |   6 +-
 drivers/gpu/drm/bridge/ptn3460.c|   6 +-
 drivers/gpu/drm/exynos/exynos_dp_core.c |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c| 202 +++-
 drivers/gpu/drm/exynos/exynos_drm_dpi.c |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c |   2 +
 drivers/gpu/drm/exynos/exynos_drm_drv.h |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c |  35 +
 drivers/gpu/drm/exynos/exynos_drm_fb.c  |  10 ++
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c   |   3 -
 drivers/gpu/drm/exynos/exynos_drm_plane.c   | 124 +
 drivers/gpu/drm/exynos/exynos_drm_plane.h   |  11 --
 drivers/gpu/drm/exynos/exynos_drm_vidi.c|   6 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c|  10 +-
 15 files changed, 173 insertions(+), 264 deletions(-)

-- 
2.1.0

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


[PATCH v8 06/14] drm/exynos: atomic phase 2: keep track of framebuffer pointer

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Use drm_atomic_set_fb_for_plane() in the legacy page_flip path to keep
track of the framebuffer pointer and reference.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 5bfee9b..fe77516 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -171,6 +171,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
crtc_w, crtc_h, crtc-x  16, crtc-y  16,
crtc_w  16, crtc_h  16);
 
+   if (crtc-primary-state)
+   drm_atomic_set_fb_for_plane(crtc-primary-state, fb);
+
return 0;
 
 out:
-- 
2.1.0

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


[PATCH v8 08/14] drm/exynos: atomic phase 3: use atomic .set_config helper

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Now that phase 1 and 2 are complete switch .set_config helper to
use the atomic one.

v2: also remove .prepare() callback

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index fe77516..c490064 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -50,11 +50,6 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int 
mode)
drm_crtc_vblank_on(crtc);
 }
 
-static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
-{
-   /* drm framework doesn't check NULL. */
-}
-
 static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
@@ -111,7 +106,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 
 static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
.dpms   = exynos_drm_crtc_dpms,
-   .prepare= exynos_drm_crtc_prepare,
.commit = exynos_drm_crtc_commit,
.mode_fixup = exynos_drm_crtc_mode_fixup,
.mode_set   = drm_helper_crtc_mode_set,
@@ -193,7 +187,7 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 }
 
 static struct drm_crtc_funcs exynos_crtc_funcs = {
-   .set_config = drm_crtc_helper_set_config,
+   .set_config = drm_atomic_helper_set_config,
.page_flip  = exynos_drm_crtc_page_flip,
.destroy= exynos_drm_crtc_destroy,
.reset = drm_atomic_helper_crtc_reset,
-- 
2.1.0

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


[PATCH v8 07/14] drm/exynos: atomic phase 3: atomic updates of planes

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Now that phase 1 and 2 are complete we can switch the update/disable_plane
callbacks to their atomic version.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
---
 drivers/gpu/drm/exynos/exynos_drm_fb.c| 3 +++
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 142eb4e..19c0642 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -16,6 +16,7 @@
 #include drm/drm_crtc.h
 #include drm/drm_crtc_helper.h
 #include drm/drm_fb_helper.h
+#include drm/drm_atomic_helper.h
 #include uapi/drm/exynos_drm.h
 
 #include exynos_drm_drv.h
@@ -268,6 +269,8 @@ static void exynos_drm_output_poll_changed(struct 
drm_device *dev)
 static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
.fb_create = exynos_user_fb_create,
.output_poll_changed = exynos_drm_output_poll_changed,
+   .atomic_check = drm_atomic_helper_check,
+   .atomic_commit = drm_atomic_helper_commit,
 };
 
 void exynos_drm_mode_config_init(struct drm_device *dev)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 43ada86..e052c72 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -167,8 +167,8 @@ exynos_update_plane(struct drm_plane *plane, struct 
drm_crtc *crtc,
 }
 
 static struct drm_plane_funcs exynos_plane_funcs = {
-   .update_plane   = drm_plane_helper_update,
-   .disable_plane  = drm_plane_helper_disable,
+   .update_plane   = drm_atomic_helper_update_plane,
+   .disable_plane  = drm_atomic_helper_disable_plane,
.destroy= drm_plane_cleanup,
.reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
-- 
2.1.0

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


[PATCH v8 04/14] drm/exynos: atomic phase 1: add .mode_set_nofb() callback

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

The new atomic infrastructure needs the .mode_set_nofb() callback to
update CRTC timings before setting any plane.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 64 +---
 1 file changed, 9 insertions(+), 55 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index ba44c9b..c524f0c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -62,9 +62,6 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
 
if (exynos_crtc-ops-win_commit)
exynos_crtc-ops-win_commit(exynos_crtc, exynos_plane-zpos);
-
-   if (exynos_crtc-ops-commit)
-   exynos_crtc-ops-commit(exynos_crtc);
 }
 
 static bool
@@ -81,60 +78,16 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
return true;
 }
 
-static int
-exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode, int x, int y,
- struct drm_framebuffer *old_fb)
-{
-   struct drm_framebuffer *fb = crtc-primary-fb;
-   unsigned int crtc_w;
-   unsigned int crtc_h;
-   int ret;
-
-   /*
-* copy the mode data adjusted by mode_fixup() into crtc-mode
-* so that hardware can be seet to proper mode.
-*/
-   memcpy(crtc-mode, adjusted_mode, sizeof(*adjusted_mode));
-
-   ret = exynos_check_plane(crtc-primary, fb);
-   if (ret  0)
-   return ret;
-
-   crtc_w = fb-width - x;
-   crtc_h = fb-height - y;
-   exynos_plane_mode_set(crtc-primary, crtc, fb, 0, 0,
- crtc_w, crtc_h, x, y, crtc_w, crtc_h);
-
-   return 0;
-}
-
-static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
- struct drm_framebuffer *old_fb)
+static void
+exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct drm_framebuffer *fb = crtc-primary-fb;
-   unsigned int crtc_w;
-   unsigned int crtc_h;
-   int ret;
-
-   /* when framebuffer changing is requested, crtc's dpms should be on */
-   if (exynos_crtc-dpms  DRM_MODE_DPMS_ON) {
-   DRM_ERROR(failed framebuffer changing request.\n);
-   return -EPERM;
-   }
 
-   ret = exynos_check_plane(crtc-primary, fb);
-   if (ret)
-   return ret;
-
-   crtc_w = fb-width - x;
-   crtc_h = fb-height - y;
-   exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
-   crtc_w, crtc_h, x  16, y  16,
-   crtc_w  16, crtc_h  16);
+   if (WARN_ON(!crtc-state))
+   return;
 
-   return 0;
+   if (exynos_crtc-ops-commit)
+   exynos_crtc-ops-commit(exynos_crtc);
 }
 
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
@@ -159,8 +112,9 @@ static struct drm_crtc_helper_funcs 
exynos_crtc_helper_funcs = {
.prepare= exynos_drm_crtc_prepare,
.commit = exynos_drm_crtc_commit,
.mode_fixup = exynos_drm_crtc_mode_fixup,
-   .mode_set   = exynos_drm_crtc_mode_set,
-   .mode_set_base  = exynos_drm_crtc_mode_set_base,
+   .mode_set   = drm_helper_crtc_mode_set,
+   .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
+   .mode_set_base  = drm_helper_crtc_mode_set_base,
.disable= exynos_drm_crtc_disable,
 };
 
-- 
2.1.0

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


[PATCH v8 01/14] drm/exynos: fix source data argument for plane

2015-05-27 Thread Gustavo Padovan
From: Joonyoung Shim jy0922.s...@samsung.com

The exynos_update_plane function needs 16.16 fixed point source data.

Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com
Reviewed-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 9006b94..363b019 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -127,7 +127,8 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc 
*crtc, int x, int y,
crtc_h = fb-height - y;
 
return exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
-  crtc_w, crtc_h, x, y, crtc_w, crtc_h);
+  crtc_w, crtc_h, x  16, y  16,
+  crtc_w  16, crtc_h  16);
 }
 
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
@@ -202,8 +203,8 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
crtc_w = fb-width - crtc-x;
crtc_h = fb-height - crtc-y;
ret = exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
- crtc_w, crtc_h, crtc-x, crtc-y,
- crtc_w, crtc_h);
+ crtc_w, crtc_h, crtc-x  16, crtc-y  16,
+ crtc_w  16, crtc_h  16);
if (ret) {
crtc-primary-fb = old_fb;
spin_lock_irq(dev-event_lock);
-- 
2.1.0

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


[PATCH v8 05/14] drm/exynos: atomic phase 2: wire up state reset(), duplicate() and destroy()

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Set CRTC, planes and connectors to use the default implementations from
the atomic helper library. The helpers will work to keep track of state
for each DRM object.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
---
 drivers/gpu/drm/bridge/ps8622.c   | 4 
 drivers/gpu/drm/bridge/ptn3460.c  | 4 
 drivers/gpu/drm/exynos/exynos_dp_core.c   | 4 
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 5 +
 drivers/gpu/drm/exynos/exynos_drm_dpi.c   | 4 
 drivers/gpu/drm/exynos/exynos_drm_drv.c   | 2 ++
 drivers/gpu/drm/exynos/exynos_drm_dsi.c   | 4 
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  | 4 
 drivers/gpu/drm/exynos/exynos_hdmi.c  | 4 
 10 files changed, 39 insertions(+)

diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
index e895aa7..b604326 100644
--- a/drivers/gpu/drm/bridge/ps8622.c
+++ b/drivers/gpu/drm/bridge/ps8622.c
@@ -31,6 +31,7 @@
 #include drmP.h
 #include drm_crtc.h
 #include drm_crtc_helper.h
+#include drm_atomic_helper.h
 
 /* Brightness scale on the Parade chip */
 #define PS8622_MAX_BRIGHTNESS 0xff
@@ -502,6 +503,9 @@ static const struct drm_connector_funcs 
ps8622_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ps8622_detect,
.destroy = ps8622_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static int ps8622_attach(struct drm_bridge *bridge)
diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
index 9d2f053..8ed3617 100644
--- a/drivers/gpu/drm/bridge/ptn3460.c
+++ b/drivers/gpu/drm/bridge/ptn3460.c
@@ -27,6 +27,7 @@
 
 #include drm_crtc.h
 #include drm_crtc_helper.h
+#include drm_atomic_helper.h
 #include drm_edid.h
 #include drmP.h
 
@@ -263,6 +264,9 @@ static struct drm_connector_funcs ptn3460_connector_funcs = 
{
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ptn3460_detect,
.destroy = ptn3460_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static int ptn3460_bridge_attach(struct drm_bridge *bridge)
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 30feb7d..195fe60 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -28,6 +28,7 @@
 #include drm/drmP.h
 #include drm/drm_crtc.h
 #include drm/drm_crtc_helper.h
+#include drm/drm_atomic_helper.h
 #include drm/drm_panel.h
 #include drm/bridge/ptn3460.h
 
@@ -957,6 +958,9 @@ static struct drm_connector_funcs exynos_dp_connector_funcs 
= {
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = exynos_dp_detect,
.destroy = exynos_dp_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static int exynos_dp_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index c524f0c..5bfee9b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -14,6 +14,8 @@
 
 #include drm/drmP.h
 #include drm/drm_crtc_helper.h
+#include drm/drm_atomic.h
+#include drm/drm_atomic_helper.h
 
 #include exynos_drm_crtc.h
 #include exynos_drm_drv.h
@@ -191,6 +193,9 @@ static struct drm_crtc_funcs exynos_crtc_funcs = {
.set_config = drm_crtc_helper_set_config,
.page_flip  = exynos_drm_crtc_page_flip,
.destroy= exynos_drm_crtc_destroy,
+   .reset = drm_atomic_helper_crtc_reset,
+   .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 };
 
 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 37678cf..ced5c23 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -13,6 +13,7 @@
 #include drm/drmP.h
 #include drm/drm_crtc_helper.h
 #include drm/drm_panel.h
+#include drm/drm_atomic_helper.h
 
 #include linux/regulator/consumer.h
 
@@ -63,6 +64,9 @@ static struct drm_connector_funcs exynos_dpi_connector_funcs 
= {
.detect = exynos_dpi_detect,
 

[PATCH v8 10/14] drm/exynos: remove exported functions from exynos_drm_plane

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Now that no one is using the functions exported by exynos_drm_plane due
to the atomic conversion we can make remove some of the them or make them
static.

v2: remove unused exynos_drm_crtc

v3: fix checkpatch error (reported by Joonyoung)

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 98 +--
 drivers/gpu/drm/exynos/exynos_drm_plane.h | 11 
 3 files changed, 43 insertions(+), 68 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 13c13b5..b3a69df 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -104,7 +104,7 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
}
 }
 
-static int exynos_crtc_atomic_begin(struct drm_crtc *crtc)
+static void exynos_crtc_atomic_begin(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index e052c72..54a83ee 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -62,38 +62,13 @@ static int exynos_plane_get_size(int start, unsigned 
length, unsigned last)
return size;
 }
 
-int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb)
-{
-   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-   int nr;
-   int i;
-
-   if (!fb)
-   return 0;
-
-   nr = exynos_drm_fb_get_buf_cnt(fb);
-   for (i = 0; i  nr; i++) {
-   struct exynos_drm_gem_buf *buffer = exynos_drm_fb_buffer(fb, i);
-
-   if (!buffer) {
-   DRM_DEBUG_KMS(buffer is null\n);
-   return -EFAULT;
-   }
-
-   exynos_plane-dma_addr[i] = buffer-dma_addr + fb-offsets[i];
-
-   DRM_DEBUG_KMS(buffer: %d, dma_addr = 0x%lx\n,
-   i, (unsigned long)exynos_plane-dma_addr[i]);
-   }
-
-   return 0;
-}
-
-void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
- struct drm_framebuffer *fb, int crtc_x, int crtc_y,
- unsigned int crtc_w, unsigned int crtc_h,
- uint32_t src_x, uint32_t src_y,
- uint32_t src_w, uint32_t src_h)
+static void exynos_plane_mode_set(struct drm_plane *plane,
+ struct drm_crtc *crtc,
+ struct drm_framebuffer *fb,
+ int crtc_x, int crtc_y,
+ unsigned int crtc_w, unsigned int crtc_h,
+ uint32_t src_x, uint32_t src_y,
+ uint32_t src_w, uint32_t src_h)
 {
struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
unsigned int actual_w;
@@ -148,24 +123,6 @@ void exynos_plane_mode_set(struct drm_plane *plane, struct 
drm_crtc *crtc,
plane-crtc = crtc;
 }
 
-void
-exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
-struct drm_framebuffer *fb, int crtc_x, int crtc_y,
-unsigned int crtc_w, unsigned int crtc_h,
-uint32_t src_x, uint32_t src_y,
-uint32_t src_w, uint32_t src_h)
-{
-   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-
-   exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
- crtc_w, crtc_h, src_x  16, src_y  16,
- src_w  16, src_h  16);
-
-   if (exynos_crtc-ops-win_commit)
-   exynos_crtc-ops-win_commit(exynos_crtc, exynos_plane-zpos);
-}
-
 static struct drm_plane_funcs exynos_plane_funcs = {
.update_plane   = drm_atomic_helper_update_plane,
.disable_plane  = drm_atomic_helper_disable_plane,
@@ -178,22 +135,51 @@ static struct drm_plane_funcs exynos_plane_funcs = {
 static int exynos_plane_atomic_check(struct drm_plane *plane,
 struct drm_plane_state *state)
 {
-   return exynos_check_plane(plane, state-fb);
+   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
+   int nr;
+   int i;
+
+   if (!state-fb)
+   return 0;
+
+   nr = exynos_drm_fb_get_buf_cnt(state-fb);
+   for (i = 0; i  nr; i++) {
+   struct exynos_drm_gem_buf *buffer =
+   exynos_drm_fb_buffer(state-fb, i);
+
+   if (!buffer) {
+   

[PATCH v8 14/14] drm/exynos: remove unnecessary calls to disable_plane()

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

The planes are already disabled by the drm_atomic_helper_commit() code
so we don't need to disable the in these two places.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c| 11 ---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c |  8 
 2 files changed, 19 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 3a03dc7..7151757 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -40,8 +40,6 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct drm_plane *plane;
-   int ret;
 
if (!exynos_crtc-enabled)
return;
@@ -57,15 +55,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
exynos_crtc-ops-dpms(exynos_crtc, DRM_MODE_DPMS_OFF);
 
exynos_crtc-enabled = false;
-
-   drm_for_each_legacy_plane(plane, crtc-dev-mode_config.plane_list) {
-   if (plane-crtc != crtc)
-   continue;
-
-   ret = plane-funcs-disable_plane(plane);
-   if (ret)
-   DRM_ERROR(Failed to disable plane %d\n, ret);
-   }
 }
 
 static bool
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 0648ba4..7b89fd5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -81,17 +81,9 @@ static void exynos_drm_encoder_disable(struct drm_encoder 
*encoder)
 {
struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
struct exynos_drm_display *display = exynos_encoder-display;
-   struct drm_plane *plane;
-   struct drm_device *dev = encoder-dev;
 
if (display-ops-dpms)
display-ops-dpms(display, DRM_MODE_DPMS_OFF);
-
-   /* all planes connected to this encoder should be also disabled. */
-   drm_for_each_legacy_plane(plane, dev-mode_config.plane_list) {
-   if (plane-crtc  (plane-crtc == encoder-crtc))
-   plane-funcs-disable_plane(plane);
-   }
 }
 
 static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = {
-- 
2.1.0

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


[PATCH v8 13/14] drm/exynos: atomic dpms support

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Run dpms operations through the atomic intefaces. This basically removes
the .dpms() callback from econders and crtcs and use .disable() and
.enable() to turn the crtc on and off.

v2: Address comments by Joonyoung:
- make hdmi code call -disable() instead of -dpms()
- do not use WARN_ON on crtc enable/disable

v3: - Fix build failure after the hdmi change in v2
- Change dpms helper of ptn3460 bridge

v4: - remove win_commit() call from .enable()

v5: - move .atomic_check() to the atomic PageFlip patch, and transform it
in .atomic_begin()

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
---
 drivers/gpu/drm/bridge/ps8622.c |  2 +-
 drivers/gpu/drm/bridge/ptn3460.c|  2 +-
 drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c| 58 -
 drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 +++---
 drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +--
 10 files changed, 40 insertions(+), 67 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
index b604326..d686235 100644
--- a/drivers/gpu/drm/bridge/ps8622.c
+++ b/drivers/gpu/drm/bridge/ps8622.c
@@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct drm_connector 
*connector)
 }
 
 static const struct drm_connector_funcs ps8622_connector_funcs = {
-   .dpms = drm_helper_connector_dpms,
+   .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ps8622_detect,
.destroy = ps8622_connector_destroy,
diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
index 8ed3617..260bc9f 100644
--- a/drivers/gpu/drm/bridge/ptn3460.c
+++ b/drivers/gpu/drm/bridge/ptn3460.c
@@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct drm_connector 
*connector)
 }
 
 static struct drm_connector_funcs ptn3460_connector_funcs = {
-   .dpms = drm_helper_connector_dpms,
+   .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ptn3460_detect,
.destroy = ptn3460_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 195fe60..c9995b1 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
drm_connector *connector)
 }
 
 static struct drm_connector_funcs exynos_dp_connector_funcs = {
-   .dpms = drm_helper_connector_dpms,
+   .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = exynos_dp_detect,
.destroy = exynos_dp_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index df58704..3a03dc7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -22,40 +22,41 @@
 #include exynos_drm_encoder.h
 #include exynos_drm_plane.h
 
-static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
+static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
-   DRM_DEBUG_KMS(crtc[%d] mode[%d]\n, crtc-base.id, mode);
-
-   if (exynos_crtc-dpms == mode) {
-   DRM_DEBUG_KMS(desired dpms mode is same as previous one.\n);
+   if (exynos_crtc-enabled)
return;
-   }
-
-   if (mode  DRM_MODE_DPMS_ON) {
-   /* wait for the completion of page flip. */
-   if (!wait_event_timeout(exynos_crtc-pending_flip_queue,
-   (exynos_crtc-event == NULL), HZ/20))
-   exynos_crtc-event = NULL;
-   drm_crtc_vblank_off(crtc);
-   }
 
if (exynos_crtc-ops-dpms)
-   exynos_crtc-ops-dpms(exynos_crtc, mode);
+   exynos_crtc-ops-dpms(exynos_crtc, DRM_MODE_DPMS_ON);
 
-   exynos_crtc-dpms = mode;
+   exynos_crtc-enabled = true;
 
-   if (mode == DRM_MODE_DPMS_ON)
-   drm_crtc_vblank_on(crtc);
+   drm_crtc_vblank_on(crtc);
 }
 
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
+   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
struct drm_plane *plane;
int ret;
 
-   exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
+   if (!exynos_crtc-enabled)
+   return;
+
+   /* wait for the completion of 

[PATCH v8 09/14] drm/exynos: atomic phase 3: convert page flips

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

PageFlips now use the atomic helper to work through the atomic modesetting
API. Async page flips are not supported yet.

v2: Add .atomic_begin() step to handle the vblank part we removed from
exynos page_flip code.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 79 +++-
 drivers/gpu/drm/exynos/exynos_drm_fb.c   |  9 +++-
 2 files changed, 25 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index c490064..13c13b5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -104,6 +104,20 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
}
 }
 
+static int exynos_crtc_atomic_begin(struct drm_crtc *crtc)
+{
+   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+
+   if (crtc-state-event) {
+   WARN_ON(drm_crtc_vblank_get(crtc) != 0);
+   exynos_crtc-event = crtc-state-event;
+   }
+}
+
+static void exynos_crtc_atomic_flush(struct drm_crtc *crtc)
+{
+}
+
 static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
.dpms   = exynos_drm_crtc_dpms,
.commit = exynos_drm_crtc_commit,
@@ -112,69 +126,10 @@ static struct drm_crtc_helper_funcs 
exynos_crtc_helper_funcs = {
.mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
.mode_set_base  = drm_helper_crtc_mode_set_base,
.disable= exynos_drm_crtc_disable,
+   .atomic_begin   = exynos_crtc_atomic_begin,
+   .atomic_flush   = exynos_crtc_atomic_flush,
 };
 
-static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
-struct drm_framebuffer *fb,
-struct drm_pending_vblank_event *event,
-uint32_t page_flip_flags)
-{
-   struct drm_device *dev = crtc-dev;
-   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   unsigned int crtc_w, crtc_h;
-   int ret;
-
-   /* when the page flip is requested, crtc's dpms should be on */
-   if (exynos_crtc-dpms  DRM_MODE_DPMS_ON) {
-   DRM_ERROR(failed page flip request.\n);
-   return -EINVAL;
-   }
-
-   if (!event)
-   return -EINVAL;
-
-   spin_lock_irq(dev-event_lock);
-   if (exynos_crtc-event) {
-   ret = -EBUSY;
-   goto out;
-   }
-
-   ret = exynos_check_plane(crtc-primary, fb);
-   if (ret)
-   goto out;
-
-   ret = drm_vblank_get(dev, exynos_crtc-pipe);
-   if (ret) {
-   DRM_DEBUG(failed to acquire vblank counter\n);
-   goto out;
-   }
-
-   exynos_crtc-event = event;
-   spin_unlock_irq(dev-event_lock);
-
-   /*
-* the pipe from user always is 0 so we can set pipe number
-* of current owner to event.
-*/
-   event-pipe = exynos_crtc-pipe;
-
-   crtc-primary-fb = fb;
-   crtc_w = fb-width - crtc-x;
-   crtc_h = fb-height - crtc-y;
-   exynos_update_plane(crtc-primary, crtc, fb, 0, 0,
-   crtc_w, crtc_h, crtc-x  16, crtc-y  16,
-   crtc_w  16, crtc_h  16);
-
-   if (crtc-primary-state)
-   drm_atomic_set_fb_for_plane(crtc-primary-state, fb);
-
-   return 0;
-
-out:
-   spin_unlock_irq(dev-event_lock);
-   return ret;
-}
-
 static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
@@ -188,7 +143,7 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 
 static struct drm_crtc_funcs exynos_crtc_funcs = {
.set_config = drm_atomic_helper_set_config,
-   .page_flip  = exynos_drm_crtc_page_flip,
+   .page_flip  = drm_atomic_helper_page_flip,
.destroy= exynos_drm_crtc_destroy,
.reset = drm_atomic_helper_crtc_reset,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 19c0642..05d229c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -266,11 +266,18 @@ static void exynos_drm_output_poll_changed(struct 
drm_device *dev)
exynos_drm_fbdev_init(dev);
 }
 
+static int exynos_atomic_commit(struct drm_device *dev,
+   struct drm_atomic_state *state,
+   bool async)
+{
+   return drm_atomic_helper_commit(dev, state, false);
+}
+
 static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
.fb_create = exynos_user_fb_create,

[PATCH v8 11/14] drm/exynos: don't disable unused functions at init

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

Everything starts disabled so we don't really need to disable anything.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
---
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index e71e331..e0b085b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -275,9 +275,6 @@ int exynos_drm_fbdev_init(struct drm_device *dev)
 
}
 
-   /* disable all the possible outputs/crtcs before entering KMS mode */
-   drm_helper_disable_unused_functions(dev);
-
ret = drm_fb_helper_initial_config(helper, PREFERRED_BPP);
if (ret  0) {
DRM_ERROR(failed to set up hw configuration.\n);
-- 
2.1.0

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


[PATCH v8 12/14] drm/exynos: move exynos_drm_crtc_disable()

2015-05-27 Thread Gustavo Padovan
From: Gustavo Padovan gustavo.pado...@collabora.co.uk

This is a preparation commit to move exynos_drm_crtc_disable() together
with the future exynos_drm_crtc_enable() that will come from the split of
exynos_drm_crtc_dpms() callback.

Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 36 
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index b3a69df..df58704 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -50,6 +50,23 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int 
mode)
drm_crtc_vblank_on(crtc);
 }
 
+static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
+{
+   struct drm_plane *plane;
+   int ret;
+
+   exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
+
+   drm_for_each_legacy_plane(plane, crtc-dev-mode_config.plane_list) {
+   if (plane-crtc != crtc)
+   continue;
+
+   ret = plane-funcs-disable_plane(plane);
+   if (ret)
+   DRM_ERROR(Failed to disable plane %d\n, ret);
+   }
+}
+
 static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
@@ -87,23 +104,6 @@ exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
exynos_crtc-ops-commit(exynos_crtc);
 }
 
-static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
-{
-   struct drm_plane *plane;
-   int ret;
-
-   exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
-
-   drm_for_each_legacy_plane(plane, crtc-dev-mode_config.plane_list) {
-   if (plane-crtc != crtc)
-   continue;
-
-   ret = plane-funcs-disable_plane(plane);
-   if (ret)
-   DRM_ERROR(Failed to disable plane %d\n, ret);
-   }
-}
-
 static void exynos_crtc_atomic_begin(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
@@ -120,12 +120,12 @@ static void exynos_crtc_atomic_flush(struct drm_crtc 
*crtc)
 
 static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
.dpms   = exynos_drm_crtc_dpms,
+   .disable= exynos_drm_crtc_disable,
.commit = exynos_drm_crtc_commit,
.mode_fixup = exynos_drm_crtc_mode_fixup,
.mode_set   = drm_helper_crtc_mode_set,
.mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
.mode_set_base  = drm_helper_crtc_mode_set_base,
-   .disable= exynos_drm_crtc_disable,
.atomic_begin   = exynos_crtc_atomic_begin,
.atomic_flush   = exynos_crtc_atomic_flush,
 };
-- 
2.1.0

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


Re: [PATCH] ARM: dts: add exynos5422.dtsi to correct cpu order

2015-05-27 Thread Joonyoung Shim
Hi Chanho,

On 05/28/2015 12:15 AM, Chanho Park wrote:
 The odroid-xu3 board which is based on exynos5422 not exynos5800 is
 booted from cortex-a7 core unlike exynos5800. The odroid-xu3's cpu order
 is quite strange. cpu0 and cpu5-7 are cortex-a7 cores and cpu1-4 are
 cortex-a15 cores. To correct this mis-odering, I added exynos5422.dtsi
 and reversing cpu orders from exynos5420. Now, cpu0-3 are cortex-a7 and
 cpu4-7 are cortex-a15.

The exynos5422 SoC can boot using cortex-a15 cpu depending on gpio
GPG2CON[1], i think this is just Odroid-XU3 board problem. Is it
possible to overwrite cpus information directly from
exynos5422-odroidxu3.dts?
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/21] On-demand device registration

2015-05-27 Thread Rob Herring
On Mon, May 25, 2015 at 9:53 AM, Tomeu Vizoso
tomeu.viz...@collabora.com wrote:
 Hello,

 I have a problem with the panel on my Tegra Chromebook taking longer than
 expected to be ready during boot (Stéphane Marchesin reported what is
 basically the same issue in [0]), and have looked into ordered probing as a
 better way of solving this than moving nodes around in the DT or playing with
 initcall levels.

 While reading the thread [1] that Alexander Holler started with his series to
 make probing order deterministic, it occurred to me that it should be possible
 to achieve the same by registering devices as they are referenced by other
 devices.

I like the concept and novel approach.

 This basically reuses the information that is already implicit in the probe()
 implementations, saving us from refactoring existing drivers or adding
 information to DTBs.

 Something I'm not completely happy with is that I have had to move the call to
 of_platform_populate after all platform drivers have been registered.
 Otherwise I don't see how I could register drivers on demand as we don't have
 yet each driver's compatible strings.

Yeah, this is the opposite of what we'd really like. Ideally, we would
have a solution that works for modules too. However, we're no worse
off. We pretty much build-in dependencies to avoid module ordering
problems.

Perhaps we need to make the probing on-demand rather than simply on
device-driver match occurring.

 For machs that don't move of_platform_populate() to a later point, these
 patches shouldn't cause any problems but it's not guaranteed that we'll avoid
 all the deferred probes as some drivers may not be registered yet.

Ideally, of_platform_populate is not explicitly called by each
platform. So I think we need to make this work for the default case.

 I have tested this on boards with Tegra, iMX.6 and Exynos SoCs, and these
 patches were enough to eliminate all the deferred probes.

 With this series I get the kernel to output to the panel in 0.5s, instead of 
 2.8s.

That's certainly compelling.

Rob


 Regards,

 Tomeu

 [0] http://lists.freedesktop.org/archives/dri-devel/2014-August/066527.html

 [1] https://lkml.org/lkml/2014/5/12/452

 Tomeu Vizoso (21):
   regulator: core: Reduce critical area in _regulator_get
   ARM: tegra: Add gpio-ranges property
   ARM: tegra: Register drivers before devices
   ARM: EXYNOS: Register drivers before devices
   ARM i.MX6q: Register drivers before devices
   of/platform: Add of_platform_device_ensure()
   of/platform: Ensure device registration on lookup
   gpio: Probe GPIO drivers on demand
   gpio: Probe pinctrl devices on demand
   regulator: core: Probe regulators on demand
   drm: Probe panels on demand
   drm/tegra: Probe dpaux devices on demand
   i2c: core: Probe i2c master devices on demand
   pwm: Probe PWM chip devices on demand
   backlight: Probe backlight devices on demand
   usb: phy: Probe phy devices on demand
   clk: Probe clk providers on demand
   pinctrl: Probe pinctrl devices on demand
   phy: core: Probe phy providers on demand
   dma: of: Probe DMA controllers on demand
   power-supply: Probe power supplies on demand

  arch/arm/boot/dts/tegra124.dtsi |  1 +
  arch/arm/mach-exynos/exynos.c   |  4 +--
  arch/arm/mach-imx/mach-imx6q.c  | 12 -
  arch/arm/mach-tegra/tegra.c | 21 ++-
  drivers/clk/clk.c   |  3 +++
  drivers/dma/of-dma.c|  3 +++
  drivers/gpio/gpiolib-of.c   |  5 
  drivers/gpu/drm/drm_panel.c |  3 +++
  drivers/gpu/drm/tegra/dpaux.c   |  3 +++
  drivers/i2c/i2c-core.c  |  3 +++
  drivers/of/platform.c   | 53 
 +
  drivers/phy/phy-core.c  |  3 +++
  drivers/pinctrl/devicetree.c|  2 ++
  drivers/power/power_supply_core.c   |  3 +++
  drivers/pwm/core.c  |  3 +++
  drivers/regulator/core.c| 45 +++
  drivers/usb/phy/phy.c   |  3 +++
  drivers/video/backlight/backlight.c |  3 +++
  include/linux/of_platform.h |  2 ++
  19 files changed, 130 insertions(+), 45 deletions(-)

 --
 2.4.1

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


Re: [PATCH] ARM: dts: add exynos5422.dtsi to correct cpu order

2015-05-27 Thread Krzysztof Kozlowski
+Cc Bartlomiej

On 28.05.2015 13:00, Chanho Park wrote:
 Hi,
 
 -Original Message-
 From: Joonyoung Shim [mailto:jy0922.s...@samsung.com]
 Sent: Thursday, May 28, 2015 10:59 AM
 To: Chanho Park; kg...@kernel.org; k.kozlow...@samsung.com
 Cc: cw00.c...@samsung.com; linux-samsung-soc@vger.kernel.org;
 javier.marti...@collabora.co.uk; khil...@linaro.org;
 sjoerd.sim...@collabora.co.uk; heesub.s...@samsung.com
 Subject: Re: [PATCH] ARM: dts: add exynos5422.dtsi to correct cpu order

 Hi Chanho,

 On 05/28/2015 12:15 AM, Chanho Park wrote:
 The odroid-xu3 board which is based on exynos5422 not exynos5800 is
 booted from cortex-a7 core unlike exynos5800. The odroid-xu3's cpu
 order
 is quite strange. cpu0 and cpu5-7 are cortex-a7 cores and cpu1-4 are
 cortex-a15 cores. To correct this mis-odering, I added exynos5422.dtsi
 and reversing cpu orders from exynos5420. Now, cpu0-3 are cortex-a7
 and
 cpu4-7 are cortex-a15.

 The exynos5422 SoC can boot using cortex-a15 cpu depending on gpio
 GPG2CON[1],
 
 Yes, But, the pin is not controllable because it's checked in  the iROM
 area.

After looking at schematics I think the pin on Odroid XU3 seems to be
hard-wired to VDDQ_JTAG so this means that board will always boot to A7.
However this is a board-specific property.

 
 i think this is just Odroid-XU3 board problem. Is it
 possible to overwrite cpus information directly from
 exynos5422-odroidxu3.dts?
 
 It's possible to override the info in the odroidxu3.dts. As you know,
 however, a new exynos5422 board will be added soon. The board also has same
 configuration of the gpio pin and booted cpu0 from a cortex-a7 core.


When adding new 5422 board we can split out CPU configuration to
separate DTSI file. I already posted patches for Odroid XU3-family
common DTSI file for XU3 Lite board:
http://www.spinics.net/lists/linux-samsung-soc/msg44868.html

 BTW, booting of secondary cpus are still broken. Is there any progress of
 the patch[1]?
 This patch is also generated top of the patch with some fixes.
 
 [1]. http://www.spinics.net/lists/linux-samsung-soc/msg39523.html

No progress so far. Apparently nobody knows why this works and what to
do with it. I would suspect booted CPUs stuck somewhere in BL1 or BL2
and writing to PMU_SPARE2 kicks them. However this is just a guess.

Kukjin which could be the closest person to the real knowledge (LSI) did
not gave his feedback.

We have a lot of such hacks and undocumented interfaces between kernel
and bootloaders. IMHO it would be good to start documenting them.

Best regards,
Krzysztof

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


RE: [PATCH] ARM: dts: add exynos5422.dtsi to correct cpu order

2015-05-27 Thread Chanho Park
Hi,

 -Original Message-
 From: Joonyoung Shim [mailto:jy0922.s...@samsung.com]
 Sent: Thursday, May 28, 2015 10:59 AM
 To: Chanho Park; kg...@kernel.org; k.kozlow...@samsung.com
 Cc: cw00.c...@samsung.com; linux-samsung-soc@vger.kernel.org;
 javier.marti...@collabora.co.uk; khil...@linaro.org;
 sjoerd.sim...@collabora.co.uk; heesub.s...@samsung.com
 Subject: Re: [PATCH] ARM: dts: add exynos5422.dtsi to correct cpu order
 
 Hi Chanho,
 
 On 05/28/2015 12:15 AM, Chanho Park wrote:
  The odroid-xu3 board which is based on exynos5422 not exynos5800 is
  booted from cortex-a7 core unlike exynos5800. The odroid-xu3's cpu
 order
  is quite strange. cpu0 and cpu5-7 are cortex-a7 cores and cpu1-4 are
  cortex-a15 cores. To correct this mis-odering, I added exynos5422.dtsi
  and reversing cpu orders from exynos5420. Now, cpu0-3 are cortex-a7
 and
  cpu4-7 are cortex-a15.
 
 The exynos5422 SoC can boot using cortex-a15 cpu depending on gpio
 GPG2CON[1],

Yes, But, the pin is not controllable because it's checked in  the iROM
area.

 i think this is just Odroid-XU3 board problem. Is it
 possible to overwrite cpus information directly from
 exynos5422-odroidxu3.dts?

It's possible to override the info in the odroidxu3.dts. As you know,
however, a new exynos5422 board will be added soon. The board also has same
configuration of the gpio pin and booted cpu0 from a cortex-a7 core.

BTW, booting of secondary cpus are still broken. Is there any progress of
the patch[1]?
This patch is also generated top of the patch with some fixes.

[1]. http://www.spinics.net/lists/linux-samsung-soc/msg39523.html

Best Regards,
Chanho Park

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


Re: [PATCH v7 12/13] drm/exynos: atomic dpms support

2015-05-27 Thread Inki Dae
Hi Gustavo,

On 2015년 05월 28일 05:27, Gustavo Padovan wrote:
 Hi Inki,
 
 2015-05-27 Inki Dae inki@samsung.com:
 
 Hi Gustavo,

 On 2015년 05월 23일 00:40, Gustavo Padovan wrote:
 From: Gustavo Padovan gustavo.pado...@collabora.co.uk

 Run dpms operations through the atomic intefaces. This basically removes
 the .dpms() callback from econders and crtcs and use .disable() and
 .enable() to turn the crtc on and off.

 v2: Address comments by Joonyoung:
 - make hdmi code call -disable() instead of -dpms()
 - do not use WARN_ON on crtc enable/disable

 v3: - Fix build failure after the hdmi change in v2
 - Change dpms helper of ptn3460 bridge

 Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
 Reviewed-by: Joonyoung Shim jy0922.s...@samsung.com
 Tested-by: Tobias Jakobi tjak...@math.uni-bielefeld.de
 ---
  drivers/gpu/drm/bridge/ps8622.c |  2 +-
  drivers/gpu/drm/bridge/ptn3460.c|  2 +-
  drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
  drivers/gpu/drm/exynos/exynos_drm_crtc.c| 95 
 -
  drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
  drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
  drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
  drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++--
  drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
  drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +-
  10 files changed, 69 insertions(+), 75 deletions(-)

 diff --git a/drivers/gpu/drm/bridge/ps8622.c 
 b/drivers/gpu/drm/bridge/ps8622.c
 index b604326..d686235 100644
 --- a/drivers/gpu/drm/bridge/ps8622.c
 +++ b/drivers/gpu/drm/bridge/ps8622.c
 @@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct 
 drm_connector *connector)
  }
  
  static const struct drm_connector_funcs ps8622_connector_funcs = {
 -   .dpms = drm_helper_connector_dpms,
 +   .dpms = drm_atomic_helper_connector_dpms,
 .fill_modes = drm_helper_probe_single_connector_modes,
 .detect = ps8622_detect,
 .destroy = ps8622_connector_destroy,
 diff --git a/drivers/gpu/drm/bridge/ptn3460.c 
 b/drivers/gpu/drm/bridge/ptn3460.c
 index 8ed3617..260bc9f 100644
 --- a/drivers/gpu/drm/bridge/ptn3460.c
 +++ b/drivers/gpu/drm/bridge/ptn3460.c
 @@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct 
 drm_connector *connector)
  }
  
  static struct drm_connector_funcs ptn3460_connector_funcs = {
 -   .dpms = drm_helper_connector_dpms,
 +   .dpms = drm_atomic_helper_connector_dpms,
 .fill_modes = drm_helper_probe_single_connector_modes,
 .detect = ptn3460_detect,
 .destroy = ptn3460_connector_destroy,
 diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
 b/drivers/gpu/drm/exynos/exynos_dp_core.c
 index 195fe60..c9995b1 100644
 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
 +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
 @@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
 drm_connector *connector)
  }
  

 [--snip--]

  
  static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
 -   .dpms   = exynos_drm_crtc_dpms,
 -   .prepare= exynos_drm_crtc_prepare,
 -   .commit = exynos_drm_crtc_commit,
 +   .enable = exynos_drm_crtc_enable,
 +   .disable= exynos_drm_crtc_disable,
 .mode_fixup = exynos_drm_crtc_mode_fixup,
 .mode_set   = drm_helper_crtc_mode_set,
 .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,

 I think it'd be better to use atomic_flush callback to enable global dma
 like commit callback did. Is there any reason that you don't use
 atomic_begin and atomic_flush callbacks?

 atomic relevant codes I looked into do as follows,

 atomic_begin();

 atomic_update();  /* this will call win_commit callback to set a overlay
 relevant registers and enable its dma channel. */

 atomic_flush();

 So atomic overlay updating between atomic_begin() ~ atomic_flush() will
 be guaranteed.
 
 I think we can go down that road, but I'd suggest we push the atomic
 patches v8 (with the lastest comments from Joonyoung fixed) and then 
 work on the change you are proposing as a follow-up together with the 
 other improvements for atomic I already have queued here. This way
 we don't take the risk of missing one more merge window.

We(I and Joonyoung) will have discussion about this patch series. For
this, we have already started to analyze entire atomic features
including your patch set so I'd merge it at end of next week according
to the discussion. I'm not kind of sure yet but I will merge it as long
as there is no big problem.

Thanks,
Inki Dae

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

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