[PATCH v2 3/5] drm/msm/dsi: Create a helper to check if there is a connected device

2015-08-02 Thread Archit Taneja
Create a helper msm_dsi_device_connected() which checks whether we have a
device connected to the dsi host or not. This check gets messy when we
have support external bridges too. Having an inline function makes it
more legible.

For now, the check only consists of msm_dsi-panel being non-NULL. Later,
this will check if we have an external bridge or not.

This helper isn't used in dsi_connector related code as that's specific
to only when a drm_panel is connected.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/msm/dsi/dsi.c | 2 +-
 drivers/gpu/drm/msm/dsi/dsi.h | 5 +
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 6 --
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index 9f5fe59..e991270 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -15,7 +15,7 @@
 
 struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi)
 {
-   if (!msm_dsi || !msm_dsi-panel)
+   if (!msm_dsi || !msm_dsi_device_connected(msm_dsi))
return NULL;
 
return (msm_dsi-device_flags  MIPI_DSI_MODE_VIDEO) ?
diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index fe5204e..918b0c6 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -96,6 +96,11 @@ int msm_dsi_manager_register(struct msm_dsi *msm_dsi);
 void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi);
 
 /* msm dsi */
+static inline bool msm_dsi_device_connected(struct msm_dsi *msm_dsi)
+{
+   return msm_dsi-panel;
+}
+
 struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi);
 
 /* dsi pll */
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c 
b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 925412e..e252d9d 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -332,7 +332,8 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge 
*bridge)
int ret;
 
DBG(id=%d, id);
-   if (!panel || (is_dual_panel  (DSI_1 == id)))
+   if (!msm_dsi_device_connected(msm_dsi) ||
+   (is_dual_panel  (DSI_1 == id)))
return;
 
ret = msm_dsi_host_power_on(host);
@@ -419,7 +420,8 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge 
*bridge)
 
DBG(id=%d, id);
 
-   if (!panel || (is_dual_panel  (DSI_1 == id)))
+   if (!msm_dsi_device_connected(msm_dsi) ||
+   (is_dual_panel  (DSI_1 == id)))
return;
 
ret = drm_panel_disable(panel);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm 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/5] arm: qcom: dts: Enable NAND node on IPQ8064 AP148 platform

2015-08-04 Thread Archit Taneja



On 8/4/2015 2:28 AM, Stephen Boyd wrote:

On 08/03, Archit Taneja wrote:

@@ -93,5 +115,19 @@
sata@2900 {
status = ok;
};
+
+   nand@1ac0 {
+   status = ok;
+
+   pinctrl-0 = nand_pins;
+   pinctrl-names = default;
+
+   nand-ecc-strength = 4;
+   nand-bus-width = 8;
+   };
};
  };
+
+adm_dma {
+   status = ok;
+};


I think the preference is to put the full path to the device in
the dts file and then have status = ok. So please move this
into the soc node and give the correct offset, etc. like we've
done for other nodes.


I'll do that.

Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm 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/5] arm: qcom: dts: Enable NAND node on IPQ8064 AP148 platform

2015-08-04 Thread Archit Taneja



On 8/4/2015 1:05 AM, Andy Gross wrote:

On Mon, Aug 03, 2015 at 10:38:18AM +0530, Archit Taneja wrote:

Enable the NAND controller node on the AP148 platform. Provide pinmux
information.

Cc: devicet...@vger.kernel.org

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
  arch/arm/boot/dts/qcom-ipq8064-ap148.dts | 36 
  1 file changed, 36 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-ipq8064-ap148.dts 
b/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
index 7f9ea50..2e88eff 100644
--- a/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
+++ b/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
@@ -30,6 +30,28 @@
bias-none;
};
};
+   nand_pins: nand_pins {
+   mux {
+   pins = gpio34, gpio35, gpio36,
+  gpio37, gpio38, gpio39,
+  gpio40, gpio41, gpio42,
+  gpio43, gpio44, gpio45,
+  gpio46, gpio47;
+   function = nand;
+   drive-strength = 10;
+   bias-disable;
+   };
+   pullups {
+   pins = gpio39;
+   bias-pull-up;
+   };
+   hold {
+   pins = gpio40, gpio41, gpio42,
+  gpio43, gpio44, gpio45,
+  gpio46, gpio47;
+   bias-bus-hold;


Maybe split out the bias-disable into a separate set and remove that property
from the mux.


I'll fix this.

Thanks,
Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm 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 2/5] mtd: nand: Qualcomm NAND controller driver

2015-08-04 Thread Archit Taneja


On 8/4/2015 5:08 AM, Stephen Boyd wrote:

On 08/03, Archit Taneja wrote:

The Qualcomm NAND controller is found in SoCs like IPQ806x, MSM7xx,
MDM9x15 series.


There are some checker errors and le32 usage is not correct:

drivers/mtd/nand/qcom_nandc.c:383:13: warning: mixing different enum types
drivers/mtd/nand/qcom_nandc.c:383:13: int enum dma_transfer_direction  
versus
drivers/mtd/nand/qcom_nandc.c:383:13: int enum dma_data_direction
drivers/mtd/nand/qcom_nandc.c:741:17: warning: mixing different enum types
drivers/mtd/nand/qcom_nandc.c:741:17: int enum dma_transfer_direction  
versus
drivers/mtd/nand/qcom_nandc.c:741:17: int enum dma_data_direction
/
drivers/mtd/nand/qcom_nandc.c:1828:20: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]

You can find the le32 problems with

make C=2 CF=-D__CHECK_ENDIAN__ drivers/mtd/nand/qcom_nandc.o

Feel free to squash the following in:


Thanks for fixing these issues. I'll squash them in.



Signed-off-by: Stephen Boyd sb...@codeaurora.org
---8

diff --git a/drivers/mtd/nand/qcom_nandc.c b/drivers/mtd/nand/qcom_nandc.c
index e1f15766e63d..6cc1df1a6df0 100644
--- a/drivers/mtd/nand/qcom_nandc.c
+++ b/drivers/mtd/nand/qcom_nandc.c
@@ -173,7 +173,7 @@
  struct desc_info {
struct list_head list;

-   enum dma_transfer_direction dir;
+   enum dma_data_direction dir;
struct scatterlist sgl;
struct dma_async_tx_descriptor *dma_desc;
  };
@@ -264,7 +264,7 @@ struct qcom_nandc_data {
int buf_start;

/* local buffer to read back registers */
-   u32 *reg_read_buf;
+   __le32 *reg_read_buf;
int reg_read_pos;

/* required configs */
@@ -366,6 +366,7 @@ static int prep_dma_desc(struct qcom_nandc_data *this, bool 
read, int reg_off,
struct dma_async_tx_descriptor *dma_desc;
struct scatterlist *sgl;
struct dma_slave_config slave_conf;
+   enum dma_transfer_direction dir_eng;
int r;

desc = kzalloc(sizeof(*desc), GFP_KERNEL);
@@ -378,7 +379,13 @@ static int prep_dma_desc(struct qcom_nandc_data *this, 
bool read, int reg_off,

sg_init_one(sgl, vaddr, size);

-   desc-dir = read ? DMA_DEV_TO_MEM : DMA_MEM_TO_DEV;
+   if (read) {
+   dir_eng = DMA_DEV_TO_MEM;
+   desc-dir = DMA_FROM_DEVICE;
+   } else {
+   dir_eng = DMA_MEM_TO_DEV;
+   desc-dir = DMA_TO_DEVICE;
+   }

r = dma_map_sg(this-dev, sgl, 1, desc-dir);
if (r == 0) {
@@ -405,7 +412,7 @@ static int prep_dma_desc(struct qcom_nandc_data *this, bool 
read, int reg_off,
goto err;
}

-   dma_desc = dmaengine_prep_slave_sg(this-chan, sgl, 1, desc-dir, 0);
+   dma_desc = dmaengine_prep_slave_sg(this-chan, sgl, 1, dir_eng, 0);
if (!dma_desc) {
dev_err(this-dev, failed to prepare desc\n);
r = -EINVAL;
@@ -775,7 +782,7 @@ static void parse_erase_write_errors(struct qcom_nandc_data 
*this, int command)
num_cw = command == NAND_CMD_PAGEPROG ? ecc-steps : 1;

for (i = 0; i  num_cw; i++) {
-   __le32 flash_status = le32_to_cpu(this-reg_read_buf[i]);
+   u32 flash_status = le32_to_cpu(this-reg_read_buf[i]);

if (flash_status  FS_MPU_ERR)
this-status = ~NAND_STATUS_WP;
@@ -902,7 +909,7 @@ static bool empty_page_fixup(struct qcom_nandc_data *this, 
u8 *data_buf)

for (i = 0; i  cwperpage; i++) {
u8 *empty1, *empty2;
-   __le32 flash_status = le32_to_cpu(this-reg_read_buf[3 * i]);
+   u32 flash_status = le32_to_cpu(this-reg_read_buf[3 * i]);

/*
 * an erased page flags an error in NAND_FLASH_STATUS, check if
@@ -968,37 +975,37 @@ static int parse_read_errors(struct qcom_nandc_data 
*this, bool erased_page)
int cwperpage = ecc-steps;
unsigned int max_bitflips = 0;
int i;
+   struct read_stats *buf;

-   for (i = 0; i  cwperpage; i++) {
-   int stat;
-   struct read_stats *buf;
-
-   buf = (struct read_stats *) (this-reg_read_buf + 3 * i);
+   buf = (struct read_stats *)this-reg_read_buf;
+   for (i = 0; i  cwperpage; i++, buf++) {
+   unsigned int stat;
+   u32 flash, buffer, erased_cw;

-   buf-flash = le32_to_cpu(buf-flash);
-   buf-buffer = le32_to_cpu(buf-buffer);
-   buf-erased_cw = le32_to_cpu(buf-erased_cw);
+   flash = le32_to_cpu(buf-flash);
+   buffer = le32_to_cpu(buf-buffer);
+   erased_cw = le32_to_cpu(buf-erased_cw);

-   if (buf-flash  (FS_OP_ERR | FS_MPU_ERR)) {
+   if (flash  (FS_OP_ERR | FS_MPU_ERR)) {

/* ignore erased codeword errors */
if (this-bch_enabled

Re: [PATCH 3/5] drm/i2c: adv7511: Refactor encoder slave functions

2015-07-30 Thread Archit Taneja

Hi Boris, Laurent,

On 07/28/2015 08:08 PM, Boris Brezillon wrote:

Archit, Laurent,

On Tue, 28 Jul 2015 13:47:37 +0530
Archit Taneja arch...@codeaurora.org wrote:


Hi,

On 07/27/2015 02:29 PM, Laurent Pinchart wrote:

Hi Archit,

(CC'ing Boris Brezillon)

Thank you for the patch.

On Monday 27 July 2015 11:46:57 Archit Taneja wrote:

ADV7511 is represented as an i2c drm slave encoder device. ADV7533, on
the other hand, is going be a normal i2c client device creating bridge
and connector entities.


Please, no. It's really time to stop piling hacks and fix the problem
properly. There's no reason to have separate APIs for I2C slave encoders and
DRM bridges. Those two APIs need to be merged, and then you'll find it much
easier to implement ADV7533 support.


i2c slave encoders and bridges aren't exactly the same. slave encoders
are used when the there is no real 'encoder' in the display chain.
bridges are used when there is already an encoder available, and the
bridge entity represents another encoder in the chain.

ADV7511 takes in RGB/MIPI DPI data, which is generally the output of a
crtc for drm drivers.

ADV7533 takes in MIPI DSI data, which is generally the output of an
encoder for drm drivers.

Therefore, having i2c slave encoder for the former and bridge for the
latter made sense to me.

I do agree that it would be better if they were somehow merged. It
would prevent the fragmentation we currently have among encoder
chips.

One possible way would be to convert slave encoder to bridge. With
this, an i2c slave encoder would be a 'dummy encoder' and a bridge.
i2c slave encoders even now just tie the slave encoder helper funcs
to encoder helper funcs. So it's not really any different.

Merging these 2 entities would be nice, but we're still shying away
from the larger problem of creating generic encoder chains. The
ideal solution would be for bridges and slave encoders to just be
'encoders', and the facility to connect on encoder output to the
input of another. I don't know how easy it is to do this, and
whether it'll break userspace.


Yes, that's pretty much what I was trying to do.
I'd also like to ease display pipelines creation by providing helper
functions, so that display controller don't have to worry about encoders
and connectors creation if these ones are attached to external encoders.



Archit



Boris, I know you were experimenting with that, do you have anything to report
?


Nope, I didn't work on it since last time we talked about it. I pushed
my work here if you want to have a look [1].


I went through the branch you shared. From what I understood, the 
encoder chain comprises of one 'real' encoder object (drm_encoder) in
the 'drm_encoder_chain' struct. This drm_encoder encapsulates all the 
'encoder elements' forming the chain.


I'm guessing the various dridge/slave encoder drivers would have to be 
changed to now create a drm_encoder_element object, replacing 
drm_bridge/drm_i2c_slave_encoder objects.


One problem I see with this approach is that we can't use this when
the display controller already exposes a drm_encoder. I.e, it already
creates a drm_encoder object. If we want the encoder chain to be
connected to the output of this encoder, we'll need to link the 2
drm_encoders together, which isn't possible at the moment.

I guess we have two ways to go about this:

1) Have an approach like this where all the entities in the encoder
chain connect to just one encoder. We define the sequence in which
they are connected. The drm kms framework acts as if this chain
doesn't exist, and assumes that this is what the encoder is
outputting.

2) Make each element in the chain be a 'drm_encoder' object in itself. 
This would be a more intrusive change, since drm_encoders are expected 
to receive an input from crtc, and output to a connector. Furthermore, 
it may confuse userspace what encoder to chose.


For 1), we could either work more on your approach, or use drm_bridges. 
drm_bridges can already be chained to each other, and bridge ops of each 
bridge in the chain are called successively. It still relies

on the device drivers to form the chain, which is something your
approach takes care of by itself. But that's something that can be
extended for bridges too.

Laurent,

Merging i2c slave encoders and bridges is possible, but there is no
guarantee that the new solution would be future proof and work well
with encoder chains. We needed more consensus from folks on
dri-devel.

For ADV7533, could you please look at the other parts? Especially the
one that creates a dummy mipi DSI device, and connecting to a dsi
host. I'd previously posted a RFC to enable that:

http://lkml.iu.edu/hypermail/linux/kernel/1506.3/03249.html

Archit



Best Regards,

Boris

[1]https://github.com/bbrezillon/linux-at91/tree/drm-encoder-chain-WIP





--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line

Re: [PATCH v2 2/5] mtd: nand: Qualcomm NAND controller driver

2015-07-28 Thread Archit Taneja

On 07/29/2015 07:18 AM, Stephen Boyd wrote:

On 07/27/2015 09:34 PM, Archit Taneja wrote:

Hi,

On 07/25/2015 06:21 AM, Stephen Boyd wrote:

On 07/21/2015 03:34 AM, Archit Taneja wrote:


+  int size)
+{Looks like a
+struct desc_info *desc;
+struct dma_async_tx_descriptor *dma_desc;
+struct scatterlist *sgl;
+int r;
+
+desc = kzalloc(sizeof(*desc), GFP_KERNEL);
+if (!desc)
+return -ENOMEM;
+
+list_add_tail(desc-list, this-list);
+
+sgl = desc-sgl;
+
+sg_init_one(sgl, vaddr, size);
+
+desc-dir = DMA_MEM_TO_DEV;
+
+r = dma_map_sg(this-dev, sgl, 1, desc-dir);
+if (r == 0)
+goto err;


Should we return an error in this case? Looks like return 0.


dma_map_sg returns the number of sg entries successfully mapped. In
this case, it should be 1.


Right, but this function returns 0 (success?) if we failed to map anything.


Yes. The return value is number of entries successfully mapped. 
dma_map_sg is a macro that is replaced by dma_map_sg_attrs. Its comment

says:

dma_maps_sg_attrs returns 0 on error and  0 on success. It should 
never return a value  0.









+
+this-slave_conf.device_fc = 0;
+this-slave_conf.dst_addr = this-res-start + reg_off;
+this-slave_conf.dst_maxburst = 16;


Is there any reason why slave_conf can't be on the stack? Otherwise it's
odd that it's overwritten a few times before we submit the descriptors,
so it must be copied by the dmaengine provider, but that isn't clear at
all from the code. If it isn't copied, perhaps it should be part of the
desc_info structure. If it is copied I wonder why it isn't const in the
function signature.


The dmaengine drivers either memcpy slave_config in their
device_config() dmaengine op, or populate their local members reading
params in the passed slave_config.

I'll move slave_conf to stack. As you said, the config argument
in dmaengine_slave_config should ideally use const.


Cool, someone should send a patch.






+
+r = dmaengine_slave_config(this-chan, this-slave_conf);
+if (r) {
+dev_err(this-dev, failed to configure dma channel\n);
+goto err;
+}
+
+dma_desc = dmaengine_prep_slave_sg(this-chan, sgl, 1,
desc-dir, 0);
+if (!dma_desc) {
+dev_err(this-dev, failed to prepare data write desc\n);
+r = PTR_ERR(dma_desc);
+goto err;
+}
+
+desc-dma_desc = dma_desc;
+
+return 0;
+err:
+kfree(desc);
+
+return r;
+}
+
+/*
+ * helper to prepare dma descriptors to configure registers needed
for reading a
+ * codeword/step in a page
+ */
+static void config_cw_read(struct qcom_nandc_data *this)
+{
+struct nandc_regs *regs = this-regs;
+
+write_reg_dma(this, NAND_FLASH_CMD, regs-cmd, 3, true);


Maybe it would be better to have a case statement inside
{write,read}_reg_dma() that looked at the second argument and matched it
up with an offset in regs. Then this could be

 write_reg_dma(this, NAND_FLASH_CMD, 3, true);


That's a good idea. However, we have at least one programming seqeunce
(in nandc_param) where we need to write two different values to the
same register. In such a case, we need two different locations to
store the two values.

I can split up the programming sequence into two parts such that we
won't write to the same register twice. But doing this for the sake of
reducing an argument to write_reg_dma seems a bit unnecessary.



Or you could have two #defines that indicate the different usage? Like
NAND_CMD_FOO and NAND_CMD_BAR that both map to the same register but
uses different locations as storage.


Yeah, that seems like a good option. I'll try this out.





Are we guaranteed that this is called within the same context as where
the buffer is passed to this function? Otherwise this stack check isn't
going to work because object_is_on_stack() will silently fail.


These are funcs are finally tied to mtd ops. I think in normal operation
it'll be the same context. I'll still cross check. The aim of the check
is to prevent a memcpy of the buffer to/from the layer above. A false
negative will result in a slower read/write operation.


Right. It would be nice if the mtd layer was DMA aware and could
indicate to drivers that DMA on the buffer is allowable or not. Trying
to figure it out if the buffer is in lowmem after the buffer is mapped
is error prone, which is why not a lot of usage of object_is_on_stack()
exists. Honestly I'm confused, I thought the DMA APIs would do the
right thing when highmem was passed into the mapping APIs, but maybe
I'm wrong. I'll have to look.


It looks like NAND_USE_BOUNCE_BUFFER does just that. If we set this
flag, the nand_base layer provides a DMA-able buffer even if the
filesystem didn't.

No one was using this flag when I last checked. A new driver
brcmnand now uses it. I'll give this a try.

Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from

Re: [PATCH v1 7/7] ARM: dts: ifc6410: add inforce LVDS panel support

2015-07-28 Thread Archit Taneja

Hi Srini,

On 07/28/2015 06:24 PM, Srinivas Kandagatla wrote:

This patch adds LVDS panel for IFC6410.

Signed-off-by: Rob Clark robdcl...@gmail.com
[Rob Clark: WIP patch]
Signed-off-by: Srinivas Kandagatla srinivas.kandaga...@linaro.org
---
  arch/arm/boot/dts/qcom-apq8064-ifc6410.dts | 66 ++
  1 file changed, 66 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-apq8064-ifc6410.dts 
b/arch/arm/boot/dts/qcom-apq8064-ifc6410.dts
index 1ab71f1..3bdac02 100644
--- a/arch/arm/boot/dts/qcom-apq8064-ifc6410.dts
+++ b/arch/arm/boot/dts/qcom-apq8064-ifc6410.dts
@@ -63,6 +63,12 @@
qcom,switch-mode-frequency = 320;
};

+   pm8921_l2: l2 {
+   regulator-min-microvolt = 120;
+   regulator-max-microvolt = 120;
+   bias-pull-down;
+   };
+
pm8921_l3: l3 {
regulator-min-microvolt = 305;
regulator-max-microvolt = 330;
@@ -96,6 +102,10 @@
pm8921_lvs1: lvs1 {
bias-pull-down;
};
+
+   pm8921_lvs7: lvs7 {
+   bias-pull-down;
+   };
};
};

@@ -119,6 +129,41 @@

mdp: qcom,mdp@510 {
status = okay;
+   qcom,lvds-panel = panel;


We're trying to switch to the of_graph way of representing connected
panels. With that, the above phandle will go away. This needs to be 
replaced with:


port {
lvds_out: endpoint {
remote_endpoint = auo_in;
};
};


+   lvds-vccs-3p3v-supply = ext_3p3v;
+   lvds-pll-vdda-supply = pm8921_l2;
+   lvds-vdda-supply = pm8921_lvs7;
+   };
+
+   panel_3p3v: panel_3p3v {
+   compatible = regulator-fixed;
+   pinctrl-0 = disp_en_gpios;
+   pinctrl-names = default;
+   regulator-min-microvolt = 330;
+   regulator-max-microvolt = 330;
+   regulator-name = panel_en_3p3v;
+   regulator-type = voltage;
+   startup-delay-us = 0;
+   gpio = pm8921_gpio 36 GPIO_ACTIVE_HIGH;
+   enable-active-high;
+   regulator-boot-on;
+   };
+
+   backlight: backlight{
+   pinctrl-0 = pwm_bl_gpios;
+   pinctrl-names = default;
+   compatible = gpio-backlight;
+   gpios = pm8921_gpio 26 GPIO_ACTIVE_HIGH;
+   default-on;
+   };
+
+   panel: auo,b101xtn01 {
+   status = okay;
+   compatible = auo,b101xtn01;
+
+   ddc-i2c-bus = i2c3;
+   backlight = backlight;
+   power-supply = panel_3p3v;


and for the panel:

port {
auo_in: endpoint {
remote-endpoint = lvds_out;
};
};

Thanks,
Archit


};

gsbi3: gsbi@1620 {
@@ -235,6 +280,27 @@
pm8921_gpio: gpio@150 {
pinctrl-names = default;
pinctrl-0 = wlan_default_gpios;
+
+   pwm_bl_gpios: pwm-bl-gpios {
+   pios {
+   pins = gpio26;
+   bias-disable;
+   function = normal;
+   qcom,drive-strength = 
PMIC_GPIO_STRENGTH_HIGH;
+   power-source = 
PM8921_GPIO_S4;
+   };
+   };
+
+   disp_en_gpios: disp-en-gpios {
+   pios {
+   pins = gpio36;
+   bias-disable;
+   function = 

Re: [RFC 05/21] drm/omap: Remove FB_KMS_HELPER and FB related config options

2015-08-05 Thread Archit Taneja



On 08/01/2015 03:32 PM, Laurent Pinchart wrote:

Hi Archit,

Thank you for the patch.

On Monday 13 July 2015 12:13:52 Archit Taneja wrote:

Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc: Tomi Valkeinen tomi.valkei...@ti.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com

Signed-off-by: Archit Taneja arch...@codeaurora.org


I like that, one step closer to removing fbdev altogether (even if there are
many steps left) :-)

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com


Thanks for the Acks. I'll use them when I post again.

Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/5] mtd: Qualcomm NAND controller driver

2015-08-02 Thread Archit Taneja
Add support for the NAND controller driver for SoC's that contain EBI2.
For now, the only SoC upstream that has EBI2 is IPQ806x.

The original version was posted a while back. The main comments were
about the driver not being able to use nand_bbt. This was because the
controller could read factory bad block markers only in RAW mode. This
forced us to implement our own versions of chip-block_bad and
chip-blobk_markbad, and also we had to skip creating a BBT.

Discussions with Kevin Cernekee concluded that having a new BBT flag
that incorporates this controller's special requirement is a possible
option.

The new version makes use of this flag and now uses nand_bbt, at the
cost of implement read_oob_raw and write_oob_raw ops.

The patchset requires the v6 ADM dmaengine patches posted by Andy:

https://lkml.org/lkml/2015/3/17/19

v3:
- Various fixes and clean ups suggested by Stephen Boyd.

v2:
- Added a new BBT flag that allows us to read BBM in raw mode
- reduce memcpy-s in the driver
- some refactor and clean ups because of above changes

v1:
- original series:
  https://lkml.org/lkml/2015/1/16/317


Archit Taneja (5):
  mtd: nand: Create a BBT flag to access bad block markers in raw mode
  mtd: nand: Qualcomm NAND controller driver
  dt/bindings: qcom_nandc: Add DT bindings
  arm: qcom: dts: Add NAND controller node for ipq806x
  arm: qcom: dts: Enable NAND node on IPQ8064 AP148 platform

 .../devicetree/bindings/mtd/qcom_nandc.txt |   49 +
 arch/arm/boot/dts/qcom-ipq8064-ap148.dts   |   36 +
 arch/arm/boot/dts/qcom-ipq8064.dtsi|   15 +
 drivers/mtd/nand/Kconfig   |7 +
 drivers/mtd/nand/Makefile  |1 +
 drivers/mtd/nand/nand_base.c   |6 +-
 drivers/mtd/nand/nand_bbt.c|6 +-
 drivers/mtd/nand/qcom_nandc.c  | 1913 
 include/linux/mtd/bbm.h|7 +
 9 files changed, 2038 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/qcom_nandc.txt
 create mode 100644 drivers/mtd/nand/qcom_nandc.c

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH v3 4/5] arm: qcom: dts: Add NAND controller node for ipq806x

2015-08-02 Thread Archit Taneja
The nand controller in IPQ806x is of the 'EBI2 type'. Use the corresponding
compatible string.

Cc: devicet...@vger.kernel.org

Reviewed-by: Andy Gross agr...@codeaurora.org
Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 arch/arm/boot/dts/qcom-ipq8064.dtsi | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi 
b/arch/arm/boot/dts/qcom-ipq8064.dtsi
index 1e1b3f0..a7f0ee5 100644
--- a/arch/arm/boot/dts/qcom-ipq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi
@@ -350,5 +350,20 @@
status = disabled;
};
 
+   nand@1ac0 {
+   compatible = qcom,ebi2-nandc;
+   reg = 0x1ac0 0x800;
+
+   clocks = gcc EBI2_CLK,
+gcc EBI2_AON_CLK;
+   clock-names = core, aon;
+
+   dmas = adm_dma 3;
+   dma-names = rxtx;
+   qcom,cmd-crci = 15;
+   qcom,data-crci = 3;
+
+   status = disabled;
+   };
};
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH v3 5/5] arm: qcom: dts: Enable NAND node on IPQ8064 AP148 platform

2015-08-02 Thread Archit Taneja
Enable the NAND controller node on the AP148 platform. Provide pinmux
information.

Cc: devicet...@vger.kernel.org

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 arch/arm/boot/dts/qcom-ipq8064-ap148.dts | 36 
 1 file changed, 36 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-ipq8064-ap148.dts 
b/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
index 7f9ea50..2e88eff 100644
--- a/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
+++ b/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
@@ -30,6 +30,28 @@
bias-none;
};
};
+   nand_pins: nand_pins {
+   mux {
+   pins = gpio34, gpio35, gpio36,
+  gpio37, gpio38, gpio39,
+  gpio40, gpio41, gpio42,
+  gpio43, gpio44, gpio45,
+  gpio46, gpio47;
+   function = nand;
+   drive-strength = 10;
+   bias-disable;
+   };
+   pullups {
+   pins = gpio39;
+   bias-pull-up;
+   };
+   hold {
+   pins = gpio40, gpio41, gpio42,
+  gpio43, gpio44, gpio45,
+  gpio46, gpio47;
+   bias-bus-hold;
+   };
+   };
};
 
gsbi@1630 {
@@ -93,5 +115,19 @@
sata@2900 {
status = ok;
};
+
+   nand@1ac0 {
+   status = ok;
+
+   pinctrl-0 = nand_pins;
+   pinctrl-names = default;
+
+   nand-ecc-strength = 4;
+   nand-bus-width = 8;
+   };
};
 };
+
+adm_dma {
+   status = ok;
+};
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH v3 3/5] dt/bindings: qcom_nandc: Add DT bindings

2015-08-02 Thread Archit Taneja
Add DT bindings document for the Qualcomm NAND controller driver.

Cc: devicet...@vger.kernel.org

v3:
- Don't use '0x' when specifying nand controller address space
- Add optional property for on-flash bbt usage

Acked-by: Andy Gross agr...@codeaurora.org
Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 .../devicetree/bindings/mtd/qcom_nandc.txt | 49 ++
 1 file changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/qcom_nandc.txt

diff --git a/Documentation/devicetree/bindings/mtd/qcom_nandc.txt 
b/Documentation/devicetree/bindings/mtd/qcom_nandc.txt
new file mode 100644
index 000..1de4643
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/qcom_nandc.txt
@@ -0,0 +1,49 @@
+* Qualcomm NAND controller
+
+Required properties:
+- compatible:  should be qcom,ebi2-nand for IPQ806x
+- reg: MMIO address range
+- clocks:  must contain core clock and always on clock
+- clock-names: must contain core for the core clock and aon for the
+   always on clock
+- dmas:DMA specifier, consisting of a phandle to the 
ADM DMA
+   controller node and the channel number to be used for
+   NAND. Refer to dma.txt and qcom_adm.txt for more details
+- dma-names:   must be rxtx
+- qcom,cmd-crci:   must contain the ADM command type CRCI block instance
+   number specified for the NAND controller on the given
+   platform
+- qcom,data-crci:  must contain the ADM data type CRCI block instance
+   number specified for the NAND controller on the given
+   platform
+
+Optional properties:
+- nand-bus-width:  bus width. Must be 8 or 16. If not present, 8 is chosen
+   as default
+
+- nand-ecc-strength:   number of bits to correct per ECC step. Must be 4 or 8
+   bits. If not present, 4 is chosen as default
+- nand-on-flash-bbt:   Create/use on-flash bad block table
+
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
+
+Example:
+
+nand@1ac0 {
+   compatible = qcom,ebi2-nandc;
+   reg = 0x1ac0 0x800;
+
+   clocks = gcc EBI2_CLK,
+gcc EBI2_AON_CLK;
+   clock-names = core, aon;
+
+   dmas = adm_dma 3;
+   dma-names = rxtx;
+   qcom,cmd-crci = 15;
+   qcom,data-crci = 3;
+
+   partition@0 {
+   ...
+   };
+};
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH v3 2/5] mtd: nand: Qualcomm NAND controller driver

2015-08-02 Thread Archit Taneja
The Qualcomm NAND controller is found in SoCs like IPQ806x, MSM7xx,
MDM9x15 series.

It exists as a sub block inside the IPs EBI2 (External Bus Interface 2)
and QPIC (Qualcomm Parallel Interface Controller). These IPs provide a
broader interface for external slow peripheral devices such as LCD and
NAND/NOR flash memory or SRAM like interfaces.

We add support for the NAND controller found within EBI2. For the SoCs
of our interest, we only use the NAND controller within EBI2. Therefore,
it's safe for us to assume that the NAND controller is a standalone block
within the SoC.

The controller supports 512B, 2kB, 4kB and 8kB page 8-bit and 16-bit NAND
flash devices. It contains a HW ECC block that supports BCH ECC (4, 8 and
16 bit correction/step) and RS ECC(4 bit correction/step) that covers main
and spare data. The controller contains an internal 512 byte page buffer
to which we read/write via DMA. The EBI2 type NAND controller uses ADM DMA
for register read/write and data transfers. The controller performs page
reads and writes at a codeword/step level of 512 bytes. It can support up
to 2 external chips of different configurations.

The driver prepares register read and write configuration descriptors for
each codeword, followed by data descriptors to read or write data from the
controller's internal buffer. It uses a single ADM DMA channel that we get
via dmaengine API. The controller requires 2 ADM CRCIs for command and
data flow control. These are passed via DT.

The ecc layout used by the controller is syndrome like, but we can't use
the standard syndrome ecc ops because of several reasons. First, the amount
of data bytes covered by ecc isn't same in each step. Second, writing to
free oob space requires us writing to the entire step in which the oob
lies. This forces us to create our own ecc ops.

One more difference is how the controller accesses the bad block marker.
The controller ignores reading the marker when ECC is enabled. ECC needs
to be explicity disabled to read or write to the bad block marker. For
this reason, we use the newly created flag NAND_BBT_ACCESS_BBM_RAW to
read the factory provided bad block markers.

v3:
- Refactor dma functions for maximum reuse
- Use dma_slave_confing on stack
- optimize and clean upempty_page_fixup using memchr_inv
- ensure portability with dma register reads using le32_* funcs
- use NAND_USE_BOUNCE_BUFFER instead of doing it ourselves
- fix handling of return values of dmaengine funcs
- constify wherever possible
- Remove dependency on ADM DMA in Kconfig
- Misc fixes and clean ups

v2:
- Use new BBT flag that allows us to read BBM in raw mode
- reduce memcpy-s in the driver
- some refactor and clean ups because of above changes

Reviewed-by: Andy Gross agr...@codeaurora.org
Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/mtd/nand/Kconfig  |7 +
 drivers/mtd/nand/Makefile |1 +
 drivers/mtd/nand/qcom_nandc.c | 1913 +
 3 files changed, 1921 insertions(+)
 create mode 100644 drivers/mtd/nand/qcom_nandc.c

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 5b2806a..6085b8a 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -538,4 +538,11 @@ config MTD_NAND_HISI504
help
  Enables support for NAND controller on Hisilicon SoC Hip04.
 
+config MTD_NAND_QCOM
+   tristate Support for NAND on QCOM SoCs
+   depends on ARCH_QCOM
+   help
+ Enables support for NAND flash chips on SoCs containing the EBI2 NAND
+ controller. This controller is found on IPQ806x SoC.
+
 endif # MTD_NAND
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 1f897ec..87b6a1d 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -53,5 +53,6 @@ obj-$(CONFIG_MTD_NAND_BCM47XXNFLASH)  += bcm47xxnflash/
 obj-$(CONFIG_MTD_NAND_SUNXI)   += sunxi_nand.o
 obj-$(CONFIG_MTD_NAND_HISI504) += hisi504_nand.o
 obj-$(CONFIG_MTD_NAND_BRCMNAND)+= brcmnand/
+obj-$(CONFIG_MTD_NAND_QCOM)+= qcom_nandc.o
 
 nand-objs := nand_base.o nand_bbt.o nand_timings.o
diff --git a/drivers/mtd/nand/qcom_nandc.c b/drivers/mtd/nand/qcom_nandc.c
new file mode 100644
index 000..e1f1576
--- /dev/null
+++ b/drivers/mtd/nand/qcom_nandc.c
@@ -0,0 +1,1913 @@
+/*
+ * Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/clk.h
+#include linux/slab.h
+#include linux/bitops.h
+#include linux/dma-mapping.h
+#include

[PATCH v3 1/5] mtd: nand: Create a BBT flag to access bad block markers in raw mode

2015-08-02 Thread Archit Taneja
Some controllers can access the factory bad block marker from OOB only
when they read it in raw mode. When ECC is enabled, these controllers
discard reading/writing bad block markers, preventing access to them
altogether.

The bbt driver assumes MTD_OPS_PLACE_OOB when scanning for bad blocks.
This results in the nand driver's ecc-read_oob() op to be called, which
works with ECC enabled.

Create a new BBT option flag that tells nand_bbt to force the mode to
MTD_OPS_RAW. This would result in the correct op being called for the
underlying nand controller driver.

Reviewed-by: Andy Gross agr...@codeaurora.org
Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/mtd/nand/nand_base.c | 6 +-
 drivers/mtd/nand/nand_bbt.c  | 6 +-
 include/linux/mtd/bbm.h  | 7 +++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ceb68ca..0a0c524 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -394,7 +394,11 @@ static int nand_default_block_markbad(struct mtd_info 
*mtd, loff_t ofs)
} else {
ops.len = ops.ooblen = 1;
}
-   ops.mode = MTD_OPS_PLACE_OOB;
+
+   if (unlikely(chip-bbt_options  NAND_BBT_ACCESS_BBM_RAW))
+   ops.mode = MTD_OPS_RAW;
+   else
+   ops.mode = MTD_OPS_PLACE_OOB;
 
/* Write to first/last page(s) if necessary */
if (chip-bbt_options  NAND_BBT_SCANLASTPAGE)
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 63a1a36..f2d89c9 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -420,7 +420,11 @@ static int scan_block_fast(struct mtd_info *mtd, struct 
nand_bbt_descr *bd,
ops.oobbuf = buf;
ops.ooboffs = 0;
ops.datbuf = NULL;
-   ops.mode = MTD_OPS_PLACE_OOB;
+
+   if (unlikely(bd-options  NAND_BBT_ACCESS_BBM_RAW))
+   ops.mode = MTD_OPS_RAW;
+   else
+   ops.mode = MTD_OPS_PLACE_OOB;
 
for (j = 0; j  numpages; j++) {
/*
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 36bb6a5..f67f84a 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -116,6 +116,13 @@ struct nand_bbt_descr {
 #define NAND_BBT_NO_OOB_BBM0x0008
 
 /*
+ * Force MTD_OPS_RAW mode when trying to access bad block markes from OOB. To
+ * be used by controllers which can access BBM only when ECC is disabled, i.e,
+ * when in RAW access mode
+ */
+#define NAND_BBT_ACCESS_BBM_RAW0x0010
+
+/*
  * Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr
  * was allocated dynamicaly and must be freed in nand_release(). Has no meaning
  * in nand_chip.bbt_options.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm 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] drm/i2c: adv7511: Initial support for adv7533

2015-08-02 Thread Archit Taneja



On 07/28/2015 08:57 AM, Bjorn Andersson wrote:

On Sun 26 Jul 23:16 PDT 2015, Archit Taneja wrote:


From: Lars-Peter Clausen l...@metafoo.de


[..]

diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c


[..]



+static const struct of_device_id adv7511_of_ids[] = {
+   { .compatible = adi,adv7511, .data = (void *) ADV7511 },
+   { .compatible = adi,adv7511w, .data = (void *) ADV7511 },
+   { .compatible = adi,adv7513, .data = (void *) ADV7511 },
+   { .compatible = adi,adv7533, .data = (void *) ADV7533 },
+   { }
+};
+MODULE_DEVICE_TABLE(of, adv7511_of_ids);


Please leave this at the bottom.


+
  static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id 
*id)
  {
struct adv7511_link_config link_config;
@@ -871,9 +938,22 @@ static int adv7511_probe(struct i2c_client *i2c, const 
struct i2c_device_id *id)
adv7511-powered = false;
adv7511-status = connector_status_disconnected;

-   ret = adv7511_parse_dt(dev-of_node, link_config);
-   if (ret)
-   return ret;
+   if (dev-of_node) {
+   const struct of_device_id *of_id;
+
+   of_id = of_match_node(adv7511_of_ids, dev-of_node);


If you use of_device_get_match_data() instead you don't need to move the
of_device_id table.


Thanks, will use this in future revisions.

Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm 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 2/5] mtd: nand: Qualcomm NAND controller driver

2015-07-30 Thread Archit Taneja



On 7/30/2015 12:03 AM, Stephen Boyd wrote:

On 07/29, Archit Taneja wrote:

On 07/29/2015 07:18 AM, Stephen Boyd wrote:

On 07/27/2015 09:34 PM, Archit Taneja wrote:

Hi,

On 07/25/2015 06:21 AM, Stephen Boyd wrote:

On 07/21/2015 03:34 AM, Archit Taneja wrote:


+  int size)
+{Looks like a
+struct desc_info *desc;
+struct dma_async_tx_descriptor *dma_desc;
+struct scatterlist *sgl;
+int r;
+
+desc = kzalloc(sizeof(*desc), GFP_KERNEL);
+if (!desc)
+return -ENOMEM;
+
+list_add_tail(desc-list, this-list);
+
+sgl = desc-sgl;
+
+sg_init_one(sgl, vaddr, size);
+
+desc-dir = DMA_MEM_TO_DEV;
+
+r = dma_map_sg(this-dev, sgl, 1, desc-dir);
+if (r == 0)
+goto err;


Should we return an error in this case? Looks like return 0.


dma_map_sg returns the number of sg entries successfully mapped. In
this case, it should be 1.


Right, but this function returns 0 (success?) if we failed to map anything.


Yes. The return value is number of entries successfully mapped.
dma_map_sg is a macro that is replaced by dma_map_sg_attrs. Its
comment
says:

dma_maps_sg_attrs returns 0 on error and  0 on success. It should
never return a value  0.


Yes, and so this function that calls dma_map_sg() is going to
return 0 to the caller when it didn't do what it was asked to do?


Ah, I get your point now :p. I thought you were referring to the
return value of dma_map_sg, and not write_data_dma. Will fix this.

Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm 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] drm/i2c: adv7511: Refactor encoder slave functions

2015-07-31 Thread Archit Taneja



On 07/31/2015 02:42 PM, Boris Brezillon wrote:

Hi Archit,

On Fri, 31 Jul 2015 10:56:20 +0530
Archit Taneja arch...@codeaurora.org wrote:


Hi Boris, Laurent,

On 07/28/2015 08:08 PM, Boris Brezillon wrote:

Archit, Laurent,

On Tue, 28 Jul 2015 13:47:37 +0530
Archit Taneja arch...@codeaurora.org wrote:


Hi,

On 07/27/2015 02:29 PM, Laurent Pinchart wrote:

Hi Archit,

(CC'ing Boris Brezillon)

Thank you for the patch.

On Monday 27 July 2015 11:46:57 Archit Taneja wrote:

ADV7511 is represented as an i2c drm slave encoder device. ADV7533, on
the other hand, is going be a normal i2c client device creating bridge
and connector entities.


Please, no. It's really time to stop piling hacks and fix the problem
properly. There's no reason to have separate APIs for I2C slave encoders and
DRM bridges. Those two APIs need to be merged, and then you'll find it much
easier to implement ADV7533 support.


i2c slave encoders and bridges aren't exactly the same. slave encoders
are used when the there is no real 'encoder' in the display chain.
bridges are used when there is already an encoder available, and the
bridge entity represents another encoder in the chain.

ADV7511 takes in RGB/MIPI DPI data, which is generally the output of a
crtc for drm drivers.

ADV7533 takes in MIPI DSI data, which is generally the output of an
encoder for drm drivers.

Therefore, having i2c slave encoder for the former and bridge for the
latter made sense to me.

I do agree that it would be better if they were somehow merged. It
would prevent the fragmentation we currently have among encoder
chips.

One possible way would be to convert slave encoder to bridge. With
this, an i2c slave encoder would be a 'dummy encoder' and a bridge.
i2c slave encoders even now just tie the slave encoder helper funcs
to encoder helper funcs. So it's not really any different.

Merging these 2 entities would be nice, but we're still shying away
from the larger problem of creating generic encoder chains. The
ideal solution would be for bridges and slave encoders to just be
'encoders', and the facility to connect on encoder output to the
input of another. I don't know how easy it is to do this, and
whether it'll break userspace.


Yes, that's pretty much what I was trying to do.
I'd also like to ease display pipelines creation by providing helper
functions, so that display controller don't have to worry about encoders
and connectors creation if these ones are attached to external encoders.



Archit



Boris, I know you were experimenting with that, do you have anything to report
?


Nope, I didn't work on it since last time we talked about it. I pushed
my work here if you want to have a look [1].


I went through the branch you shared. From what I understood, the
encoder chain comprises of one 'real' encoder object (drm_encoder) in
the 'drm_encoder_chain' struct. This drm_encoder encapsulates all the
'encoder elements' forming the chain.

I'm guessing the various dridge/slave encoder drivers would have to be
changed to now create a drm_encoder_element object, replacing
drm_bridge/drm_i2c_slave_encoder objects.

One problem I see with this approach is that we can't use this when
the display controller already exposes a drm_encoder. I.e, it already
creates a drm_encoder object. If we want the encoder chain to be
connected to the output of this encoder, we'll need to link the 2
drm_encoders together, which isn't possible at the moment.


Actually my goal was to move everybody to the drm_encoder_element model,
even the encoder directly provided by the display controller IP.
If the internal encoder is actually directly connected to a connector,
then the encoder chain will just contain one element, but everything
should work fine.


Okay. That approach makes sense.

It might be good to have a look at the current state of drm_bridge. We 
need to probably make a call between extending bridges or starting with
encoder elements from scratch. Extending bridges might be less 
intrusive. Although, encoder elements is more uniform. In bridges,
we'll be stuck with two entities: One encoder (drm_encoder), followed by 
a chain of bridges.






I guess we have two ways to go about this:

1) Have an approach like this where all the entities in the encoder
chain connect to just one encoder. We define the sequence in which
they are connected. The drm kms framework acts as if this chain
doesn't exist, and assumes that this is what the encoder is
outputting.


Yep, that's pretty much what I've done. The main reason for doing that
is to keep the interface with the userspace unchanged.



2) Make each element in the chain be a 'drm_encoder' object in itself.
This would be a more intrusive change, since drm_encoders are expected
to receive an input from crtc, and output to a connector. Furthermore,
it may confuse userspace what encoder to chose.


That's why Laurent suggested to go for the 1st approach.



For 1), we could either work more on your approach, or use drm_bridges

[PATCH 2/5] drm/i2c: adv7511: Initial support for adv7533

2015-07-27 Thread Archit Taneja
From: Lars-Peter Clausen l...@metafoo.de

ADV7533 is a DSI to HDMI encoder chip. It is a derivative of ADV7511,
with additional blocks to translate input DSI data to parallel RGB
data. Besides the ADV7511 i2c register map, it has additional registers
that require to be configured to activate the DSI blocks.

Use DT compatible strings to populate the adv7533 type enum. Add minimal
register configurations belonging to the DSI/CEC register map.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/i2c/adv7511.c | 155 +++---
 1 file changed, 131 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c
index cf5bb29..63a3d20 100644
--- a/drivers/gpu/drm/i2c/adv7511.c
+++ b/drivers/gpu/drm/i2c/adv7511.c
@@ -20,12 +20,18 @@
 
 #include adv7511.h
 
+enum adv7511_type {
+   ADV7511,
+   ADV7533,
+};
+
 struct adv7511 {
struct i2c_client *i2c_main;
struct i2c_client *i2c_edid;
+   struct i2c_client *i2c_cec;
 
struct regmap *regmap;
-   struct regmap *packet_memory_regmap;
+   struct regmap *regmap_cec;
enum drm_connector_status status;
bool powered;
 
@@ -46,6 +52,8 @@ struct adv7511 {
struct edid *edid;
 
struct gpio_desc *gpio_pd;
+
+   enum adv7511_type type;
 };
 
 static struct adv7511 *encoder_to_adv7511(struct drm_encoder *encoder)
@@ -66,6 +74,23 @@ static const struct reg_default adv7511_fixed_registers[] = {
{ 0x55, 0x02 },
 };
 
+/* ADI recommended values for proper operation. */
+static const struct reg_default adv7533_fixed_registers[] = {
+   { 0x16, 0x20 },
+   { 0x9a, 0xe0 },
+   { 0xba, 0x70 },
+   { 0xde, 0x82 },
+   { 0xe4, 0x40 },
+   { 0xe5, 0x80 },
+};
+
+static const struct reg_default adv7533_cec_fixed_registers[] = {
+   { 0x15, 0xd0 },
+   { 0x17, 0xd0 },
+   { 0x24, 0x20 },
+   { 0x57, 0x11 },
+};
+
 /* 
-
  * Register access
  */
@@ -158,6 +183,15 @@ static const struct regmap_config adv7511_regmap_config = {
.volatile_reg = adv7511_register_volatile,
 };
 
+static const struct regmap_config adv7533_cec_regmap_config = {
+   .reg_bits = 8,
+   .val_bits = 8,
+
+   .max_register = 0xff,
+   .cache_type = REGCACHE_RBTREE,
+};
+
+
 /* 
-
  * Hardware configuration
  */
@@ -358,6 +392,25 @@ static void adv7511_set_link_config(struct adv7511 
*adv7511,
adv7511-rgb = config-input_colorspace == HDMI_COLORSPACE_RGB;
 }
 
+static void adv7511_dsi_receiver_dpms(struct adv7511 *adv7511)
+{
+   if (adv7511-type != ADV7533)
+   return;
+
+   if (adv7511-powered) {
+   /* set number of dsi lanes (hardcoded to 4 for now) */
+   regmap_write(adv7511-regmap_cec, 0x1c, 0x4  4);
+   /* disable internal timing generator */
+   regmap_write(adv7511-regmap_cec, 0x27, 0x0b);
+   /* enable hdmi */
+   regmap_write(adv7511-regmap_cec, 0x03, 0x89);
+   /* disable test mode */
+   regmap_write(adv7511-regmap_cec, 0x55, 0x00);
+   } else {
+   regmap_write(adv7511-regmap_cec, 0x03, 0x0b);
+   }
+}
+
 static void adv7511_power_on(struct adv7511 *adv7511)
 {
adv7511-current_edid_segment = -1;
@@ -387,6 +440,8 @@ static void adv7511_power_on(struct adv7511 *adv7511)
regcache_sync(adv7511-regmap);
 
adv7511-powered = true;
+
+   adv7511_dsi_receiver_dpms(adv7511);
 }
 
 static void adv7511_power_off(struct adv7511 *adv7511)
@@ -398,6 +453,8 @@ static void adv7511_power_off(struct adv7511 *adv7511)
regcache_mark_dirty(adv7511-regmap);
 
adv7511-powered = false;
+
+   adv7511_dsi_receiver_dpms(adv7511);
 }
 
 /* 
-
@@ -567,6 +624,9 @@ static int adv7511_get_modes(struct drm_encoder *encoder,
 
/* Reading the EDID only works if the device is powered */
if (!adv7511-powered) {
+   regmap_update_bits(adv7511-regmap, ADV7511_REG_POWER2,
+  ADV7511_REG_POWER2_HDP_SRC_MASK,
+  ADV7511_REG_POWER2_HDP_SRC_NONE);
regmap_write(adv7511-regmap, ADV7511_REG_INT(0),
 ADV7511_INT0_EDID_READY);
regmap_write(adv7511-regmap, ADV7511_REG_INT(1),
@@ -770,8 +830,6 @@ static int adv7511_parse_dt(struct device_node *np,
const char *str;
int ret;
 
-   memset(config, 0, sizeof(*config));
-
of_property_read_u32(np, adi,input-depth, config-input_color_depth);
if (config-input_color_depth != 8  config-input_color_depth != 10 
config

[PATCH 4/5] drm/i2c: adv7511: Add drm_bridge/connector for ADV7533

2015-07-27 Thread Archit Taneja
Create bridge and connector helper functions. These internally refer to
the ADV75xx helper functions.

The driver registers a drm_bridge object during probe. The bridge, in
turn registers a HDMI connector when a user attaches the bridge.

Therefore, when the device type is ADV7533, we create bridge and
connector entities, and when it's ADV7511, we create a slave encoder as
before.

Since the i2c driver is still wrapped around by the drm_i2c_slave_encoder
struct. We make sure the encoder_init op returns an error when the device
type is ADV7533.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/i2c/adv7511.c | 155 ++
 1 file changed, 155 insertions(+)

diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c
index 46fb24d..10642e1 100644
--- a/drivers/gpu/drm/i2c/adv7511.c
+++ b/drivers/gpu/drm/i2c/adv7511.c
@@ -17,6 +17,8 @@
 #include drm/drm_crtc_helper.h
 #include drm/drm_edid.h
 #include drm/drm_encoder_slave.h
+#include drm/drm_atomic.h
+#include drm/drm_atomic_helper.h
 
 #include adv7511.h
 
@@ -44,6 +46,9 @@ struct adv7511 {
wait_queue_head_t wq;
struct drm_encoder *encoder;
 
+   struct drm_connector connector;
+   struct drm_bridge bridge;
+
bool embedded_sync;
enum adv7511_sync_polarity vsync_polarity;
enum adv7511_sync_polarity hsync_polarity;
@@ -855,6 +860,139 @@ static struct drm_encoder_slave_funcs 
adv7511_encoder_funcs = {
 };
 
 /* 
-
+ * Bridge and connector functions
+ */
+
+static struct adv7511 *connector_to_adv7511(struct drm_connector *connector)
+{
+   return container_of(connector, struct adv7511, connector);
+}
+
+/* Connector helper functions */
+static int adv7533_connector_get_modes(struct drm_connector *connector)
+{
+   struct adv7511 *adv = connector_to_adv7511(connector);
+
+   return adv7511_get_modes(adv, connector);
+}
+
+static struct drm_encoder *
+adv7533_connector_best_encoder(struct drm_connector *connector)
+{
+   struct adv7511 *adv = connector_to_adv7511(connector);
+
+   return adv-bridge.encoder;
+}
+
+static enum drm_mode_status
+adv7533_connector_mode_valid(struct drm_connector *connector,
+   struct drm_display_mode *mode)
+{
+   struct adv7511 *adv = connector_to_adv7511(connector);
+
+   return adv7511_mode_valid(adv, mode);
+}
+
+static struct drm_connector_helper_funcs adv7533_connector_helper_funcs = {
+   .get_modes = adv7533_connector_get_modes,
+   .best_encoder = adv7533_connector_best_encoder,
+   .mode_valid = adv7533_connector_mode_valid,
+};
+
+static enum drm_connector_status
+adv7533_connector_detect(struct drm_connector *connector, bool force)
+{
+   struct adv7511 *adv = connector_to_adv7511(connector);
+
+   return adv7511_detect(adv, connector);
+}
+
+static struct drm_connector_funcs adv7533_connector_funcs = {
+   .dpms = drm_helper_connector_dpms,
+   .fill_modes = drm_helper_probe_single_connector_modes,
+   .detect = adv7533_connector_detect,
+   .destroy = drm_connector_cleanup,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
+};
+
+/* Bridge funcs */
+static struct adv7511 *bridge_to_adv7511(struct drm_bridge *bridge)
+{
+   return container_of(bridge, struct adv7511, bridge);
+}
+
+static void adv7533_bridge_pre_enable(struct drm_bridge *bridge)
+{
+   struct adv7511 *adv = bridge_to_adv7511(bridge);
+
+   adv7511_power_on(adv);
+}
+
+static void adv7533_bridge_post_disable(struct drm_bridge *bridge)
+{
+   struct adv7511 *adv = bridge_to_adv7511(bridge);
+
+   adv7511_power_off(adv);
+}
+
+static void adv7533_bridge_enable(struct drm_bridge *bridge)
+{
+}
+
+static void adv7533_bridge_disable(struct drm_bridge *bridge)
+{
+}
+
+static void adv7533_bridge_mode_set(struct drm_bridge *bridge,
+struct drm_display_mode *mode,
+struct drm_display_mode *adj_mode)
+{
+   struct adv7511 *adv = bridge_to_adv7511(bridge);
+
+   adv7511_mode_set(adv, mode, adj_mode);
+}
+
+static int adv7533_bridge_attach(struct drm_bridge *bridge)
+{
+   struct adv7511 *adv = bridge_to_adv7511(bridge);
+   int ret;
+
+   adv-encoder = bridge-encoder;
+
+   if (!bridge-encoder) {
+   DRM_ERROR(Parent encoder object not found);
+   return -ENODEV;
+   }
+
+   adv-connector.polled = DRM_CONNECTOR_POLL_HPD;
+   ret = drm_connector_init(bridge-dev, adv-connector,
+   adv7533_connector_funcs, DRM_MODE_CONNECTOR_HDMIA);
+   if (ret) {
+   DRM_ERROR(Failed to initialize connector with drm\n);
+   return ret

[PATCH 3/5] drm/i2c: adv7511: Refactor encoder slave functions

2015-07-27 Thread Archit Taneja
ADV7511 is represented as an i2c drm slave encoder device. ADV7533, on
the other hand, is going be a normal i2c client device creating bridge
and connector entities.

Move the code in encoder slave functions to generate helpers that are
agnostic to the drm object type. These helpers will later also be used
by bridge and connecter helper functions.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/i2c/adv7511.c | 80 ++-
 1 file changed, 57 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c
index 63a3d20..46fb24d 100644
--- a/drivers/gpu/drm/i2c/adv7511.c
+++ b/drivers/gpu/drm/i2c/adv7511.c
@@ -612,13 +612,11 @@ static int adv7511_get_edid_block(void *data, u8 *buf, 
unsigned int block,
 }
 
 /* 
-
- * Encoder operations
+ * ADV75xx helpers
  */
-
-static int adv7511_get_modes(struct drm_encoder *encoder,
-struct drm_connector *connector)
+static int adv7511_get_modes(struct adv7511 *adv7511,
+   struct drm_connector *connector)
 {
-   struct adv7511 *adv7511 = encoder_to_adv7511(encoder);
struct edid *edid;
unsigned int count;
 
@@ -656,21 +654,10 @@ static int adv7511_get_modes(struct drm_encoder *encoder,
return count;
 }
 
-static void adv7511_encoder_dpms(struct drm_encoder *encoder, int mode)
-{
-   struct adv7511 *adv7511 = encoder_to_adv7511(encoder);
-
-   if (mode == DRM_MODE_DPMS_ON)
-   adv7511_power_on(adv7511);
-   else
-   adv7511_power_off(adv7511);
-}
-
 static enum drm_connector_status
-adv7511_encoder_detect(struct drm_encoder *encoder,
+adv7511_detect(struct adv7511 *adv7511,
   struct drm_connector *connector)
 {
-   struct adv7511 *adv7511 = encoder_to_adv7511(encoder);
enum drm_connector_status status;
unsigned int val;
bool hpd;
@@ -694,7 +681,7 @@ adv7511_encoder_detect(struct drm_encoder *encoder,
if (status == connector_status_connected  hpd  adv7511-powered) {
regcache_mark_dirty(adv7511-regmap);
adv7511_power_on(adv7511);
-   adv7511_get_modes(encoder, connector);
+   adv7511_get_modes(adv7511, connector);
if (adv7511-status == connector_status_connected)
status = connector_status_disconnected;
} else {
@@ -708,8 +695,8 @@ adv7511_encoder_detect(struct drm_encoder *encoder,
return status;
 }
 
-static int adv7511_encoder_mode_valid(struct drm_encoder *encoder,
- struct drm_display_mode *mode)
+static int adv7511_mode_valid(struct adv7511 *adv7511,
+const struct drm_display_mode *mode)
 {
if (mode-clock  165000)
return MODE_CLOCK_HIGH;
@@ -717,11 +704,10 @@ static int adv7511_encoder_mode_valid(struct drm_encoder 
*encoder,
return MODE_OK;
 }
 
-static void adv7511_encoder_mode_set(struct drm_encoder *encoder,
+static void adv7511_mode_set(struct adv7511 *adv7511,
 struct drm_display_mode *mode,
 struct drm_display_mode *adj_mode)
 {
-   struct adv7511 *adv7511 = encoder_to_adv7511(encoder);
unsigned int low_refresh_rate;
unsigned int hsync_polarity = 0;
unsigned int vsync_polarity = 0;
@@ -812,12 +798,60 @@ static void adv7511_encoder_mode_set(struct drm_encoder 
*encoder,
adv7511-f_tmds = mode-clock;
 }
 
+/* 
-
+ * Encoder operations
+ */
+
+static int adv7511_encoder_get_modes(struct drm_encoder *encoder,
+struct drm_connector *connector)
+{
+   struct adv7511 *adv7511 = encoder_to_adv7511(encoder);
+
+   return adv7511_get_modes(adv7511, connector);
+}
+
+static void adv7511_encoder_dpms(struct drm_encoder *encoder, int mode)
+{
+   struct adv7511 *adv7511 = encoder_to_adv7511(encoder);
+
+   if (mode == DRM_MODE_DPMS_ON)
+   adv7511_power_on(adv7511);
+   else
+   adv7511_power_off(adv7511);
+}
+
+static enum drm_connector_status
+adv7511_encoder_detect(struct drm_encoder *encoder,
+  struct drm_connector *connector)
+{
+   struct adv7511 *adv7511 = encoder_to_adv7511(encoder);
+
+   return adv7511_detect(adv7511, connector);
+}
+
+static int adv7511_encoder_mode_valid(struct drm_encoder *encoder,
+ struct drm_display_mode *mode)
+{
+   struct adv7511 *adv7511 = encoder_to_adv7511(encoder);
+
+   return adv7511_mode_valid(adv7511, mode);
+}
+
+static void adv7511_encoder_mode_set(struct drm_encoder *encoder,
+struct drm_display_mode *mode

[PATCH 1/5] drm/i2c: adv7511: Fix mutex deadlock when interrupts are disabled

2015-07-27 Thread Archit Taneja
When the adv7511 i2c client doesn't have an interrupt line, we observe a
deadlock on caused by trying to lock drm device's mode_config.mutex twice
in the same context.

Here is the sequence that causes it:

ioctl DRM_IOCTL_MODE_GETCONNECTOR from userspace
  drm_mode_getconnector (acquires mode_config mutex)
connector-fill_modes()
drm_helper_probe_single_connector_modes
  connector_funcs-get_modes
adv7511_encoder_get_modes
  adv7511_get_edid_block
adv7511_irq_process
  drm_helper_hpd_irq_event (acquires mode_config mutex again)

In adv7511_irq_process, don't call drm_helper_hpd_irq_event when not
called from interrupt context. It doesn't serve any purpose there anyway.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/i2c/adv7511.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c
index 2aaa3c8..cf5bb29 100644
--- a/drivers/gpu/drm/i2c/adv7511.c
+++ b/drivers/gpu/drm/i2c/adv7511.c
@@ -422,7 +422,7 @@ static bool adv7511_hpd(struct adv7511 *adv7511)
return false;
 }
 
-static int adv7511_irq_process(struct adv7511 *adv7511)
+static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd)
 {
unsigned int irq0, irq1;
int ret;
@@ -438,7 +438,7 @@ static int adv7511_irq_process(struct adv7511 *adv7511)
regmap_write(adv7511-regmap, ADV7511_REG_INT(0), irq0);
regmap_write(adv7511-regmap, ADV7511_REG_INT(1), irq1);
 
-   if (irq0  ADV7511_INT0_HDP  adv7511-encoder)
+   if (process_hpd  irq0  ADV7511_INT0_HDP  adv7511-encoder)
drm_helper_hpd_irq_event(adv7511-encoder-dev);
 
if (irq0  ADV7511_INT0_EDID_READY || irq1  ADV7511_INT1_DDC_ERROR) {
@@ -456,7 +456,7 @@ static irqreturn_t adv7511_irq_handler(int irq, void *devid)
struct adv7511 *adv7511 = devid;
int ret;
 
-   ret = adv7511_irq_process(adv7511);
+   ret = adv7511_irq_process(adv7511, true);
return ret  0 ? IRQ_NONE : IRQ_HANDLED;
 }
 
@@ -473,7 +473,7 @@ static int adv7511_wait_for_edid(struct adv7511 *adv7511, 
int timeout)
adv7511-edid_read, msecs_to_jiffies(timeout));
} else {
for (; timeout  0; timeout -= 25) {
-   ret = adv7511_irq_process(adv7511);
+   ret = adv7511_irq_process(adv7511, false);
if (ret  0)
break;
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 0/5] drm/i2c: adv7511: ADV7533 support

2015-07-27 Thread Archit Taneja
ADV7533 is a DSI to HDMI encoder chip. It's like ADV7511, but with an
additional DSI RX block that takes in DSI video mode output.

This series adds support for ADV7533. Unlike ADV7511 that's modelled as
a drm i2c slave encoder, ADV7533 is a drm_bridge object. The bridge ops
further create a HDMI type connector device for the chip's output.

In order to pass DSI specific parameters to the host, the driver creates
a dummy DSI device, which it registers to a DSI host as specified via DT.

The first patch in the series is a minor fix, the rest add ADV7533
support. They depend on the series I posted sometime back:

drm/dsi: DSI for devices with different control bus
https://lkml.org/lkml/2015/6/30/42

Archit Taneja (4):
  drm/i2c: adv7511: Fix mutex deadlock when interrupts are disabled
  drm/i2c: adv7511: Refactor encoder slave functions
  drm/i2c: adv7511: Add drm_bridge/connector for ADV7533
  drm/i2c: adv7511: Create mipi_dsi_device for ADV7533

Lars-Peter Clausen (1):
  drm/i2c: adv7511: Initial support for adv7533

 drivers/gpu/drm/i2c/adv7511.c | 486 +-
 1 file changed, 437 insertions(+), 49 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm 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/25] drm: fb emulation: Step 1: Create new drm_fb_helper wrapper funcs

2015-07-13 Thread Archit Taneja



On 07/13/2015 01:37 PM, Daniel Vetter wrote:

On Mon, Jul 13, 2015 at 12:07:56PM +0530, Archit Taneja wrote:

DRM drivers using drm_fb_helpers still call some fbdev core functions.
This makes the driver depend on CONFIG_FB, resulting in complicated
Kconfig options, and preventing us from creating a top level drm config
option to enable/disable FBDEV emulation.

Create new drm_fb_helper functions that replace these fbdev functions.

In most cases, the new helper funcs simply wrap around the original fbdev
functions. For a few (like framebufer_alloc), we actually do some work
that is currently redundant across multiple drivers.

With these patches, the drivers don't call any fbdev functions directly.
They are now called through functions in drm_fb_helper.c. We will later
create a fbdev emulation config option to stub out the fb helpers.

The only exception is vmwgfx driver. This doesn't use drm_fb_helper. It
creates a fb device how a driver in drivers/video/fbdev would. Maybe this
needs to be converted to use drm_fb_helpers.

For more info, have a look at the threads:
http://lists.freedesktop.org/archives/dri-devel/2015-March/078729.html
http://lists.freedesktop.org/archives/dri-devel/2015-March/078975.html


I think overall this looks really nice. I quickly fired this up on an i915
machine and it worked, so I pulled it all into topic/drm-misc (which is in
linux-next) to give this the testing it needs. I'll probably do a separate
topic branch for the pull request to Dave with the final patches. My plan
would be to make one overall pull for step 1 plus the first patch of step
2. Then everything else could go in through driver maintainers like usual
I think.


Okay. That sounds good to me too. I'll fix up the comments and the 
warnings thrown by the kbuild bot.


There was an initial Kconfig clean up patch set 'drm/misc: Kconfig 
cleanup' that will make the remainder steps easier to pull. Could we try 
to get that in too?


Archit



Cheers, Daniel



Archit Taneja (25):
   drm/fb_helper: Add drm_fb_helper functions to manage fb_info creation
   drm/fb_helper: Create a wrapper for unlink_framebuffer
   drm/fb_helper: Create wrappers for fb_sys_read/write funcs
   drm/fb_helper: Create wrappers for blit, copyarea and fillrect funcs
   drm/fb_helper: Create a wrapper for fb_set_suspend
   drm/fb_helper: Create a wrapper for remove_conflicting_framebuffers
   drm/cirrus: Use new drm_fb_helper functions
   drm/rockchip: Use new drm_fb_helper functions
   drm/armada: Use new drm_fb_helper functions
   drm/ast: Use new drm_fb_helper functions
   drm/omap: Use new drm_fb_helper functions
   drm/tegra: Use new drm_fb_helper functions
   drm/msm: Use new drm_fb_helper functions
   drm/exynos: Use new drm_fb_helper functions
   drm/gma500: Use new drm_fb_helper functions
   drm/mgag200: Use new drm_fb_helper functions
   drm/radeon: Use new drm_fb_helper functions
   drm/qxl: Use new drm_fb_helper functions
   drm/i915: Use new drm_fb_helper functions
   drm/nouveau: Use new drm_fb_helper functions
   drm/udl: Use new drm_fb_helper functions
   drm/boschs: Use new drm_fb_helper functions
   drm/amdgpu: Use new drm_fb_helper functions
   drm/virtio: Use new drm_fb_helper functions
   drm/fb_cma_helper: Use new drm_fb_helper functions

  drivers/gpu/drm/Kconfig   |   7 ++
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   |   4 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c|  43 +++-
  drivers/gpu/drm/armada/armada_fbdev.c |  33 ++
  drivers/gpu/drm/ast/ast_fb.c  |  47 +++--
  drivers/gpu/drm/bochs/bochs_drv.c |   6 +-
  drivers/gpu/drm/bochs/bochs_fbdev.c   |  34 ++
  drivers/gpu/drm/cirrus/cirrus_drv.c   |   7 +-
  drivers/gpu/drm/cirrus/cirrus_fbdev.c |  39 ++-
  drivers/gpu/drm/drm_fb_cma_helper.c   |  45 ++--
  drivers/gpu/drm/drm_fb_helper.c   | 142 ++
  drivers/gpu/drm/exynos/exynos_drm_fbdev.c |  45 +++-
  drivers/gpu/drm/gma500/accel_2d.c |   6 +-
  drivers/gpu/drm/gma500/framebuffer.c  |  47 +++--
  drivers/gpu/drm/i915/i915_dma.c   |   3 +-
  drivers/gpu/drm/i915/intel_fbdev.c|  40 +++-
  drivers/gpu/drm/mgag200/mgag200_drv.c |   3 +-
  drivers/gpu/drm/mgag200/mgag200_fb.c  |  36 ++-
  drivers/gpu/drm/mgag200/mgag200_main.c|   2 +-
  drivers/gpu/drm/msm/msm_fbdev.c   |  34 ++
  drivers/gpu/drm/nouveau/nouveau_drm.c |   3 +-
  drivers/gpu/drm/nouveau/nouveau_fbcon.c   |  38 +++
  drivers/gpu/drm/omapdrm/omap_fbdev.c  |  34 ++
  drivers/gpu/drm/qxl/qxl_fb.c  |  40 +++-
  drivers/gpu/drm/radeon/radeon_drv.c   |   4 +-
  drivers/gpu/drm/radeon/radeon_fb.c|  41 +++-
  drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c |  47 +++--
  drivers/gpu/drm/tegra/fb.c|  40

Re: [PATCH 03/25] drm/fb_helper: Create wrappers for fb_sys_read/write funcs

2015-07-13 Thread Archit Taneja



On 07/13/2015 01:01 PM, Daniel Vetter wrote:

On Mon, Jul 13, 2015 at 12:07:59PM +0530, Archit Taneja wrote:

Some drm drivers populate their fb_ops with fb_sys_read/write fb sysfs
ops.

Create a drm_fb_helper function  that wraps around these calls.

This is part of an effort to prevent drm drivers from calling fbdev
functions directly, in order to make fbdev emulation a top level drm
option.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
  drivers/gpu/drm/Kconfig |  1 +
  drivers/gpu/drm/drm_fb_helper.c | 20 
  include/drm/drm_fb_helper.h |  5 +
  3 files changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index a66ac44..b284cdc 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -37,6 +37,7 @@ config DRM_KMS_FB_HELPER
select FB
select FRAMEBUFFER_CONSOLE if !EXPERT
select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
+   select FB_SYS_FOPS
help
  FBDEV helpers for KMS drivers.

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 742377d..795547e 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -744,6 +744,26 @@ void drm_fb_helper_unlink_fbi(struct drm_fb_helper 
*fb_helper)
  }
  EXPORT_SYMBOL(drm_fb_helper_unlink_fbi);

+ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
+   size_t count, loff_t *ppos)
+{
+   if (info)


I think this check here can never fail (if there's no fbdev you can't call
this function), I don't think we need it. Even for drivers which call this
themselves (like qxl/udl) they only call it from fbdev code.


That's a good point. I'll remove the 'if (info)' check.

qxl/udl don't seem to call the fb sysfs funcs. So I think it's okay.

Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 00/21] drm: fb emulation: Step 3: Remove FB_KMS_HELPER config from drivers

2015-07-14 Thread Archit Taneja

Hi,

On 07/13/2015 09:07 PM, Daniel Vetter wrote:

On Mon, Jul 13, 2015 at 11:30:34AM -0400, Alex Deucher wrote:

On Mon, Jul 13, 2015 at 2:43 AM, Archit Taneja arch...@codeaurora.org wrote:

With the top level DRM_FBDEV_EMULATION option, drivers don't need to
select DRM_FB_KMS_HELPER or other FB related config options in the
driver.

Even if FBDEV_EMULATION isn't select, the stubbed out versions of
the drm_fb_helper functions will be called.

There are some drivers which still need some FB stuff even after
these changes. They are qxl, udl and nouveau. These are handled a bit
differently compared to the other patches.


Series is:
Acked-by: Alex Deucher alexander.deuc...@amd.com


Archit for merging I think I'll just keep the current set of patches I
have for testing (well until there's a real bug discovered). Can you
please collect all the acks/r-bs/t-d when resending so I don't have to
digg them out when we merge the final versions of these?



Sure. I'll keep a track of this.

Speaking of bugs, there was one thing I noticed in the series which I
am not sure about.

One of the new helpers wraps around framebuffer_alloc(). Most drivers
tend to pass the drm_device's dev pointer to this, and this is what I
do in the helper too.

But some drivers(nouveau, radeon, qxl and some more) pass their
pci_dev's dev pointer.

Looking at the framebuffer code, it looks like the 'dev' we pass to
framebuffer_alloc is what is used as the parent device when
creating a fb device.

After this patch set, all drivers will use drm_device's dev when
calling framebuffer_alloc. I was wondering if this could cause any
fbcon issues?

Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 12/25] drm/tegra: Use new drm_fb_helper functions

2015-07-14 Thread Archit Taneja



On 07/14/2015 02:20 PM, Thierry Reding wrote:

On Mon, Jul 13, 2015 at 12:08:08PM +0530, Archit Taneja wrote:
[...]

diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c

[...]

@@ -224,11 +224,11 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
if (IS_ERR(bo))
return PTR_ERR(bo);

-   info = framebuffer_alloc(0, drm-dev);
-   if (!info) {
+   info = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(info)) {
dev_err(drm-dev, failed to allocate framebuffer info\n);
-   drm_gem_object_unreference_unlocked(bo-gem);
-   return -ENOMEM;
+   err = PTR_ERR(info);
+   goto gem_unref;
}

fbdev-fb = tegra_fb_alloc(drm, cmd, bo, 1);
@@ -236,7 +236,6 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
err = PTR_ERR(fbdev-fb);
dev_err(drm-dev, failed to allocate DRM framebuffer: %d\n,
err);
-   drm_gem_object_unreference_unlocked(bo-gem);
goto release;
}

@@ -248,12 +247,6 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
info-flags = FBINFO_FLAG_DEFAULT;
info-fbops = tegra_fb_ops;

-   err = fb_alloc_cmap(info-cmap, 256, 0);
-   if (err  0) {
-   dev_err(drm-dev, failed to allocate color map: %d\n, err);
-   goto destroy;
-   }
-
drm_fb_helper_fill_fix(info, fb-pitches[0], fb-depth);
drm_fb_helper_fill_var(info, helper, fb-width, fb-height);

@@ -282,7 +275,9 @@ destroy:
drm_framebuffer_unregister_private(fb);
tegra_fb_destroy(fb);
  release:
-   framebuffer_release(info);
+   drm_fb_helper_release_fbi(helper);
+gem_unref:
+   drm_gem_object_unreference_unlocked(bo-gem);


You can't do this. tegra_fb_alloc() takes ownership of the buffer, so
unless you compensate for that (by taking an explicit reference to the
buffer in tegra_fb_alloc()) you'd be dereferencing twice and likely end
up with use-after-free errors later on.

I'd prefer to keep the error clean up as it is.


Okay. I missed out on the fact that tegra_fb_destroy in the clean up
code calls drm_gem_object_unreference_unlocked. I'll keep it as is.

Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 00/21] drm: fb emulation: Step 3: Remove FB_KMS_HELPER config from drivers

2015-07-14 Thread Archit Taneja



On 07/14/2015 01:32 PM, Thierry Reding wrote:

On Tue, Jul 14, 2015 at 12:01:51PM +0530, Archit Taneja wrote:

Hi,

On 07/13/2015 09:07 PM, Daniel Vetter wrote:

On Mon, Jul 13, 2015 at 11:30:34AM -0400, Alex Deucher wrote:

On Mon, Jul 13, 2015 at 2:43 AM, Archit Taneja arch...@codeaurora.org wrote:

With the top level DRM_FBDEV_EMULATION option, drivers don't need to
select DRM_FB_KMS_HELPER or other FB related config options in the
driver.

Even if FBDEV_EMULATION isn't select, the stubbed out versions of
the drm_fb_helper functions will be called.

There are some drivers which still need some FB stuff even after
these changes. They are qxl, udl and nouveau. These are handled a bit
differently compared to the other patches.


Series is:
Acked-by: Alex Deucher alexander.deuc...@amd.com


Archit for merging I think I'll just keep the current set of patches I
have for testing (well until there's a real bug discovered). Can you
please collect all the acks/r-bs/t-d when resending so I don't have to
digg them out when we merge the final versions of these?



Sure. I'll keep a track of this.

Speaking of bugs, there was one thing I noticed in the series which I
am not sure about.

One of the new helpers wraps around framebuffer_alloc(). Most drivers
tend to pass the drm_device's dev pointer to this, and this is what I
do in the helper too.

But some drivers(nouveau, radeon, qxl and some more) pass their
pci_dev's dev pointer.


As far as I can tell, for all PCI drivers the drm_device's dev pointer
is set to the pci_dev's dev pointer (via drm_get_pci_dev()), so this
shouldn't be changing anything at all.


Thanks for pointing this out. This is a non-issue, then.

Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC v2 0/6] drm: fb emulation: Step 2: Create a fbdev emulation config option

2015-07-13 Thread Archit Taneja
This provides a uniform interface to enable/disable legacy fbdev support
for modesetting drivers.

DRM_FBDEV_EMULATION is made available in the top level drm Kconfig. A
driver that wants fbdev emulation using drm_fb_helper can enable this
option.

Apart from 5 drivers (msm, tegra, imx, sti, i915), all enable fbdev
emulation by default. For these drivers, if we explicitly disable fbdev
emulation, the 'hope' is that we will cleanly bail out with an error. We
set DRM_FBDEV_EMULATION to 'y' by default, since most drivers rely on it.


Archit Taneja (6):
  drm: Add top level Kconfig option for DRM fbdev emulation
  drm/msm: Remove local fbdev emulation Kconfig option
  drm/tegra: Remove local fbdev emulation Kconfig option
  drm/imx: Remove local fbdev emulation Kconfig option
  drm/sti: Remove local fbdev emulation Kconfig option
  drm/i915: Remove local fbdev emulation Kconfig option

 drivers/gpu/drm/Kconfig  |  12 +++
 drivers/gpu/drm/Makefile |   2 +-
 drivers/gpu/drm/i915/Kconfig |  15 ---
 drivers/gpu/drm/i915/Makefile|   4 +-
 drivers/gpu/drm/i915/i915_debugfs.c  |   2 +-
 drivers/gpu/drm/i915/i915_drv.h  |   2 -
 drivers/gpu/drm/i915/intel_display.c |  10 +-
 drivers/gpu/drm/i915/intel_dp_mst.c  |  14 +--
 drivers/gpu/drm/i915/intel_drv.h |   3 +-
 drivers/gpu/drm/i915/intel_fbdev.c   |   7 --
 drivers/gpu/drm/imx/Kconfig  |   9 --
 drivers/gpu/drm/imx/imx-drm-core.c   |  10 +-
 drivers/gpu/drm/msm/Kconfig  |  14 ---
 drivers/gpu/drm/msm/Makefile |   2 +-
 drivers/gpu/drm/msm/msm_drv.c|   8 +-
 drivers/gpu/drm/sti/Kconfig  |   6 --
 drivers/gpu/drm/sti/sti_drm_drv.c|   2 +-
 drivers/gpu/drm/tegra/Kconfig|  12 ---
 drivers/gpu/drm/tegra/drm.c  |  15 ++-
 drivers/gpu/drm/tegra/drm.h  |   8 --
 drivers/gpu/drm/tegra/fb.c   |  25 ++---
 include/drm/drm_fb_helper.h  | 192 +++
 22 files changed, 242 insertions(+), 132 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC v2 1/6] drm: Add top level Kconfig option for DRM fbdev emulation

2015-07-13 Thread Archit Taneja
Legacy fbdev emulation support via DRM is achieved through KMS FB helpers.
Most modesetting drivers enable provide fbdev emulation by default by
selecting KMS FB helpers. A few provide a separate Kconfig option for the
user to enable or disbale fbdev emulation.

Enabling fbdev emulation is finally a distro-level decision. Having a top
level Kconfig option for fbdev emulation helps by providing a uniform way
to enable/disable fbdev emulation for any modesetting driver. It also lets
us remove unnecessary driver specific Kconfig options that causes bloat.

With a top level Kconfig in place, we can stub out the fb helper functions
when not needed without breaking functionality. Having stub functions also
prevents drivers to require wrapping fb helper function calls with #ifdefs.

DRM_FBDEV_EMULATION defaults to y since many drivers enable fbdev
emulation by default and majority of distributions expect the fbdev
interface in the kernel.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/Kconfig |  12 +++
 drivers/gpu/drm/Makefile|   2 +-
 include/drm/drm_fb_helper.h | 192 
 3 files changed, 205 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index e373f8a..8fd670b 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -47,6 +47,18 @@ config DRM_KMS_FB_HELPER
help
  FBDEV helpers for KMS drivers.
 
+config DRM_FBDEV_EMULATION
+   bool Enable legacy fbdev support for your modesetting driver
+   depends on DRM
+   select DRM_KMS_HELPER
+   select DRM_KMS_FB_HELPER
+   default y
+   help
+ Choose this option if you have a need for the legacy fbdev
+ support. Note that this support also provide the linux console
+ support on top of your modesetting driver. You'd need this if
+ you're looking for console support too.
+
 config DRM_LOAD_EDID_FIRMWARE
bool Allow to specify an EDID data set instead of probing for it
depends on DRM_KMS_HELPER
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 5713d05..8858510 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -23,7 +23,7 @@ drm-$(CONFIG_OF) += drm_of.o
 drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \
drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o
 drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
-drm_kms_helper-$(CONFIG_DRM_KMS_FB_HELPER) += drm_fb_helper.o
+drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
 drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
 
 obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index cc19e88..8f972da 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -122,6 +122,7 @@ struct drm_fb_helper {
bool delayed_hotplug;
 };
 
+#ifdef CONFIG_DRM_FBDEV_EMULATION
 void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper 
*helper,
   const struct drm_fb_helper_funcs *funcs);
 int drm_fb_helper_init(struct drm_device *dev,
@@ -188,4 +189,195 @@ drm_pick_cmdline_mode(struct drm_fb_helper_connector 
*fb_helper_conn,
 int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct 
drm_connector *connector);
 int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
   struct drm_connector *connector);
+#else
+static inline void drm_fb_helper_prepare(struct drm_device *dev,
+   struct drm_fb_helper *helper,
+   const struct drm_fb_helper_funcs *funcs)
+{
+}
+
+static inline int drm_fb_helper_init(struct drm_device *dev,
+  struct drm_fb_helper *helper, int crtc_count,
+  int max_conn)
+{
+   return 0;
+}
+
+static inline void drm_fb_helper_fini(struct drm_fb_helper *helper)
+{
+}
+
+static inline int drm_fb_helper_blank(int blank, struct fb_info *info)
+{
+   return 0;
+}
+
+static inline int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
+   struct fb_info *info)
+{
+   return 0;
+}
+
+static inline int drm_fb_helper_set_par(struct fb_info *info)
+{
+   return 0;
+}
+
+static inline int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
+ struct fb_info *info)
+{
+   return 0;
+}
+
+static inline bool
+drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
+{
+   return true;
+}
+
+static inline struct fb_info *
+drm_fb_helper_alloc_fbi(struct drm_fb_helper *fb_helper)
+{
+   return NULL;
+}
+
+static inline void drm_fb_helper_unregister_fbi(struct drm_fb_helper 
*fb_helper)
+{
+}
+static inline void drm_fb_helper_release_fbi(struct

[RFC v2 5/6] drm/sti: Remove local fbdev emulation Kconfig option

2015-07-13 Thread Archit Taneja
DRM_STI_FBDEV config is currently used to enable/disable fbdev emulation
for the sti kms driver.

Remove this local config option and use the top level DRM_FBDEV_EMULATION
config option instead where applicable.

We replace the #ifdef in sti_drm_load with CONFIG_DRM_FBDEV_EMULATION.
It's probably okay to get remove the #ifdef itself, but just left it here
for now to be safe. It can be removed after some testing.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/sti/Kconfig   | 6 --
 drivers/gpu/drm/sti/sti_drm_drv.c | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig
index fbccc10..e3aa5af 100644
--- a/drivers/gpu/drm/sti/Kconfig
+++ b/drivers/gpu/drm/sti/Kconfig
@@ -9,9 +9,3 @@ config DRM_STI
select FW_LOADER_USER_HELPER_FALLBACK
help
  Choose this option to enable DRM on STM stiH41x chipset
-
-config DRM_STI_FBDEV
-   bool DRM frame buffer device for STMicroelectronics SoC stiH41x Serie
-   depends on DRM_STI
-   help
- Choose this option to enable FBDEV on top of DRM for STM stiH41x 
chipset
diff --git a/drivers/gpu/drm/sti/sti_drm_drv.c 
b/drivers/gpu/drm/sti/sti_drm_drv.c
index 59d558b..36493eb 100644
--- a/drivers/gpu/drm/sti/sti_drm_drv.c
+++ b/drivers/gpu/drm/sti/sti_drm_drv.c
@@ -160,7 +160,7 @@ static int sti_drm_load(struct drm_device *dev, unsigned 
long flags)
 
drm_mode_config_reset(dev);
 
-#ifdef CONFIG_DRM_STI_FBDEV
+#ifdef CONFIG_DRM_FBDEV_EMULATION
drm_fbdev_cma_init(dev, 32,
   dev-mode_config.num_crtc,
   dev-mode_config.num_connector);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC v2 2/6] drm/msm: Remove local fbdev emulation Kconfig option

2015-07-13 Thread Archit Taneja
DRM_MSM_FBDEV config is used to enable/disable fbdev emulation for the
msm kms driver.

Replace this with the top level DRM_FBDEV_EMULATION config option where
applicable. This also prevents build breaks caused by undefined
drm_fb_helper_* functions when legacy fbdev support was disabled.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/msm/Kconfig   | 14 --
 drivers/gpu/drm/msm/Makefile  |  2 +-
 drivers/gpu/drm/msm/msm_drv.c |  8 ++--
 3 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 08ba8d0..ebb03fd 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -13,20 +13,6 @@ config DRM_MSM
help
  DRM/KMS driver for MSM/snapdragon.
 
-config DRM_MSM_FBDEV
-   bool Enable legacy fbdev support for MSM modesetting driver
-   depends on DRM_MSM
-   select DRM_KMS_FB_HELPER
-   select FB_SYS_FILLRECT
-   select FB_SYS_COPYAREA
-   select FB_SYS_IMAGEBLIT
-   select FB_SYS_FOPS
-   default y
-   help
- Choose this option if you have a need for the legacy fbdev
- support. Note that this support also provide the linux console
- support on top of the MSM modesetting driver.
-
 config DRM_MSM_REGISTER_LOGGING
bool MSM DRM register logging
depends on DRM_MSM
diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
index 16a81b9..5b08951 100644
--- a/drivers/gpu/drm/msm/Makefile
+++ b/drivers/gpu/drm/msm/Makefile
@@ -49,7 +49,7 @@ msm-y := \
msm_rd.o \
msm_ringbuffer.o
 
-msm-$(CONFIG_DRM_MSM_FBDEV) += msm_fbdev.o
+msm-$(CONFIG_DRM_FBDEV_EMULATION) += msm_fbdev.o
 msm-$(CONFIG_COMMON_CLK) += mdp/mdp4/mdp4_lvds_pll.o
 
 msm-$(CONFIG_DRM_MSM_DSI) += dsi/dsi.o \
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index b7ef56e..8061bd9 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -21,11 +21,9 @@
 
 static void msm_fb_output_poll_changed(struct drm_device *dev)
 {
-#ifdef CONFIG_DRM_MSM_FBDEV
struct msm_drm_private *priv = dev-dev_private;
if (priv-fbdev)
drm_fb_helper_hotplug_event(priv-fbdev);
-#endif
 }
 
 static const struct drm_mode_config_funcs mode_config_funcs = {
@@ -56,7 +54,7 @@ module_param(reglog, bool, 0600);
 #define reglog 0
 #endif
 
-#ifdef CONFIG_DRM_MSM_FBDEV
+#ifdef CONFIG_DRM_FBDEV_EMULATION
 static bool fbdev = true;
 MODULE_PARM_DESC(fbdev, Enable fbdev compat layer);
 module_param(fbdev, bool, 0600);
@@ -353,7 +351,7 @@ static int msm_load(struct drm_device *dev, unsigned long 
flags)
 
drm_mode_config_reset(dev);
 
-#ifdef CONFIG_DRM_MSM_FBDEV
+#ifdef CONFIG_DRM_FBDEV_EMULATION
if (fbdev)
priv-fbdev = msm_fbdev_init(dev);
 #endif
@@ -421,11 +419,9 @@ static void msm_preclose(struct drm_device *dev, struct 
drm_file *file)
 
 static void msm_lastclose(struct drm_device *dev)
 {
-#ifdef CONFIG_DRM_MSM_FBDEV
struct msm_drm_private *priv = dev-dev_private;
if (priv-fbdev)
drm_fb_helper_restore_fbdev_mode_unlocked(priv-fbdev);
-#endif
 }
 
 static irqreturn_t msm_irq(int irq, void *arg)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC v2 3/6] drm/tegra: Remove local fbdev emulation Kconfig option

2015-07-13 Thread Archit Taneja
DRM_TEGRA_FBDEV config is currently used to enable/disable fbdev emulation
for the tegra kms driver.

Replace this with the top level DRM_FBDEV_EMULATION config option. Using
this config lets us also prevent wrapping around drm_fb_helper_* calls with

The #ifdef in tegra_drm struct that adds/removes the terga_fbdev member
has been removed completely. This helps in calling stub drm fb helper
functions at not much cost.

We could clean up fb.c a bit further to reduce the number of #ifdefs, but
that's left for later.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/tegra/Kconfig | 12 
 drivers/gpu/drm/tegra/drm.c   | 15 ++-
 drivers/gpu/drm/tegra/drm.h   |  8 
 drivers/gpu/drm/tegra/fb.c| 25 ++---
 4 files changed, 16 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig
index 74d9d62..63ebb15 100644
--- a/drivers/gpu/drm/tegra/Kconfig
+++ b/drivers/gpu/drm/tegra/Kconfig
@@ -16,18 +16,6 @@ config DRM_TEGRA
 
 if DRM_TEGRA
 
-config DRM_TEGRA_FBDEV
-   bool Enable legacy fbdev support
-   select DRM_KMS_FB_HELPER
-   select FB_SYS_FILLRECT
-   select FB_SYS_COPYAREA
-   select FB_SYS_IMAGEBLIT
-   default y
-   help
- Choose this option if you have a need for the legacy fbdev support.
- Note that this support also provides the Linux console on top of
- the Tegra modesetting driver.
-
 config DRM_TEGRA_DEBUG
bool NVIDIA Tegra DRM debug support
help
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 427f50c..e884e54 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -104,11 +104,17 @@ static int tegra_atomic_commit(struct drm_device *drm,
return 0;
 }
 
+static inline void tegra_fb_output_poll_changed(struct drm_device *drm)
+{
+   struct tegra_drm *tegra = drm-dev_private;
+
+   if (tegra-fbdev)
+   drm_fb_helper_hotplug_event(tegra-fbdev-base);
+}
+
 static const struct drm_mode_config_funcs tegra_drm_mode_funcs = {
.fb_create = tegra_fb_create,
-#ifdef CONFIG_DRM_TEGRA_FBDEV
.output_poll_changed = tegra_fb_output_poll_changed,
-#endif
.atomic_check = drm_atomic_helper_check,
.atomic_commit = tegra_atomic_commit,
 };
@@ -259,11 +265,10 @@ static void tegra_drm_context_free(struct 
tegra_drm_context *context)
 
 static void tegra_drm_lastclose(struct drm_device *drm)
 {
-#ifdef CONFIG_DRM_TEGRA_FBDEV
struct tegra_drm *tegra = drm-dev_private;
 
-   tegra_fbdev_restore_mode(tegra-fbdev);
-#endif
+   if (tegra-fbdev)
+   drm_fb_helper_restore_fbdev_mode_unlocked(tegra-fbdev-base);
 }
 
 static struct host1x_bo *
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index 659b2fc..25ee5ea 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -29,12 +29,10 @@ struct tegra_fb {
unsigned int num_planes;
 };
 
-#ifdef CONFIG_DRM_TEGRA_FBDEV
 struct tegra_fbdev {
struct drm_fb_helper base;
struct tegra_fb *fb;
 };
-#endif
 
 struct tegra_drm {
struct drm_device *drm;
@@ -45,9 +43,7 @@ struct tegra_drm {
struct mutex clients_lock;
struct list_head clients;
 
-#ifdef CONFIG_DRM_TEGRA_FBDEV
struct tegra_fbdev *fbdev;
-#endif
 
unsigned int pitch_align;
 
@@ -263,10 +259,6 @@ int tegra_drm_fb_prepare(struct drm_device *drm);
 void tegra_drm_fb_free(struct drm_device *drm);
 int tegra_drm_fb_init(struct drm_device *drm);
 void tegra_drm_fb_exit(struct drm_device *drm);
-#ifdef CONFIG_DRM_TEGRA_FBDEV
-void tegra_fbdev_restore_mode(struct tegra_fbdev *fbdev);
-void tegra_fb_output_poll_changed(struct drm_device *drm);
-#endif
 
 extern struct platform_driver tegra_dc_driver;
 extern struct platform_driver tegra_dsi_driver;
diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
index a2d66f9..1fd595c 100644
--- a/drivers/gpu/drm/tegra/fb.c
+++ b/drivers/gpu/drm/tegra/fb.c
@@ -18,7 +18,7 @@ static inline struct tegra_fb *to_tegra_fb(struct 
drm_framebuffer *fb)
return container_of(fb, struct tegra_fb, base);
 }
 
-#ifdef CONFIG_DRM_TEGRA_FBDEV
+#ifdef CONFIG_DRM_FBDEV_EMULATION
 static inline struct tegra_fbdev *to_tegra_fbdev(struct drm_fb_helper *helper)
 {
return container_of(helper, struct tegra_fbdev, base);
@@ -181,7 +181,7 @@ unreference:
return ERR_PTR(err);
 }
 
-#ifdef CONFIG_DRM_TEGRA_FBDEV
+#ifdef CONFIG_DRM_FBDEV_EMULATION
 static struct fb_ops tegra_fb_ops = {
.owner = THIS_MODULE,
.fb_fillrect = drm_fb_helper_sys_fillrect,
@@ -355,24 +355,11 @@ static void tegra_fbdev_exit(struct tegra_fbdev *fbdev)
tegra_fbdev_free(fbdev);
 }
 
-void tegra_fbdev_restore_mode(struct tegra_fbdev *fbdev)
-{
-   if (fbdev)
-   drm_fb_helper_restore_fbdev_mode_unlocked(fbdev-base);
-}
-
-void

[RFC v2 6/6] drm/i915: Remove local fbdev emulation Kconfig option

2015-07-13 Thread Archit Taneja
DRM_I915_FBDEV config is currently used to enable/disable fbdev emulation
for the i915 kms driver.

Replace this with the top level DRM_FBDEV_EMULATION config option. Using
this config lets us also prevent wrapping around drm_fb_helper_* calls with

The #ifdef in drm_i915_private struct adding/removing members intel_fbdev
and fbdev_suspend_work has been removed. This helps us use stub drm helper
functions at not much cost.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/i915/Kconfig | 15 ---
 drivers/gpu/drm/i915/Makefile|  4 ++--
 drivers/gpu/drm/i915/i915_debugfs.c  |  2 +-
 drivers/gpu/drm/i915/i915_drv.h  |  2 --
 drivers/gpu/drm/i915/intel_display.c | 10 --
 drivers/gpu/drm/i915/intel_dp_mst.c  | 14 --
 drivers/gpu/drm/i915/intel_drv.h |  3 +--
 drivers/gpu/drm/i915/intel_fbdev.c   |  7 ---
 8 files changed, 16 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
index 74acca9..bd9ccfc 100644
--- a/drivers/gpu/drm/i915/Kconfig
+++ b/drivers/gpu/drm/i915/Kconfig
@@ -45,21 +45,6 @@ config DRM_I915_KMS
 
  If in doubt, say Y.
 
-config DRM_I915_FBDEV
-   bool Enable legacy fbdev support for the modesetting intel driver
-   depends on DRM_I915
-   select DRM_KMS_FB_HELPER
-   select FB_CFB_FILLRECT
-   select FB_CFB_COPYAREA
-   select FB_CFB_IMAGEBLIT
-   default y
-   help
- Choose this option if you have a need for the legacy fbdev
- support. Note that this support also provide the linux console
- support on top of the intel modesetting driver.
-
- If in doubt, say Y.
-
 config DRM_I915_PRELIMINARY_HW_SUPPORT
bool Enable preliminary support for prerelease Intel hardware by 
default
depends on DRM_I915
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index b7ddf48..355e43f 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -56,8 +56,8 @@ i915-y += intel_audio.o \
  intel_psr.o \
  intel_sideband.o \
  intel_sprite.o
-i915-$(CONFIG_ACPI)+= intel_acpi.o intel_opregion.o
-i915-$(CONFIG_DRM_I915_FBDEV)  += intel_fbdev.o
+i915-$(CONFIG_ACPI)+= intel_acpi.o intel_opregion.o
+i915-$(CONFIG_DRM_FBDEV_EMULATION) += intel_fbdev.o
 
 # modesetting output/encoder code
 i915-y += dvo_ch7017.o \
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index 82bbe3f..bcce317 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1849,7 +1849,7 @@ static int i915_gem_framebuffer_info(struct seq_file *m, 
void *data)
struct intel_fbdev *ifbdev = NULL;
struct intel_framebuffer *fb;
 
-#ifdef CONFIG_DRM_I915_FBDEV
+#ifdef CONFIG_DRM_FBDEV_EMULATION
struct drm_i915_private *dev_priv = dev-dev_private;
 
ifbdev = dev_priv-fbdev;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 542fac6..ab5881c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1798,11 +1798,9 @@ struct drm_i915_private {
 
struct drm_i915_gem_object *vlv_pctx;
 
-#ifdef CONFIG_DRM_I915_FBDEV
/* list of fbdev register on this device */
struct intel_fbdev *fbdev;
struct work_struct fbdev_suspend_work;
-#endif
 
struct drm_property *broadcast_rgb_property;
struct drm_property *force_audio_property;
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 1b61f98..0acd801 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9886,7 +9886,6 @@ static struct drm_framebuffer *
 mode_fits_in_fbdev(struct drm_device *dev,
   struct drm_display_mode *mode)
 {
-#ifdef CONFIG_DRM_I915_FBDEV
struct drm_i915_private *dev_priv = dev-dev_private;
struct drm_i915_gem_object *obj;
struct drm_framebuffer *fb;
@@ -9909,9 +9908,6 @@ mode_fits_in_fbdev(struct drm_device *dev,
return NULL;
 
return fb;
-#else
-   return NULL;
-#endif
 }
 
 static int intel_modeset_setup_plane_state(struct drm_atomic_state *state,
@@ -14296,11 +14292,13 @@ intel_user_framebuffer_create(struct drm_device *dev,
return intel_framebuffer_create(dev, mode_cmd, obj);
 }
 
-#ifndef CONFIG_DRM_I915_FBDEV
 static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)
 {
+   struct drm_i915_private *dev_priv = dev-dev_private;
+
+   if (dev_priv-fbdev)
+   drm_fb_helper_hotplug_event(dev_priv-fbdev-helper);
 }
-#endif
 
 static const struct drm_mode_config_funcs intel_mode_funcs = {
.fb_create = intel_user_framebuffer_create,
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c 
b/drivers/gpu/drm/i915/intel_dp_mst.c
index 6e4cc53..66eaf6f 100644
--- a/drivers

[RFC 11/21] drm/nouveau: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Removing FB_BACKLIGHT gives dependency issues. For now, make the driver
depend on DRM_FBDEV_EMULATION config option. We should remove this once
the driver can work without FB_BACKLIGHT too.

Cc: David Airlie airl...@linux.ie
Cc: Ben Skeggs bske...@redhat.com
Cc: Alexandre Courbot acour...@nvidia.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/nouveau/Kconfig | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig
index 5ab13e7..f7e275a6 100644
--- a/drivers/gpu/drm/nouveau/Kconfig
+++ b/drivers/gpu/drm/nouveau/Kconfig
@@ -1,15 +1,10 @@
 config DRM_NOUVEAU
tristate Nouveau (NVIDIA) cards
depends on DRM  PCI
+   depends on DRM_FBDEV_EMULATION
 select FW_LOADER
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
select DRM_TTM
-   select FB_CFB_FILLRECT
-   select FB_CFB_COPYAREA
-   select FB_CFB_IMAGEBLIT
-   select FB
-   select FRAMEBUFFER_CONSOLE if !EXPERT
select FB_BACKLIGHT if DRM_NOUVEAU_BACKLIGHT
select ACPI_VIDEO if ACPI  X86  BACKLIGHT_CLASS_DEVICE  INPUT
select X86_PLATFORM_DEVICES if ACPI  X86
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 03/21] drm/armada: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc: Russell King rmk+ker...@arm.linux.org.uk

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/armada/Kconfig | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/armada/Kconfig b/drivers/gpu/drm/armada/Kconfig
index 50ae88a..c31454d 100644
--- a/drivers/gpu/drm/armada/Kconfig
+++ b/drivers/gpu/drm/armada/Kconfig
@@ -1,11 +1,7 @@
 config DRM_ARMADA
tristate DRM support for Marvell Armada SoCs
depends on DRM  HAVE_CLK  ARM
-   select FB_CFB_FILLRECT
-   select FB_CFB_COPYAREA
-   select FB_CFB_IMAGEBLIT
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
help
  Support the LCD controllers found on the Marvell Armada 510
  devices.  There are two controllers on the device, each controller
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 06/21] drm/exynos: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc: Inki Dae inki@samsung.com
Cc: Joonyoung Shim jy0922.s...@samsung.com
Cc: Seung-Woo Kim sw0312@samsung.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/exynos/Kconfig | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
index 43003c4..d253007 100644
--- a/drivers/gpu/drm/exynos/Kconfig
+++ b/drivers/gpu/drm/exynos/Kconfig
@@ -2,10 +2,6 @@ config DRM_EXYNOS
tristate DRM Support for Samsung SoC EXYNOS Series
depends on OF  DRM  (PLAT_SAMSUNG || ARCH_MULTIPLATFORM)
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
-   select FB_CFB_FILLRECT
-   select FB_CFB_COPYAREA
-   select FB_CFB_IMAGEBLIT
select VIDEOMODE_HELPERS
help
  Choose this option if you have a Samsung SoC EXYNOS chipset.
@@ -19,7 +15,6 @@ config DRM_EXYNOS_IOMMU
 config DRM_EXYNOS_FIMD
bool Exynos DRM FIMD
depends on DRM_EXYNOS  !FB_S3C
-   select FB_MODE_HELPERS
select MFD_SYSCON
help
  Choose this option if you want to use Exynos FIMD for DRM.
@@ -33,7 +28,6 @@ config DRM_EXYNOS5433_DECON
 config DRM_EXYNOS7_DECON
bool Exynos7 DRM DECON
depends on DRM_EXYNOS  !FB_S3C
-   select FB_MODE_HELPERS
help
  Choose this option if you want to use Exynos DECON for DRM.
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 13/21] drm/bochs: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc: David Airlie airl...@linux.ie
Cc: Gerd Hoffmann kra...@redhat.com
Cc: Daniel Vetter daniel.vet...@ffwll.ch

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/bochs/Kconfig | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/bochs/Kconfig b/drivers/gpu/drm/bochs/Kconfig
index 5f8b0c2..f739763 100644
--- a/drivers/gpu/drm/bochs/Kconfig
+++ b/drivers/gpu/drm/bochs/Kconfig
@@ -2,10 +2,6 @@ config DRM_BOCHS
tristate DRM Support for bochs dispi vga interface (qemu stdvga)
depends on DRM  PCI
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
-   select FB_SYS_FILLRECT
-   select FB_SYS_COPYAREA
-   select FB_SYS_IMAGEBLIT
select DRM_TTM
help
  Choose this option for qemu.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 21/21] drm/tilcdc: Remove FB_KMS_HELPER config option

2015-07-13 Thread Archit Taneja
The driver internally uses drm_fb_cma helpers to emulate fbdev and
allocate buffers. It doesn't need to select DRM_FB_KMS_HELPER. This
will be managed by the config option DRM_KMS_CMA_HELPER.

Cc: Ezequiel Garcia ezequ...@vanguardiasur.com.ar
Cc: Tomi Valkeinen tomi.valkei...@ti.com
Cc: Jyri Sarha jsa...@ti.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/tilcdc/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/Kconfig b/drivers/gpu/drm/tilcdc/Kconfig
index 78beafb..72e7944 100644
--- a/drivers/gpu/drm/tilcdc/Kconfig
+++ b/drivers/gpu/drm/tilcdc/Kconfig
@@ -2,7 +2,6 @@ config DRM_TILCDC
tristate DRM Support for TI LCDC Display Controller
depends on DRM  OF  ARM  HAVE_DMA_ATTRS
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
select DRM_KMS_CMA_HELPER
select DRM_GEM_CMA_HELPER
select VIDEOMODE_HELPERS
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 12/21] drm/udl: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

The code relying on DEFERRED_IO can't be stubbed out using drm_fb_helper
functions. This is because the deferred io members in fbdev core structs
are defined based on whether FB_DEFERRED_IO is defined or not.

For now, wrap around deferred io code with an #ifdef check for
CONFIG_DEFERRED_IO. We could consider creating stub fb helper functions
here, but this would require some changes in the core fbdev structs.

Cc: David Airlie airl...@linux.ie
Cc: Haixia Shi h...@chromium.org
Cc: Stéphane Marchesin marc...@chromium.org

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/udl/Kconfig  |  5 -
 drivers/gpu/drm/udl/udl_fb.c | 10 ++
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/udl/Kconfig b/drivers/gpu/drm/udl/Kconfig
index 613ab06..1616ec4 100644
--- a/drivers/gpu/drm/udl/Kconfig
+++ b/drivers/gpu/drm/udl/Kconfig
@@ -4,12 +4,7 @@ config DRM_UDL
depends on USB_SUPPORT
depends on USB_ARCH_HAS_HCD
select USB
-   select FB_SYS_FILLRECT
-   select FB_SYS_COPYAREA
-   select FB_SYS_IMAGEBLIT
-   select FB_DEFERRED_IO
select DRM_KMS_HELPER
-select DRM_KMS_FB_HELPER
help
  This is a KMS driver for the USB displaylink video adapters.
   Say M/Y to add support for these devices via drm/kms interfaces.
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
index 9fd6e83..4aa5118d 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -24,11 +24,15 @@
 
 #define DL_DEFIO_WRITE_DELAY(HZ/20) /* fb_deferred_io.delay in jiffies */
 
+#ifdef CONFIG_FB_DEFERRED_IO
 static int fb_defio = 0;  /* Optionally enable experimental fb_defio mmap 
support */
+#endif
 static int fb_bpp = 16;
 
 module_param(fb_bpp, int, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP);
+#ifdef CONFIG_FB_DEFERRED_IO
 module_param(fb_defio, int, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP);
+#endif
 
 struct udl_fbdev {
struct drm_fb_helper helper;
@@ -78,6 +82,7 @@ static uint16_t rgb16(uint32_t col)
 }
 #endif
 
+#ifdef CONFIG_FB_DEFERRED_IO
 /*
  * NOTE: fb_defio.c is holding info-fbdefio.mutex
  *   Touching ANY framebuffer memory that triggers a page fault
@@ -139,6 +144,7 @@ error:
 10)), /* Kcycles */
   udl-cpu_kcycles_used);
 }
+#endif
 
 int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
  int width, int height)
@@ -331,6 +337,7 @@ static int udl_fb_open(struct fb_info *info, int user)
 
ufbdev-fb_count++;
 
+#ifdef CONFIG_FB_DEFERRED_IO
if (fb_defio  (info-fbdefio == NULL)) {
/* enable defio at last moment if not disabled by client */
 
@@ -346,6 +353,7 @@ static int udl_fb_open(struct fb_info *info, int user)
info-fbdefio = fbdefio;
fb_deferred_io_init(info);
}
+#endif
 
pr_notice(open /dev/fb%d user=%d fb_info=%p count=%d\n,
  info-node, user, info, ufbdev-fb_count);
@@ -363,12 +371,14 @@ static int udl_fb_release(struct fb_info *info, int user)
 
ufbdev-fb_count--;
 
+#ifdef CONFIG_FB_DEFERRED_IO
if ((ufbdev-fb_count == 0)  (info-fbdefio)) {
fb_deferred_io_cleanup(info);
kfree(info-fbdefio);
info-fbdefio = NULL;
info-fbops-fb_mmap = udl_fb_mmap;
}
+#endif
 
pr_warn(released /dev/fb%d user=%d count=%d\n,
info-node, user, ufbdev-fb_count);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 17/21] drm/atmel-hlcdc: Remove FB_KMS_HELPER config option

2015-07-13 Thread Archit Taneja
The driver internally uses drm_fb_cma helpers to emulate fbdev and
allocate buffers. It doesn't need to select DRM_FB_KMS_HELPER. This
will be managed by the config option DRM_KMS_CMA_HELPER.

Cc: Boris Brezillon boris.brezil...@free-electrons.com
Cc: Sylvain Rochet sylvain.roc...@finsecur.com
Cc: Nicolas Ferre nicolas.fe...@atmel.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/atmel-hlcdc/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/Kconfig 
b/drivers/gpu/drm/atmel-hlcdc/Kconfig
index 99b4f06..32bcc4b 100644
--- a/drivers/gpu/drm/atmel-hlcdc/Kconfig
+++ b/drivers/gpu/drm/atmel-hlcdc/Kconfig
@@ -3,7 +3,6 @@ config DRM_ATMEL_HLCDC
depends on DRM  OF  COMMON_CLK  MFD_ATMEL_HLCDC  ARM
select DRM_GEM_CMA_HELPER
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
select DRM_KMS_CMA_HELPER
select DRM_PANEL
help
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 18/21] drm/imx: Remove FB_KMS_HELPER config option

2015-07-13 Thread Archit Taneja
The driver internally uses drm_fb_cma helpers to emulate fbdev and
allocate buffers. It doesn't need to select DRM_FB_KMS_HELPER. This
will be managed by the config option DRM_KMS_CMA_HELPER.

Cc: Philipp Zabel p.za...@pengutronix.de

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/imx/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/Kconfig b/drivers/gpu/drm/imx/Kconfig
index 35ca4f0..33ae36d 100644
--- a/drivers/gpu/drm/imx/Kconfig
+++ b/drivers/gpu/drm/imx/Kconfig
@@ -1,7 +1,6 @@
 config DRM_IMX
tristate DRM Support for Freescale i.MX
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
select VIDEOMODE_HELPERS
select DRM_GEM_CMA_HELPER
select DRM_KMS_CMA_HELPER
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 19/21] drm/rcar-du: Remove FB_KMS_HELPER config option

2015-07-13 Thread Archit Taneja
The driver internally uses drm_fb_cma helpers to emulate fbdev and
allocate buffers. It doesn't need to select DRM_FB_KMS_HELPER. This
will be managed by the config option DRM_KMS_CMA_HELPER.

Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/rcar-du/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig
index 11485a4..9de5872 100644
--- a/drivers/gpu/drm/rcar-du/Kconfig
+++ b/drivers/gpu/drm/rcar-du/Kconfig
@@ -5,7 +5,6 @@ config DRM_RCAR_DU
select DRM_KMS_HELPER
select DRM_KMS_CMA_HELPER
select DRM_GEM_CMA_HELPER
-   select DRM_KMS_FB_HELPER
select VIDEOMODE_HELPERS
help
  Choose this option if you have an R-Car chipset.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 14/21] drm/amdgpu: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc: Alex Deucher alexander.deuc...@amd.com
Cc: Oded Gabbay oded.gab...@gmail.com
Cc: Christian König christian.koe...@amd.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/amd/amdgpu/Kconfig | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/Kconfig 
b/drivers/gpu/drm/amd/amdgpu/Kconfig
index da7dcbf..2396482 100644
--- a/drivers/gpu/drm/amd/amdgpu/Kconfig
+++ b/drivers/gpu/drm/amd/amdgpu/Kconfig
@@ -1,12 +1,8 @@
 config DRM_AMDGPU
tristate AMD GPU
depends on DRM  PCI
-   select FB_CFB_FILLRECT
-   select FB_CFB_COPYAREA
-   select FB_CFB_IMAGEBLIT
select FW_LOADER
 select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
 select DRM_TTM
select POWER_SUPPLY
select HWMON
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 16/21] drm/fb_cma_helper: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the helper doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc: Lars-Peter Clausen l...@metafoo.de
Cc: Daniel Vetter daniel.vet...@ffwll.ch

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/Kconfig | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 8fd670b..3e540e3 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -89,10 +89,6 @@ config DRM_KMS_CMA_HELPER
bool
depends on DRM  HAVE_DMA_ATTRS
select DRM_GEM_CMA_HELPER
-   select DRM_KMS_FB_HELPER
-   select FB_SYS_FILLRECT
-   select FB_SYS_COPYAREA
-   select FB_SYS_IMAGEBLIT
help
  Choose this if you need the KMS CMA helper functions
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 20/21] drm/shmobile: Remove FB_KMS_HELPER config option

2015-07-13 Thread Archit Taneja
The driver internally uses drm_fb_cma helpers to emulate fbdev and
allocate buffers. It doesn't need to select DRM_FB_KMS_HELPER. This
will be managed by the config option DRM_KMS_CMA_HELPER.

Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/shmobile/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/shmobile/Kconfig b/drivers/gpu/drm/shmobile/Kconfig
index b9202aa..389b5f9 100644
--- a/drivers/gpu/drm/shmobile/Kconfig
+++ b/drivers/gpu/drm/shmobile/Kconfig
@@ -6,7 +6,6 @@ config DRM_SHMOBILE
select BACKLIGHT_CLASS_DEVICE
select BACKLIGHT_LCD_SUPPORT
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
select DRM_KMS_CMA_HELPER
select DRM_GEM_CMA_HELPER
help
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 15/21] drm/virtio: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc: David Airlie airl...@linux.ie
Cc: Gerd Hoffmann kra...@redhat.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/virtio/Kconfig | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
index 9983ead..e1afc3d 100644
--- a/drivers/gpu/drm/virtio/Kconfig
+++ b/drivers/gpu/drm/virtio/Kconfig
@@ -1,11 +1,7 @@
 config DRM_VIRTIO_GPU
tristate Virtio GPU driver
depends on DRM  VIRTIO
-   select FB_SYS_FILLRECT
-   select FB_SYS_COPYAREA
-   select FB_SYS_IMAGEBLIT
 select DRM_KMS_HELPER
-select DRM_KMS_FB_HELPER
 select DRM_TTM
help
   This is the virtual GPU driver for virtio.  It can be used with
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 02/10] drm/r128: clean up: create a separate Kconfig file

2015-07-13 Thread Archit Taneja
Remove the DRM_R128 config option from the top level drm Kconfig file
and create a new Kconfig file within the driver folder.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/Kconfig  | 9 +
 drivers/gpu/drm/r128/Kconfig | 8 
 2 files changed, 9 insertions(+), 8 deletions(-)
 create mode 100644 drivers/gpu/drm/r128/Kconfig

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 3f3328b..fc9d65d 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -83,14 +83,7 @@ source drivers/gpu/drm/bridge/Kconfig
 
 source drivers/gpu/drm/tdfx/Kconfig
 
-config DRM_R128
-   tristate ATI Rage 128
-   depends on DRM  PCI
-   select FW_LOADER
-   help
- Choose this option if you have an ATI Rage 128 graphics card.  If M
- is selected, the module will be called r128.  AGP support for
- this card is strongly suggested (unless you have a PCI version).
+source drivers/gpu/drm/r128/Kconfig
 
 config DRM_RADEON
tristate ATI Radeon
diff --git a/drivers/gpu/drm/r128/Kconfig b/drivers/gpu/drm/r128/Kconfig
new file mode 100644
index 000..3c1ae88
--- /dev/null
+++ b/drivers/gpu/drm/r128/Kconfig
@@ -0,0 +1,8 @@
+config DRM_R128
+   tristate ATI Rage 128
+   depends on DRM  PCI
+   select FW_LOADER
+   help
+ Choose this option if you have an ATI Rage 128 graphics card.  If M
+ is selected, the module will be called r128.  AGP support for
+ this card is strongly suggested (unless you have a PCI version).
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 01/10] drm/tdfx: clean up: create a separate Kconfig file

2015-07-13 Thread Archit Taneja
Remove the DRM_TDFX from the top level drm Kconfig file and create
a new Kconfig file within the driver folder.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/Kconfig  | 7 +--
 drivers/gpu/drm/tdfx/Kconfig | 6 ++
 2 files changed, 7 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/tdfx/Kconfig

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index c46ca31..3f3328b 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -81,12 +81,7 @@ source drivers/gpu/drm/i2c/Kconfig
 
 source drivers/gpu/drm/bridge/Kconfig
 
-config DRM_TDFX
-   tristate 3dfx Banshee/Voodoo3+
-   depends on DRM  PCI
-   help
- Choose this option if you have a 3dfx Banshee or Voodoo3 (or later),
- graphics card.  If M is selected, the module will be called tdfx.
+source drivers/gpu/drm/tdfx/Kconfig
 
 config DRM_R128
tristate ATI Rage 128
diff --git a/drivers/gpu/drm/tdfx/Kconfig b/drivers/gpu/drm/tdfx/Kconfig
new file mode 100644
index 000..a9e26ad
--- /dev/null
+++ b/drivers/gpu/drm/tdfx/Kconfig
@@ -0,0 +1,6 @@
+config DRM_TDFX
+   tristate 3dfx Banshee/Voodoo3+
+   depends on DRM  PCI
+   help
+ Choose this option if you have a 3dfx Banshee or Voodoo3 (or later),
+ graphics card.  If M is selected, the module will be called tdfx.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 03/10] drm/radeon: clean up: move config option to driver's own Kconfig file

2015-07-13 Thread Archit Taneja
Remove the DRM_RADEON config option from the top level drm Kconfig file
and move it to the Kconfig file within the driver folder.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/Kconfig| 21 -
 drivers/gpu/drm/radeon/Kconfig | 21 +
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index fc9d65d..f19d894 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -85,27 +85,6 @@ source drivers/gpu/drm/tdfx/Kconfig
 
 source drivers/gpu/drm/r128/Kconfig
 
-config DRM_RADEON
-   tristate ATI Radeon
-   depends on DRM  PCI
-   select FB_CFB_FILLRECT
-   select FB_CFB_COPYAREA
-   select FB_CFB_IMAGEBLIT
-   select FW_LOADER
-select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
-select DRM_TTM
-   select POWER_SUPPLY
-   select HWMON
-   select BACKLIGHT_CLASS_DEVICE
-   select INTERVAL_TREE
-   help
- Choose this option if you have an ATI Radeon graphics card.  There
- are both PCI and AGP versions.  You don't need to choose this to
- run the Radeon in plain VGA mode.
-
- If M is selected, the module will be called radeon.
-
 source drivers/gpu/drm/radeon/Kconfig
 
 config DRM_AMDGPU
diff --git a/drivers/gpu/drm/radeon/Kconfig b/drivers/gpu/drm/radeon/Kconfig
index 421ae13..82c623b 100644
--- a/drivers/gpu/drm/radeon/Kconfig
+++ b/drivers/gpu/drm/radeon/Kconfig
@@ -1,3 +1,24 @@
+config DRM_RADEON
+   tristate ATI Radeon
+   depends on DRM  PCI
+   select FB_CFB_FILLRECT
+   select FB_CFB_COPYAREA
+   select FB_CFB_IMAGEBLIT
+   select FW_LOADER
+select DRM_KMS_HELPER
+   select DRM_KMS_FB_HELPER
+select DRM_TTM
+   select POWER_SUPPLY
+   select HWMON
+   select BACKLIGHT_CLASS_DEVICE
+   select INTERVAL_TREE
+   help
+ Choose this option if you have an ATI Radeon graphics card.  There
+ are both PCI and AGP versions.  You don't need to choose this to
+ run the Radeon in plain VGA mode.
+
+ If M is selected, the module will be called radeon.
+
 config DRM_RADEON_USERPTR
bool Always enable userptr support
depends on DRM_RADEON
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 10/10] drm/misc: clean up: group device specific Kconfigs

2015-07-13 Thread Archit Taneja
Move the VGEM Kconfig option along with other DRM Kconfig options.
Add a comment saying that the device specific Kconfig options start
from here.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/Kconfig | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index f026ed8..a66ac44 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -77,6 +77,16 @@ config DRM_KMS_CMA_HELPER
help
  Choose this if you need the KMS CMA helper functions
 
+config DRM_VGEM
+   tristate Virtual GEM provider
+   depends on DRM
+   help
+ Choose this option to get a virtual graphics memory manager,
+ as used by Mesa's software renderer for enhanced performance.
+ If M is selected the module will be called vgem.
+
+#device specific Kconfigs
+
 source drivers/gpu/drm/i2c/Kconfig
 
 source drivers/gpu/drm/bridge/Kconfig
@@ -101,14 +111,6 @@ source drivers/gpu/drm/sis/Kconfig
 
 source drivers/gpu/drm/via/Kconfig
 
-config DRM_VGEM
-   tristate Virtual GEM provider
-   depends on DRM
-   help
- Choose this option to get a virtual graphics memory manager,
- as used by Mesa's software renderer for enhanced performance.
- If M is selected the module will be called vgem.
-
 source drivers/gpu/drm/savage/Kconfig
 
 source drivers/gpu/drm/exynos/Kconfig
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 04/10] drm/amdgpu: clean up: move config option to driver's own Kconfig file

2015-07-13 Thread Archit Taneja
Remove the DRM_AMDGPU config option from the top level drm Kconfig file
and move to Kconfig file within the driver folder.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/Kconfig| 19 ---
 drivers/gpu/drm/amd/amdgpu/Kconfig | 19 +++
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index f19d894..5641a9a 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -87,25 +87,6 @@ source drivers/gpu/drm/r128/Kconfig
 
 source drivers/gpu/drm/radeon/Kconfig
 
-config DRM_AMDGPU
-   tristate AMD GPU
-   depends on DRM  PCI
-   select FB_CFB_FILLRECT
-   select FB_CFB_COPYAREA
-   select FB_CFB_IMAGEBLIT
-   select FW_LOADER
-select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
-select DRM_TTM
-   select POWER_SUPPLY
-   select HWMON
-   select BACKLIGHT_CLASS_DEVICE
-   select INTERVAL_TREE
-   help
- Choose this option if you have a recent AMD Radeon graphics card.
-
- If M is selected, the module will be called amdgpu.
-
 source drivers/gpu/drm/amd/amdgpu/Kconfig
 
 source drivers/gpu/drm/nouveau/Kconfig
diff --git a/drivers/gpu/drm/amd/amdgpu/Kconfig 
b/drivers/gpu/drm/amd/amdgpu/Kconfig
index b30fcfa..da7dcbf 100644
--- a/drivers/gpu/drm/amd/amdgpu/Kconfig
+++ b/drivers/gpu/drm/amd/amdgpu/Kconfig
@@ -1,3 +1,22 @@
+config DRM_AMDGPU
+   tristate AMD GPU
+   depends on DRM  PCI
+   select FB_CFB_FILLRECT
+   select FB_CFB_COPYAREA
+   select FB_CFB_IMAGEBLIT
+   select FW_LOADER
+select DRM_KMS_HELPER
+   select DRM_KMS_FB_HELPER
+select DRM_TTM
+   select POWER_SUPPLY
+   select HWMON
+   select BACKLIGHT_CLASS_DEVICE
+   select INTERVAL_TREE
+   help
+ Choose this option if you have a recent AMD Radeon graphics card.
+
+ If M is selected, the module will be called amdgpu.
+
 config DRM_AMDGPU_CIK
bool Enable amdgpu support for CIK parts
depends on DRM_AMDGPU
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 00/10] drm/misc: Kconfig cleanup

2015-07-13 Thread Archit Taneja
The top level drm Kconfig is a bit messy at the moment. Most of the drm
drivers have their own Kconfig files, but a few have their Kconfig files
in the top level Kconfig option itself.

Create new Kconfig files for drivers that don't have one. This cleans up
the Kconfig quite a bit

Archit Taneja (10):
  drm/tdfx: clean up: create a separate Kconfig file
  drm/r128: clean up: create a separate Kconfig file
  drm/radeon: clean up: move config option to driver's own Kconfig file
  drm/amdgpu: clean up: move config option to driver's own Kconfig file
  drm/i810: clean up: create a separate Kconfig file
  drm/mga: clean up: create a separate Kconfig file
  drm/sis: clean up: create a separate Kconfig file
  drm/via: clean up: create a separate Kconfig file
  drm/savage: clean up: create a separate Kconfig file
  drm/misc: clean up: group device specific Kconfigs

 drivers/gpu/drm/Kconfig| 116 ++---
 drivers/gpu/drm/amd/amdgpu/Kconfig |  19 ++
 drivers/gpu/drm/i810/Kconfig   |   8 +++
 drivers/gpu/drm/mga/Kconfig|   8 +++
 drivers/gpu/drm/r128/Kconfig   |   8 +++
 drivers/gpu/drm/radeon/Kconfig |  21 +++
 drivers/gpu/drm/savage/Kconfig |   7 +++
 drivers/gpu/drm/sis/Kconfig|   8 +++
 drivers/gpu/drm/tdfx/Kconfig   |   6 ++
 drivers/gpu/drm/via/Kconfig|   6 ++
 10 files changed, 108 insertions(+), 99 deletions(-)
 create mode 100644 drivers/gpu/drm/i810/Kconfig
 create mode 100644 drivers/gpu/drm/mga/Kconfig
 create mode 100644 drivers/gpu/drm/r128/Kconfig
 create mode 100644 drivers/gpu/drm/savage/Kconfig
 create mode 100644 drivers/gpu/drm/sis/Kconfig
 create mode 100644 drivers/gpu/drm/tdfx/Kconfig
 create mode 100644 drivers/gpu/drm/via/Kconfig

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 02/25] drm/fb_helper: Create a wrapper for unlink_framebuffer

2015-07-13 Thread Archit Taneja
Some drm drivers call unlink_framebuffer. Create a drm_fb_helper function
that wraps around these calls.

This is part of an effort to prevent drm drivers from calling fbdev
functions directly, in order to make fbdev emulation a top level drm
option.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/drm_fb_helper.c | 7 +++
 include/drm/drm_fb_helper.h | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 78859ad..742377d 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -737,6 +737,13 @@ void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
 }
 EXPORT_SYMBOL(drm_fb_helper_fini);
 
+void drm_fb_helper_unlink_fbi(struct drm_fb_helper *fb_helper)
+{
+   if (fb_helper-fbdev)
+   unlink_framebuffer(fb_helper-fbdev);
+}
+EXPORT_SYMBOL(drm_fb_helper_unlink_fbi);
+
 static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
 u16 blue, u16 regno, struct fb_info *info)
 {
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 2ee4ec5..4c90837 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -145,6 +145,8 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct 
drm_fb_helper *fb_helpe
 void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
uint32_t depth);
 
+void drm_fb_helper_unlink_fbi(struct drm_fb_helper *fb_helper);
+
 int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
 
 int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 01/25] drm/fb_helper: Add drm_fb_helper functions to manage fb_info creation

2015-07-13 Thread Archit Taneja
Every drm driver calls framebuffer_alloc, fb_alloc_cmap,
unregister_framebuffer, fb_dealloc_cmap and framebuffer_release in
order to emulate fbdev support.

Create drm_fb_helper functions that perform the above operations.

This is part of an effort to prevent drm drivers from calling fbdev
functions directly. It also removes repetitive code from drivers.

There are some drivers that call alloc_apertures after framebuffer_alloc
and some that don't. Make the helper always call alloc_apertures. This
would make certain drivers allocate memory for apertures but not use
them. Since it's a small amount of memory, it shouldn't be an issue.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/drm_fb_helper.c | 53 +
 include/drm/drm_fb_helper.h |  4 
 2 files changed, 57 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index cac4229..78859ad 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -667,6 +667,59 @@ out_free:
 }
 EXPORT_SYMBOL(drm_fb_helper_init);
 
+struct fb_info *drm_fb_helper_alloc_fbi(struct drm_fb_helper *fb_helper)
+{
+   struct device *dev = fb_helper-dev-dev;
+   struct fb_info *info;
+   int ret;
+
+   info = framebuffer_alloc(0, dev);
+   if (!info)
+   return ERR_PTR(-ENOMEM);
+
+   ret = fb_alloc_cmap(info-cmap, 256, 0);
+   if (ret)
+   goto err_release;
+
+   info-apertures = alloc_apertures(1);
+   if (!info-apertures) {
+   ret = -ENOMEM;
+   goto err_free_cmap;
+   }
+
+   fb_helper-fbdev = info;
+
+   return info;
+
+err_free_cmap:
+   fb_dealloc_cmap(info-cmap);
+err_release:
+   framebuffer_release(info);
+   return ERR_PTR(ret);
+}
+EXPORT_SYMBOL(drm_fb_helper_alloc_fbi);
+
+void drm_fb_helper_unregister_fbi(struct drm_fb_helper *fb_helper)
+{
+   if (fb_helper-fbdev)
+   unregister_framebuffer(fb_helper-fbdev);
+}
+EXPORT_SYMBOL(drm_fb_helper_unregister_fbi);
+
+void drm_fb_helper_release_fbi(struct drm_fb_helper *fb_helper)
+{
+   struct fb_info *info = fb_helper-fbdev;
+
+   if (info) {
+   if (info-cmap.len)
+   fb_dealloc_cmap(info-cmap);
+   framebuffer_release(info);
+   }
+
+   fb_helper-fbdev = NULL;
+}
+EXPORT_SYMBOL(drm_fb_helper_release_fbi);
+
 void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
 {
if (!list_empty(fb_helper-kernel_fb_list)) {
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 0dfd94def..2ee4ec5 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -136,6 +136,10 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
struct fb_info *info);
 
 bool drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper 
*fb_helper);
+
+struct fb_info *drm_fb_helper_alloc_fbi(struct drm_fb_helper *fb_helper);
+void drm_fb_helper_unregister_fbi(struct drm_fb_helper *fb_helper);
+void drm_fb_helper_release_fbi(struct drm_fb_helper *fb_helper);
 void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper 
*fb_helper,
uint32_t fb_width, uint32_t fb_height);
 void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 00/25] drm: fb emulation: Step 1: Create new drm_fb_helper wrapper funcs

2015-07-13 Thread Archit Taneja
DRM drivers using drm_fb_helpers still call some fbdev core functions.
This makes the driver depend on CONFIG_FB, resulting in complicated
Kconfig options, and preventing us from creating a top level drm config
option to enable/disable FBDEV emulation.

Create new drm_fb_helper functions that replace these fbdev functions.

In most cases, the new helper funcs simply wrap around the original fbdev
functions. For a few (like framebufer_alloc), we actually do some work
that is currently redundant across multiple drivers.

With these patches, the drivers don't call any fbdev functions directly.
They are now called through functions in drm_fb_helper.c. We will later
create a fbdev emulation config option to stub out the fb helpers.

The only exception is vmwgfx driver. This doesn't use drm_fb_helper. It
creates a fb device how a driver in drivers/video/fbdev would. Maybe this
needs to be converted to use drm_fb_helpers.

For more info, have a look at the threads:
http://lists.freedesktop.org/archives/dri-devel/2015-March/078729.html
http://lists.freedesktop.org/archives/dri-devel/2015-March/078975.html

Archit Taneja (25):
  drm/fb_helper: Add drm_fb_helper functions to manage fb_info creation
  drm/fb_helper: Create a wrapper for unlink_framebuffer
  drm/fb_helper: Create wrappers for fb_sys_read/write funcs
  drm/fb_helper: Create wrappers for blit, copyarea and fillrect funcs
  drm/fb_helper: Create a wrapper for fb_set_suspend
  drm/fb_helper: Create a wrapper for remove_conflicting_framebuffers
  drm/cirrus: Use new drm_fb_helper functions
  drm/rockchip: Use new drm_fb_helper functions
  drm/armada: Use new drm_fb_helper functions
  drm/ast: Use new drm_fb_helper functions
  drm/omap: Use new drm_fb_helper functions
  drm/tegra: Use new drm_fb_helper functions
  drm/msm: Use new drm_fb_helper functions
  drm/exynos: Use new drm_fb_helper functions
  drm/gma500: Use new drm_fb_helper functions
  drm/mgag200: Use new drm_fb_helper functions
  drm/radeon: Use new drm_fb_helper functions
  drm/qxl: Use new drm_fb_helper functions
  drm/i915: Use new drm_fb_helper functions
  drm/nouveau: Use new drm_fb_helper functions
  drm/udl: Use new drm_fb_helper functions
  drm/boschs: Use new drm_fb_helper functions
  drm/amdgpu: Use new drm_fb_helper functions
  drm/virtio: Use new drm_fb_helper functions
  drm/fb_cma_helper: Use new drm_fb_helper functions

 drivers/gpu/drm/Kconfig   |   7 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c|  43 +++-
 drivers/gpu/drm/armada/armada_fbdev.c |  33 ++
 drivers/gpu/drm/ast/ast_fb.c  |  47 +++--
 drivers/gpu/drm/bochs/bochs_drv.c |   6 +-
 drivers/gpu/drm/bochs/bochs_fbdev.c   |  34 ++
 drivers/gpu/drm/cirrus/cirrus_drv.c   |   7 +-
 drivers/gpu/drm/cirrus/cirrus_fbdev.c |  39 ++-
 drivers/gpu/drm/drm_fb_cma_helper.c   |  45 ++--
 drivers/gpu/drm/drm_fb_helper.c   | 142 ++
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c |  45 +++-
 drivers/gpu/drm/gma500/accel_2d.c |   6 +-
 drivers/gpu/drm/gma500/framebuffer.c  |  47 +++--
 drivers/gpu/drm/i915/i915_dma.c   |   3 +-
 drivers/gpu/drm/i915/intel_fbdev.c|  40 +++-
 drivers/gpu/drm/mgag200/mgag200_drv.c |   3 +-
 drivers/gpu/drm/mgag200/mgag200_fb.c  |  36 ++-
 drivers/gpu/drm/mgag200/mgag200_main.c|   2 +-
 drivers/gpu/drm/msm/msm_fbdev.c   |  34 ++
 drivers/gpu/drm/nouveau/nouveau_drm.c |   3 +-
 drivers/gpu/drm/nouveau/nouveau_fbcon.c   |  38 +++
 drivers/gpu/drm/omapdrm/omap_fbdev.c  |  34 ++
 drivers/gpu/drm/qxl/qxl_fb.c  |  40 +++-
 drivers/gpu/drm/radeon/radeon_drv.c   |   4 +-
 drivers/gpu/drm/radeon/radeon_fb.c|  41 +++-
 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c |  47 +++--
 drivers/gpu/drm/tegra/fb.c|  40 +++-
 drivers/gpu/drm/udl/udl_fb.c  |  40 +++-
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c  |   3 +-
 drivers/gpu/drm/virtio/virtgpu_fb.c   |  30 ++
 include/drm/drm_fb_helper.h   |  30 ++
 32 files changed, 426 insertions(+), 547 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 07/25] drm/cirrus: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly.

COMPILE TESTED ONLY.

Cc: Thierry Reding tred...@nvidia.com
Cc: Zach Reizner za...@google.com
Cc: Russell King rmk+ker...@arm.linux.org.uk
Cc: Fabian Frederick f...@skynet.be

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/cirrus/cirrus_drv.c   |  7 ---
 drivers/gpu/drm/cirrus/cirrus_fbdev.c | 39 +++
 2 files changed, 12 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c 
b/drivers/gpu/drm/cirrus/cirrus_drv.c
index b914003..08bd176 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -56,7 +56,8 @@ static int cirrus_kick_out_firmware_fb(struct pci_dev *pdev)
 #ifdef CONFIG_X86
primary = pdev-resource[PCI_ROM_RESOURCE].flags  
IORESOURCE_ROM_SHADOW;
 #endif
-   remove_conflicting_framebuffers(ap, cirrusdrmfb, primary);
+   drm_fb_helper_remove_conflicting_framebuffers(ap, cirrusdrmfb,
+   primary);
kfree(ap);
 
return 0;
@@ -92,7 +93,7 @@ static int cirrus_pm_suspend(struct device *dev)
 
if (cdev-mode_info.gfbdev) {
console_lock();
-   fb_set_suspend(cdev-mode_info.gfbdev-helper.fbdev, 1);
+   drm_fb_helper_set_suspend(cdev-mode_info.gfbdev-helper, 1);
console_unlock();
}
 
@@ -109,7 +110,7 @@ static int cirrus_pm_resume(struct device *dev)
 
if (cdev-mode_info.gfbdev) {
console_lock();
-   fb_set_suspend(cdev-mode_info.gfbdev-helper.fbdev, 0);
+   drm_fb_helper_set_suspend(cdev-mode_info.gfbdev-helper, 0);
console_unlock();
}
 
diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c 
b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
index 13ddf1c..9b5ea22 100644
--- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
+++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
@@ -98,7 +98,7 @@ static void cirrus_fillrect(struct fb_info *info,
 const struct fb_fillrect *rect)
 {
struct cirrus_fbdev *afbdev = info-par;
-   sys_fillrect(info, rect);
+   drm_fb_helper_sys_fillrect(info, rect);
cirrus_dirty_update(afbdev, rect-dx, rect-dy, rect-width,
 rect-height);
 }
@@ -107,7 +107,7 @@ static void cirrus_copyarea(struct fb_info *info,
 const struct fb_copyarea *area)
 {
struct cirrus_fbdev *afbdev = info-par;
-   sys_copyarea(info, area);
+   drm_fb_helper_sys_copyarea(info, area);
cirrus_dirty_update(afbdev, area-dx, area-dy, area-width,
 area-height);
 }
@@ -116,7 +116,7 @@ static void cirrus_imageblit(struct fb_info *info,
  const struct fb_image *image)
 {
struct cirrus_fbdev *afbdev = info-par;
-   sys_imageblit(info, image);
+   drm_fb_helper_sys_imageblit(info, image);
cirrus_dirty_update(afbdev, image-dx, image-dy, image-width,
 image-height);
 }
@@ -165,12 +165,10 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
 {
struct cirrus_fbdev *gfbdev =
container_of(helper, struct cirrus_fbdev, helper);
-   struct drm_device *dev = gfbdev-helper.dev;
struct cirrus_device *cdev = gfbdev-helper.dev-dev_private;
struct fb_info *info;
struct drm_framebuffer *fb;
struct drm_mode_fb_cmd2 mode_cmd;
-   struct device *device = dev-pdev-dev;
void *sysram;
struct drm_gem_object *gobj = NULL;
struct cirrus_bo *bo = NULL;
@@ -195,9 +193,9 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
if (!sysram)
return -ENOMEM;
 
-   info = framebuffer_alloc(0, device);
-   if (info == NULL)
-   return -ENOMEM;
+   info = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(info))
+   return PTR_ERR(info);
 
info-par = gfbdev;
 
@@ -216,11 +214,9 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
 
/* setup helper */
gfbdev-helper.fb = fb;
-   gfbdev-helper.fbdev = info;
 
strcpy(info-fix.id, cirrusdrmfb);
 
-
info-flags = FBINFO_DEFAULT;
info-fbops = cirrusfb_ops;
 
@@ -229,11 +225,6 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
   sizes-fb_height);
 
/* setup aperture base/size for vesafb takeover */
-   info-apertures = alloc_apertures(1);
-   if (!info-apertures) {
-   ret = -ENOMEM;
-   goto out_iounmap;
-   }
info-apertures-ranges[0].base = cdev-dev-mode_config.fb_base;
info-apertures-ranges[0].size = cdev-mc.vram_size;
 
@@ -246,13 +237,6 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
info-fix.mmio_start = 0;
info-fix.mmio_len = 0;
 
-   ret = fb_alloc_cmap(info-cmap, 256, 0

[PATCH 08/25] drm/rockchip: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

This is an effort to create a top level drm fbdev emulation option.

COMPILE TESTED ONLY.

Cc: Mark Yao mark@rock-chips.com
Cc: Daniel Vetter dan...@ffwll.ch
Cc: Rob Clark robdcl...@gmail.com
Cc: Daniel Kurtz djku...@chromium.org

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 47 +++
 1 file changed, 12 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
index 5b0dc0f..4de4292 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
@@ -37,9 +37,9 @@ static int rockchip_fbdev_mmap(struct fb_info *info,
 static struct fb_ops rockchip_drm_fbdev_ops = {
.owner  = THIS_MODULE,
.fb_mmap= rockchip_fbdev_mmap,
-   .fb_fillrect= cfb_fillrect,
-   .fb_copyarea= cfb_copyarea,
-   .fb_imageblit   = cfb_imageblit,
+   .fb_fillrect= drm_fb_helper_cfb_fillrect,
+   .fb_copyarea= drm_fb_helper_cfb_copyarea,
+   .fb_imageblit   = drm_fb_helper_cfb_imageblit,
.fb_check_var   = drm_fb_helper_check_var,
.fb_set_par = drm_fb_helper_set_par,
.fb_blank   = drm_fb_helper_blank,
@@ -77,10 +77,10 @@ static int rockchip_drm_fbdev_create(struct drm_fb_helper 
*helper,
 
private-fbdev_bo = rk_obj-base;
 
-   fbi = framebuffer_alloc(0, dev-dev);
-   if (!fbi) {
-   dev_err(dev-dev, Failed to allocate framebuffer info.\n);
-   ret = -ENOMEM;
+   fbi = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(fbi))
+   dev_err(dev-dev, Failed to create framebuffer info.\n);
+   ret = PTR_ERR(fbi);
goto err_rockchip_gem_free_object;
}
 
@@ -89,21 +89,13 @@ static int rockchip_drm_fbdev_create(struct drm_fb_helper 
*helper,
if (IS_ERR(helper-fb)) {
dev_err(dev-dev, Failed to allocate DRM framebuffer.\n);
ret = PTR_ERR(helper-fb);
-   goto err_framebuffer_release;
+   goto err_release_fbi;
}
 
-   helper-fbdev = fbi;
-
fbi-par = helper;
fbi-flags = FBINFO_FLAG_DEFAULT;
fbi-fbops = rockchip_drm_fbdev_ops;
 
-   ret = fb_alloc_cmap(fbi-cmap, 256, 0);
-   if (ret) {
-   dev_err(dev-dev, Failed to allocate color map.\n);
-   goto err_drm_framebuffer_unref;
-   }
-
fb = helper-fb;
drm_fb_helper_fill_fix(fbi, fb-pitches[0], fb-depth);
drm_fb_helper_fill_var(fbi, helper, sizes-fb_width, sizes-fb_height);
@@ -124,10 +116,8 @@ static int rockchip_drm_fbdev_create(struct drm_fb_helper 
*helper,
 
return 0;
 
-err_drm_framebuffer_unref:
-   drm_framebuffer_unreference(helper-fb);
-err_framebuffer_release:
-   framebuffer_release(fbi);
+err_release_fbi:
+   drm_fb_helper_release_fbi(helper);
 err_rockchip_gem_free_object:
rockchip_gem_free_object(rk_obj-base);
return ret;
@@ -190,21 +180,8 @@ void rockchip_drm_fbdev_fini(struct drm_device *dev)
 
helper = private-fbdev_helper;
 
-   if (helper-fbdev) {
-   struct fb_info *info;
-   int ret;
-
-   info = helper-fbdev;
-   ret = unregister_framebuffer(info);
-   if (ret  0)
-   DRM_DEBUG_KMS(failed unregister_framebuffer() - %d\n,
- ret);
-
-   if (info-cmap.len)
-   fb_dealloc_cmap(info-cmap);
-
-   framebuffer_release(info);
-   }
+   drm_fb_helper_unregister_fbi(helper);
+   drm_fb_helper_release_fbi(helper);
 
if (helper-fb)
drm_framebuffer_unreference(helper-fb);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 08/10] drm/via: clean up: create a separate Kconfig file

2015-07-13 Thread Archit Taneja
Remove the DRM_VIA config option from the top level drm Kconfig file
and create a new Kconfig file within the driver folder.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/Kconfig | 7 +--
 drivers/gpu/drm/via/Kconfig | 6 ++
 2 files changed, 7 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/via/Kconfig

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 4b178a3..de11dc2 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -99,12 +99,7 @@ source drivers/gpu/drm/mga/Kconfig
 
 source drivers/gpu/drm/sis/Kconfig
 
-config DRM_VIA
-   tristate Via unichrome video cards
-   depends on DRM  PCI
-   help
- Choose this option if you have a Via unichrome or compatible video
- chipset. If M is selected the module will be called via.
+source drivers/gpu/drm/via/Kconfig
 
 config DRM_SAVAGE
tristate Savage video cards
diff --git a/drivers/gpu/drm/via/Kconfig b/drivers/gpu/drm/via/Kconfig
new file mode 100644
index 000..3206167
--- /dev/null
+++ b/drivers/gpu/drm/via/Kconfig
@@ -0,0 +1,6 @@
+config DRM_VIA
+   tristate Via unichrome video cards
+   depends on DRM  PCI
+   help
+ Choose this option if you have a Via unichrome or compatible video
+ chipset. If M is selected the module will be called via.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 09/10] drm/savage: clean up: create a separate Kconfig file

2015-07-13 Thread Archit Taneja
Remove the DRM_SAVAGE config option from the top level drm Kconfig file
and create a new Kconfig file within the driver folder.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/Kconfig| 8 +---
 drivers/gpu/drm/savage/Kconfig | 7 +++
 2 files changed, 8 insertions(+), 7 deletions(-)
 create mode 100644 drivers/gpu/drm/savage/Kconfig

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index de11dc2..f026ed8 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -101,13 +101,6 @@ source drivers/gpu/drm/sis/Kconfig
 
 source drivers/gpu/drm/via/Kconfig
 
-config DRM_SAVAGE
-   tristate Savage video cards
-   depends on DRM  PCI
-   help
- Choose this option if you have a Savage3D/4/SuperSavage/Pro/Twister
- chipset. If M is selected the module will be called savage.
-
 config DRM_VGEM
tristate Virtual GEM provider
depends on DRM
@@ -116,6 +109,7 @@ config DRM_VGEM
  as used by Mesa's software renderer for enhanced performance.
  If M is selected the module will be called vgem.
 
+source drivers/gpu/drm/savage/Kconfig
 
 source drivers/gpu/drm/exynos/Kconfig
 
diff --git a/drivers/gpu/drm/savage/Kconfig b/drivers/gpu/drm/savage/Kconfig
new file mode 100644
index 000..7e19b9a
--- /dev/null
+++ b/drivers/gpu/drm/savage/Kconfig
@@ -0,0 +1,7 @@
+config DRM_SAVAGE
+   tristate Savage video cards
+   depends on DRM  PCI
+   help
+ Choose this option if you have a Savage3D/4/SuperSavage/Pro/Twister
+ chipset. If M is selected the module will be called savage.
+
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 06/10] drm/mga: clean up: create a separate Kconfig file

2015-07-13 Thread Archit Taneja
Remove the DRM_MGA config option from the top level drm Kconfig file
and create a new Kconfig file within the driver folder.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/Kconfig | 9 +
 drivers/gpu/drm/mga/Kconfig | 8 
 2 files changed, 9 insertions(+), 8 deletions(-)
 create mode 100644 drivers/gpu/drm/mga/Kconfig

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index b7e694c..198cb75 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -95,14 +95,7 @@ source drivers/gpu/drm/i810/Kconfig
 
 source drivers/gpu/drm/i915/Kconfig
 
-config DRM_MGA
-   tristate Matrox g200/g400
-   depends on DRM  PCI
-   select FW_LOADER
-   help
- Choose this option if you have a Matrox G200, G400 or G450 graphics
- card.  If M is selected, the module will be called mga.  AGP
- support is required for this driver to work.
+source drivers/gpu/drm/mga/Kconfig
 
 config DRM_SIS
tristate SiS video cards
diff --git a/drivers/gpu/drm/mga/Kconfig b/drivers/gpu/drm/mga/Kconfig
new file mode 100644
index 000..b8d143b
--- /dev/null
+++ b/drivers/gpu/drm/mga/Kconfig
@@ -0,0 +1,8 @@
+config DRM_MGA
+   tristate Matrox g200/g400
+   depends on DRM  PCI
+   select FW_LOADER
+   help
+ Choose this option if you have a Matrox G200, G400 or G450 graphics
+ card.  If M is selected, the module will be called mga.  AGP
+ support is required for this driver to work.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 05/10] drm/i810: clean up: create a separate Kconfig file

2015-07-13 Thread Archit Taneja
Remove the DRM_I810 config option from the top level drm Kconfig file
and create a new Kconfig file within the driver folder.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/Kconfig  | 9 +
 drivers/gpu/drm/i810/Kconfig | 8 
 2 files changed, 9 insertions(+), 8 deletions(-)
 create mode 100644 drivers/gpu/drm/i810/Kconfig

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 5641a9a..b7e694c 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -91,14 +91,7 @@ source drivers/gpu/drm/amd/amdgpu/Kconfig
 
 source drivers/gpu/drm/nouveau/Kconfig
 
-config DRM_I810
-   tristate Intel I810
-   # !PREEMPT because of missing ioctl locking
-   depends on DRM  AGP  AGP_INTEL  (!PREEMPT || BROKEN)
-   help
- Choose this option if you have an Intel I810 graphics card.  If M is
- selected, the module will be called i810.  AGP support is required
- for this driver to work.
+source drivers/gpu/drm/i810/Kconfig
 
 source drivers/gpu/drm/i915/Kconfig
 
diff --git a/drivers/gpu/drm/i810/Kconfig b/drivers/gpu/drm/i810/Kconfig
new file mode 100644
index 000..71ba73a
--- /dev/null
+++ b/drivers/gpu/drm/i810/Kconfig
@@ -0,0 +1,8 @@
+config DRM_I810
+   tristate Intel I810
+   # !PREEMPT because of missing ioctl locking
+   depends on DRM  AGP  AGP_INTEL  (!PREEMPT || BROKEN)
+   help
+ Choose this option if you have an Intel I810 graphics card.  If M is
+ selected, the module will be called i810.  AGP support is required
+ for this driver to work.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 07/10] drm/sis: clean up: create a separate Kconfig file

2015-07-13 Thread Archit Taneja
Remove the DRM_SIS config option from the top level drm Kconfig file
and create a new Kconfig file within the driver folder.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/Kconfig | 9 +
 drivers/gpu/drm/sis/Kconfig | 8 
 2 files changed, 9 insertions(+), 8 deletions(-)
 create mode 100644 drivers/gpu/drm/sis/Kconfig

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 198cb75..4b178a3 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -97,14 +97,7 @@ source drivers/gpu/drm/i915/Kconfig
 
 source drivers/gpu/drm/mga/Kconfig
 
-config DRM_SIS
-   tristate SiS video cards
-   depends on DRM  AGP
-   depends on FB_SIS || FB_SIS=n
-   help
- Choose this option if you have a SiS 630 or compatible video
-  chipset. If M is selected the module will be called sis. AGP
-  support is required for this driver to work.
+source drivers/gpu/drm/sis/Kconfig
 
 config DRM_VIA
tristate Via unichrome video cards
diff --git a/drivers/gpu/drm/sis/Kconfig b/drivers/gpu/drm/sis/Kconfig
new file mode 100644
index 000..8ad0276
--- /dev/null
+++ b/drivers/gpu/drm/sis/Kconfig
@@ -0,0 +1,8 @@
+config DRM_SIS
+   tristate SiS video cards
+   depends on DRM  AGP
+   depends on FB_SIS || FB_SIS=n
+   help
+ Choose this option if you have a SiS 630 or compatible video
+  chipset. If M is selected the module will be called sis. AGP
+  support is required for this driver to work.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 05/25] drm/fb_helper: Create a wrapper for fb_set_suspend

2015-07-13 Thread Archit Taneja
Some drm drivers call fb_set_suspend. Create a drm_fb_helper function
that wraps around these calls.

This is part of an effort to prevent drm drivers from calling fbdev
functions directly, in order to make fbdev emulation a top level drm
option.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/drm_fb_helper.c | 7 +++
 include/drm/drm_fb_helper.h | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 55b5212..bb35103 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -812,6 +812,13 @@ void drm_fb_helper_cfb_imageblit(struct fb_info *info,
 }
 EXPORT_SYMBOL(drm_fb_helper_cfb_imageblit);
 
+void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state)
+{
+   if (fb_helper-fbdev)
+   fb_set_suspend(fb_helper-fbdev, state);
+}
+EXPORT_SYMBOL(drm_fb_helper_set_suspend);
+
 static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
 u16 blue, u16 regno, struct fb_info *info)
 {
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index aa45837..200771e 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -166,6 +166,8 @@ void drm_fb_helper_cfb_copyarea(struct fb_info *info,
 void drm_fb_helper_cfb_imageblit(struct fb_info *info,
const struct fb_image *image);
 
+void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state);
+
 int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
 
 int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 06/25] drm/fb_helper: Create a wrapper for remove_conflicting_framebuffers

2015-07-13 Thread Archit Taneja
Some drm drivers call remove_conflicting_framebuffers. Create a
drm_fb_helper function that wraps around these calls.

This is part of an effort to prevent drm drivers from calling fbdev
functions directly, in order to make fbdev emulation a top level drm
option.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/drm_fb_helper.c | 7 +++
 include/drm/drm_fb_helper.h | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index bb35103..389c2a7 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -819,6 +819,13 @@ void drm_fb_helper_set_suspend(struct drm_fb_helper 
*fb_helper, int state)
 }
 EXPORT_SYMBOL(drm_fb_helper_set_suspend);
 
+int drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a,
+   const char *name, bool primary)
+{
+   return remove_conflicting_framebuffers(a, name, primary);
+}
+EXPORT_SYMBOL(drm_fb_helper_remove_conflicting_framebuffers);
+
 static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
 u16 blue, u16 regno, struct fb_info *info)
 {
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 200771e..cc19e88 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -168,6 +168,9 @@ void drm_fb_helper_cfb_imageblit(struct fb_info *info,
 
 void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state);
 
+int drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a,
+   const char *name, bool primary);
+
 int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
 
 int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 04/25] drm/fb_helper: Create wrappers for blit, copyarea and fillrect funcs

2015-07-13 Thread Archit Taneja
drm drivers that emulate fbdev populate their fb_fillrect, fb_copyarea
and fb_imageblit fb_ops with the help of cfb_* or sys_* fbdev core
helper functions.

Create drm_fb_helper functions that wrap around these calls.

This is part of an effort to prevent drm drivers from calling fbdev
functions directly, in order to make fbdev emulation a top level drm
option.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/Kconfig |  6 ++
 drivers/gpu/drm/drm_fb_helper.c | 48 +
 include/drm/drm_fb_helper.h | 14 
 3 files changed, 68 insertions(+)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index b284cdc..e373f8a 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -38,6 +38,12 @@ config DRM_KMS_FB_HELPER
select FRAMEBUFFER_CONSOLE if !EXPERT
select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
select FB_SYS_FOPS
+   select FB_SYS_FILLRECT
+   select FB_SYS_COPYAREA
+   select FB_SYS_IMAGEBLIT
+   select FB_CFB_FILLRECT
+   select FB_CFB_COPYAREA
+   select FB_CFB_IMAGEBLIT
help
  FBDEV helpers for KMS drivers.
 
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 795547e..55b5212 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -764,6 +764,54 @@ ssize_t drm_fb_helper_sys_write(struct fb_info *info, 
const char __user *buf,
 }
 EXPORT_SYMBOL(drm_fb_helper_sys_write);
 
+void drm_fb_helper_sys_fillrect(struct fb_info *info,
+   const struct fb_fillrect *rect)
+{
+   if (info)
+   sys_fillrect(info, rect);
+}
+EXPORT_SYMBOL(drm_fb_helper_sys_fillrect);
+
+void drm_fb_helper_sys_copyarea(struct fb_info *info,
+   const struct fb_copyarea *area)
+{
+   if (info)
+   sys_copyarea(info, area);
+}
+EXPORT_SYMBOL(drm_fb_helper_sys_copyarea);
+
+void drm_fb_helper_sys_imageblit(struct fb_info *info,
+   const struct fb_image *image)
+{
+   if (info)
+   sys_imageblit(info, image);
+}
+EXPORT_SYMBOL(drm_fb_helper_sys_imageblit);
+
+void drm_fb_helper_cfb_fillrect(struct fb_info *info,
+   const struct fb_fillrect *rect)
+{
+   if (info)
+   cfb_fillrect(info, rect);
+}
+EXPORT_SYMBOL(drm_fb_helper_cfb_fillrect);
+
+void drm_fb_helper_cfb_copyarea(struct fb_info *info,
+   const struct fb_copyarea *area)
+{
+   if (info)
+   cfb_copyarea(info, area);
+}
+EXPORT_SYMBOL(drm_fb_helper_cfb_copyarea);
+
+void drm_fb_helper_cfb_imageblit(struct fb_info *info,
+   const struct fb_image *image)
+{
+   if (info)
+   cfb_imageblit(info, image);
+}
+EXPORT_SYMBOL(drm_fb_helper_cfb_imageblit);
+
 static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
 u16 blue, u16 regno, struct fb_info *info)
 {
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index f74e59e..aa45837 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -152,6 +152,20 @@ ssize_t drm_fb_helper_sys_read(struct fb_info *info, char 
__user *buf,
 ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
size_t count, loff_t *ppos);
 
+void drm_fb_helper_sys_fillrect(struct fb_info *info,
+   const struct fb_fillrect *rect);
+void drm_fb_helper_sys_copyarea(struct fb_info *info,
+   const struct fb_copyarea *area);
+void drm_fb_helper_sys_imageblit(struct fb_info *info,
+   const struct fb_image *image);
+
+void drm_fb_helper_cfb_fillrect(struct fb_info *info,
+   const struct fb_fillrect *rect);
+void drm_fb_helper_cfb_copyarea(struct fb_info *info,
+   const struct fb_copyarea *area);
+void drm_fb_helper_cfb_imageblit(struct fb_info *info,
+   const struct fb_image *image);
+
 int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
 
 int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 18/25] drm/qxl: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

COMPILE TESTED ONLY.

Cc: David Airlie airl...@linux.ie
Cc: Frediano Ziglio fzig...@redhat.com
Cc: Maarten Lankhorst maarten.lankho...@canonical.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/qxl/qxl_fb.c | 40 +---
 1 file changed, 13 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 6b6e57e..41c422f 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -197,7 +197,7 @@ static void qxl_fb_fillrect(struct fb_info *info,
 {
struct qxl_fbdev *qfbdev = info-par;
 
-   sys_fillrect(info, rect);
+   drm_fb_helper_sys_fillrect(info, rect);
qxl_dirty_update(qfbdev, rect-dx, rect-dy, rect-width,
 rect-height);
 }
@@ -207,7 +207,7 @@ static void qxl_fb_copyarea(struct fb_info *info,
 {
struct qxl_fbdev *qfbdev = info-par;
 
-   sys_copyarea(info, area);
+   drm_fb_helper_sys_copyarea(info, area);
qxl_dirty_update(qfbdev, area-dx, area-dy, area-width,
 area-height);
 }
@@ -217,7 +217,7 @@ static void qxl_fb_imageblit(struct fb_info *info,
 {
struct qxl_fbdev *qfbdev = info-par;
 
-   sys_imageblit(info, image);
+   drm_fb_helper_sys_imageblit(info, image);
qxl_dirty_update(qfbdev, image-dx, image-dy, image-width,
 image-height);
 }
@@ -345,7 +345,6 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
struct drm_mode_fb_cmd2 mode_cmd;
struct drm_gem_object *gobj = NULL;
struct qxl_bo *qbo = NULL;
-   struct device *device = qdev-pdev-dev;
int ret;
int size;
int bpp = sizes-surface_bpp;
@@ -374,9 +373,9 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
 shadow);
size = mode_cmd.pitches[0] * mode_cmd.height;
 
-   info = framebuffer_alloc(0, device);
-   if (info == NULL) {
-   ret = -ENOMEM;
+   info = drm_fb_helper_alloc_fbi(qfbdev-helper);
+   if (IS_ERR(info)) {
+   ret = PTR_ERR(info);
goto out_unref;
}
 
@@ -388,7 +387,7 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
 
/* setup helper with fb data */
qfbdev-helper.fb = fb;
-   qfbdev-helper.fbdev = info;
+
qfbdev-shadow = shadow;
strcpy(info-fix.id, qxldrmfb);
 
@@ -410,11 +409,6 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
   sizes-fb_height);
 
/* setup aperture base/size for vesafb takeover */
-   info-apertures = alloc_apertures(1);
-   if (!info-apertures) {
-   ret = -ENOMEM;
-   goto out_unref;
-   }
info-apertures-ranges[0].base = qdev-ddev-mode_config.fb_base;
info-apertures-ranges[0].size = qdev-vram_size;
 
@@ -423,13 +417,7 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
 
if (info-screen_base == NULL) {
ret = -ENOSPC;
-   goto out_unref;
-   }
-
-   ret = fb_alloc_cmap(info-cmap, 256, 0);
-   if (ret) {
-   ret = -ENOMEM;
-   goto out_unref;
+   goto out_destroy_fbi;
}
 
info-fbdefio = qxl_defio;
@@ -441,6 +429,8 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
DRM_INFO(fb: depth %d, pitch %d, width %d, height %d\n, fb-depth, 
fb-pitches[0], fb-width, fb-height);
return 0;
 
+out_destroy_fbi:
+   drm_fb_helper_release_fbi(qfbdev-helper);
 out_unref:
if (qbo) {
ret = qxl_bo_reserve(qbo, false);
@@ -479,15 +469,11 @@ static int qxl_fb_find_or_create_single(
 
 static int qxl_fbdev_destroy(struct drm_device *dev, struct qxl_fbdev *qfbdev)
 {
-   struct fb_info *info;
struct qxl_framebuffer *qfb = qfbdev-qfb;
 
-   if (qfbdev-helper.fbdev) {
-   info = qfbdev-helper.fbdev;
+   drm_fb_helper_unregister_fbi(qfbdev-helper);
+   drm_fb_helper_release_fbi(qfbdev-helper);
 
-   unregister_framebuffer(info);
-   framebuffer_release(info);
-   }
if (qfb-obj) {
qxlfb_destroy_pinned_object(qfb-obj);
qfb-obj = NULL;
@@ -557,7 +543,7 @@ void qxl_fbdev_fini(struct qxl_device *qdev)
 
 void qxl_fbdev_set_suspend(struct qxl_device *qdev, int state)
 {
-   fb_set_suspend(qdev-mode_info.qfbdev-helper.fbdev, state);
+   drm_fb_helper_set_suspend(qdev-mode_info.qfbdev-helper, state);
 }
 
 bool qxl_fbdev_qobj_is_fb(struct qxl_device *qdev, struct qxl_bo *qobj)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

[PATCH 15/25] drm/gma500: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

COMPILE TESTED ONLY.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/gma500/accel_2d.c|  6 ++---
 drivers/gpu/drm/gma500/framebuffer.c | 47 
 2 files changed, 19 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/gma500/accel_2d.c 
b/drivers/gpu/drm/gma500/accel_2d.c
index de6f62a..db9f7d0 100644
--- a/drivers/gpu/drm/gma500/accel_2d.c
+++ b/drivers/gpu/drm/gma500/accel_2d.c
@@ -276,12 +276,12 @@ static void psbfb_copyarea_accel(struct fb_info *info,
break;
default:
/* software fallback */
-   cfb_copyarea(info, a);
+   drm_fb_helper_cfb_copyarea(info, a);
return;
}
 
if (!gma_power_begin(dev, false)) {
-   cfb_copyarea(info, a);
+   drm_fb_helper_cfb_copyarea(info, a);
return;
}
psb_accel_2d_copy(dev_priv,
@@ -308,7 +308,7 @@ void psbfb_copyarea(struct fb_info *info,
/* Avoid the 8 pixel erratum */
if (region-width == 8 || region-height == 8 ||
(info-flags  FBINFO_HWACCEL_DISABLED))
-   return cfb_copyarea(info, region);
+   return drm_fb_helper_cfb_copyarea(info, region);
 
psbfb_copyarea_accel(info, region);
 }
diff --git a/drivers/gpu/drm/gma500/framebuffer.c 
b/drivers/gpu/drm/gma500/framebuffer.c
index 2d42ce6..4fbe362 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -194,9 +194,9 @@ static struct fb_ops psbfb_ops = {
.fb_set_par = drm_fb_helper_set_par,
.fb_blank = drm_fb_helper_blank,
.fb_setcolreg = psbfb_setcolreg,
-   .fb_fillrect = cfb_fillrect,
+   .fb_fillrect = drm_fb_helper_cfb_fillrect,
.fb_copyarea = psbfb_copyarea,
-   .fb_imageblit = cfb_imageblit,
+   .fb_imageblit = drm_fb_helper_cfb_imageblit,
.fb_mmap = psbfb_mmap,
.fb_sync = psbfb_sync,
.fb_ioctl = psbfb_ioctl,
@@ -208,9 +208,9 @@ static struct fb_ops psbfb_roll_ops = {
.fb_set_par = drm_fb_helper_set_par,
.fb_blank = drm_fb_helper_blank,
.fb_setcolreg = psbfb_setcolreg,
-   .fb_fillrect = cfb_fillrect,
-   .fb_copyarea = cfb_copyarea,
-   .fb_imageblit = cfb_imageblit,
+   .fb_fillrect = drm_fb_helper_cfb_fillrect,
+   .fb_copyarea = drm_fb_helper_cfb_copyarea,
+   .fb_imageblit = drm_fb_helper_cfb_imageblit,
.fb_pan_display = psbfb_pan,
.fb_mmap = psbfb_mmap,
.fb_ioctl = psbfb_ioctl,
@@ -222,9 +222,9 @@ static struct fb_ops psbfb_unaccel_ops = {
.fb_set_par = drm_fb_helper_set_par,
.fb_blank = drm_fb_helper_blank,
.fb_setcolreg = psbfb_setcolreg,
-   .fb_fillrect = cfb_fillrect,
-   .fb_copyarea = cfb_copyarea,
-   .fb_imageblit = cfb_imageblit,
+   .fb_fillrect = drm_fb_helper_cfb_fillrect,
+   .fb_copyarea = drm_fb_helper_cfb_copyarea,
+   .fb_imageblit = drm_fb_helper_cfb_imageblit,
.fb_mmap = psbfb_mmap,
.fb_ioctl = psbfb_ioctl,
 };
@@ -409,9 +409,9 @@ static int psbfb_create(struct psb_fbdev *fbdev,
 
mutex_lock(dev-struct_mutex);
 
-   info = framebuffer_alloc(0, device);
-   if (!info) {
-   ret = -ENOMEM;
+   info = drm_fb_helper_alloc_fbi(fbdev-psb_fb_helper);
+   if (IS_ERR(info)) {
+   ret = PTR_ERR(info);
goto out_err1;
}
info-par = fbdev;
@@ -426,7 +426,6 @@ static int psbfb_create(struct psb_fbdev *fbdev,
psbfb-fbdev = info;
 
fbdev-psb_fb_helper.fb = fb;
-   fbdev-psb_fb_helper.fbdev = info;
 
drm_fb_helper_fill_fix(info, fb-pitches[0], fb-depth);
strcpy(info-fix.id, psbdrmfb);
@@ -440,12 +439,6 @@ static int psbfb_create(struct psb_fbdev *fbdev,
} else  /* Software */
info-fbops = psbfb_unaccel_ops;
 
-   ret = fb_alloc_cmap(info-cmap, 256, 0);
-   if (ret) {
-   ret = -ENOMEM;
-   goto out_unref;
-   }
-
info-fix.smem_start = dev-mode_config.fb_base;
info-fix.smem_len = size;
info-fix.ywrapstep = gtt_roll;
@@ -456,11 +449,6 @@ static int psbfb_create(struct psb_fbdev *fbdev,
info-screen_size = size;
 
if (dev_priv-gtt.stolen_size) {
-   info-apertures = alloc_apertures(1);
-   if (!info-apertures) {
-   ret = -ENOMEM;
-   goto out_unref;
-   }
info-apertures-ranges[0].base = dev-mode_config.fb_base;
info-apertures-ranges[0].size = dev_priv-gtt.stolen_size;
}
@@ -483,6 +471,8 @@ out_unref:
psb_gtt_free_range(dev, backing);
else
drm_gem_object_unreference(backing-gem

[PATCH 13/25] drm/msm: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

Cc: Rob Clark robdcl...@gmail.com
Cc: Stephane Viau sv...@codeaurora.org
Cc: Hai Li h...@codeaurora.org

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/msm/msm_fbdev.c | 34 ++
 1 file changed, 10 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index 95f6532..f97a196 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -43,11 +43,11 @@ static struct fb_ops msm_fb_ops = {
/* Note: to properly handle manual update displays, we wrap the
 * basic fbdev ops which write to the framebuffer
 */
-   .fb_read = fb_sys_read,
-   .fb_write = fb_sys_write,
-   .fb_fillrect = sys_fillrect,
-   .fb_copyarea = sys_copyarea,
-   .fb_imageblit = sys_imageblit,
+   .fb_read = drm_fb_helper_sys_read,
+   .fb_write = drm_fb_helper_sys_write,
+   .fb_fillrect = drm_fb_helper_sys_fillrect,
+   .fb_copyarea = drm_fb_helper_sys_copyarea,
+   .fb_imageblit = drm_fb_helper_sys_imageblit,
.fb_mmap = msm_fbdev_mmap,
 
.fb_check_var = drm_fb_helper_check_var,
@@ -144,10 +144,10 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
goto fail_unlock;
}
 
-   fbi = framebuffer_alloc(0, dev-dev);
-   if (!fbi) {
+   fbi = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(fbi)) {
dev_err(dev-dev, failed to allocate fb info\n);
-   ret = -ENOMEM;
+   ret = PTR_ERR(fbi);
goto fail_unlock;
}
 
@@ -155,7 +155,6 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
 
fbdev-fb = fb;
helper-fb = fb;
-   helper-fbdev = fbi;
 
fbi-par = helper;
fbi-flags = FBINFO_DEFAULT;
@@ -163,12 +162,6 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
 
strcpy(fbi-fix.id, msm);
 
-   ret = fb_alloc_cmap(fbi-cmap, 256, 0);
-   if (ret) {
-   ret = -ENOMEM;
-   goto fail_unlock;
-   }
-
drm_fb_helper_fill_fix(fbi, fb-pitches[0], fb-depth);
drm_fb_helper_fill_var(fbi, helper, sizes-fb_width, sizes-fb_height);
 
@@ -191,7 +184,6 @@ fail_unlock:
 fail:
 
if (ret) {
-   framebuffer_release(fbi);
if (fb) {
drm_framebuffer_unregister_private(fb);
drm_framebuffer_remove(fb);
@@ -266,17 +258,11 @@ void msm_fbdev_free(struct drm_device *dev)
struct msm_drm_private *priv = dev-dev_private;
struct drm_fb_helper *helper = priv-fbdev;
struct msm_fbdev *fbdev;
-   struct fb_info *fbi;
 
DBG();
 
-   fbi = helper-fbdev;
-
-   /* only cleanup framebuffer if it is present */
-   if (fbi) {
-   unregister_framebuffer(fbi);
-   framebuffer_release(fbi);
-   }
+   drm_fb_helper_unregister_fbi(helper);
+   drm_fb_helper_release_fbi(helper);
 
drm_fb_helper_fini(helper);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 09/25] drm/armada: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

COMPILE TESTED ONLY.

Cc: Russell King rmk+ker...@arm.linux.org.uk
Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/armada/armada_fbdev.c | 33 ++---
 1 file changed, 10 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_fbdev.c 
b/drivers/gpu/drm/armada/armada_fbdev.c
index 7838e73..7d03c51 100644
--- a/drivers/gpu/drm/armada/armada_fbdev.c
+++ b/drivers/gpu/drm/armada/armada_fbdev.c
@@ -22,9 +22,9 @@ static /*const*/ struct fb_ops armada_fb_ops = {
.owner  = THIS_MODULE,
.fb_check_var   = drm_fb_helper_check_var,
.fb_set_par = drm_fb_helper_set_par,
-   .fb_fillrect= cfb_fillrect,
-   .fb_copyarea= cfb_copyarea,
-   .fb_imageblit   = cfb_imageblit,
+   .fb_fillrect= drm_fb_helper_cfb_fillrect,
+   .fb_copyarea= drm_fb_helper_cfb_copyarea,
+   .fb_imageblit   = drm_fb_helper_cfb_imageblit,
.fb_pan_display = drm_fb_helper_pan_display,
.fb_blank   = drm_fb_helper_blank,
.fb_setcmap = drm_fb_helper_setcmap,
@@ -80,18 +80,12 @@ static int armada_fb_create(struct drm_fb_helper *fbh,
if (IS_ERR(dfb))
return PTR_ERR(dfb);
 
-   info = framebuffer_alloc(0, dev-dev);
-   if (!info) {
-   ret = -ENOMEM;
+   info = drm_fb_helper_alloc_fbi(fbh);
+   if (IS_ERR(info)) {
+   ret = PTR_ERR(info);
goto err_fballoc;
}
 
-   ret = fb_alloc_cmap(info-cmap, 256, 0);
-   if (ret) {
-   ret = -ENOMEM;
-   goto err_fbcmap;
-   }
-
strlcpy(info-fix.id, armada-drmfb, sizeof(info-fix.id));
info-par = fbh;
info-flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
@@ -101,7 +95,7 @@ static int armada_fb_create(struct drm_fb_helper *fbh,
info-screen_size = obj-obj.size;
info-screen_base = ptr;
fbh-fb = dfb-fb;
-   fbh-fbdev = info;
+
drm_fb_helper_fill_fix(info, dfb-fb.pitches[0], dfb-fb.depth);
drm_fb_helper_fill_var(info, fbh, sizes-fb_width, sizes-fb_height);
 
@@ -111,8 +105,6 @@ static int armada_fb_create(struct drm_fb_helper *fbh,
 
return 0;
 
- err_fbcmap:
-   framebuffer_release(info);
  err_fballoc:
dfb-fb.funcs-destroy(dfb-fb);
return ret;
@@ -171,6 +163,7 @@ int armada_fbdev_init(struct drm_device *dev)
 
return 0;
  err_fb_setup:
+   drm_fb_helper_release_fbi(fbh);
drm_fb_helper_fini(fbh);
  err_fb_helper:
priv-fbdev = NULL;
@@ -191,14 +184,8 @@ void armada_fbdev_fini(struct drm_device *dev)
struct drm_fb_helper *fbh = priv-fbdev;
 
if (fbh) {
-   struct fb_info *info = fbh-fbdev;
-
-   if (info) {
-   unregister_framebuffer(info);
-   if (info-cmap.len)
-   fb_dealloc_cmap(info-cmap);
-   framebuffer_release(info);
-   }
+   drm_fb_helper_unregister_fbi(fbh);
+   drm_fb_helper_release_fbi(fbh);
 
drm_fb_helper_fini(fbh);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 11/25] drm/omap: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

COMPILE TESTED ONLY.

Cc: Tomi Valkeinen tomi.valkei...@ti.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/omapdrm/omap_fbdev.c | 34 +++---
 1 file changed, 11 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c 
b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 23b5a84..a388a85 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -86,11 +86,11 @@ static struct fb_ops omap_fb_ops = {
/* Note: to properly handle manual update displays, we wrap the
 * basic fbdev ops which write to the framebuffer
 */
-   .fb_read = fb_sys_read,
-   .fb_write = fb_sys_write,
-   .fb_fillrect = sys_fillrect,
-   .fb_copyarea = sys_copyarea,
-   .fb_imageblit = sys_imageblit,
+   .fb_read = drm_fb_helper_sys_read,
+   .fb_write = drm_fb_helper_sys_write,
+   .fb_fillrect = drm_fb_helper_sys_fillrect,
+   .fb_copyarea = drm_fb_helper_sys_copyarea,
+   .fb_imageblit = drm_fb_helper_sys_imageblit,
 
.fb_check_var = drm_fb_helper_check_var,
.fb_set_par = drm_fb_helper_set_par,
@@ -179,7 +179,7 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 
mutex_lock(dev-struct_mutex);
 
-   fbi = framebuffer_alloc(0, dev-dev);
+   fbi = drm_fb_helper_alloc_fbi(helper);
if (!fbi) {
dev_err(dev-dev, failed to allocate fb info\n);
ret = -ENOMEM;
@@ -190,7 +190,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 
fbdev-fb = fb;
helper-fb = fb;
-   helper-fbdev = fbi;
 
fbi-par = helper;
fbi-flags = FBINFO_DEFAULT;
@@ -198,12 +197,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 
strcpy(fbi-fix.id, MODULE_NAME);
 
-   ret = fb_alloc_cmap(fbi-cmap, 256, 0);
-   if (ret) {
-   ret = -ENOMEM;
-   goto fail_unlock;
-   }
-
drm_fb_helper_fill_fix(fbi, fb-pitches[0], fb-depth);
drm_fb_helper_fill_var(fbi, helper, sizes-fb_width, sizes-fb_height);
 
@@ -236,8 +229,9 @@ fail_unlock:
 fail:
 
if (ret) {
-   if (fbi)
-   framebuffer_release(fbi);
+
+   drm_fb_helper_release_fbi(helper);
+
if (fb) {
drm_framebuffer_unregister_private(fb);
drm_framebuffer_remove(fb);
@@ -312,17 +306,11 @@ void omap_fbdev_free(struct drm_device *dev)
struct omap_drm_private *priv = dev-dev_private;
struct drm_fb_helper *helper = priv-fbdev;
struct omap_fbdev *fbdev;
-   struct fb_info *fbi;
 
DBG();
 
-   fbi = helper-fbdev;
-
-   /* only cleanup framebuffer if it is present */
-   if (fbi) {
-   unregister_framebuffer(fbi);
-   framebuffer_release(fbi);
-   }
+   drm_fb_helper_unregister_fbi(helper);
+   drm_fb_helper_release_fbi(helper);
 
drm_fb_helper_fini(helper);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 14/25] drm/exynos: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

COMPILE TESTED ONLY.

Cc: Inki Dae inki@samsung.com
Cc: Joonyoung Shim jy0922.s...@samsung.com
Cc: Seung-Woo Kim sw0312@samsung.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 45 +--
 1 file changed, 12 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index e0b085b..6975b70 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -65,9 +65,9 @@ static int exynos_drm_fb_mmap(struct fb_info *info,
 static struct fb_ops exynos_drm_fb_ops = {
.owner  = THIS_MODULE,
.fb_mmap= exynos_drm_fb_mmap,
-   .fb_fillrect= cfb_fillrect,
-   .fb_copyarea= cfb_copyarea,
-   .fb_imageblit   = cfb_imageblit,
+   .fb_fillrect= drm_fb_helper_cfb_fillrect,
+   .fb_copyarea= drm_fb_helper_cfb_copyarea,
+   .fb_imageblit   = drm_fb_helper_cfb_imageblit,
.fb_check_var   = drm_fb_helper_check_var,
.fb_set_par = drm_fb_helper_set_par,
.fb_blank   = drm_fb_helper_blank,
@@ -142,10 +142,10 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper 
*helper,
 
mutex_lock(dev-struct_mutex);
 
-   fbi = framebuffer_alloc(0, pdev-dev);
-   if (!fbi) {
+   fbi = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(fbi)) {
DRM_ERROR(failed to allocate fb info.\n);
-   ret = -ENOMEM;
+   ret = PTR_ERR(fbi);
goto out;
}
 
@@ -165,7 +165,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper 
*helper,
 
if (IS_ERR(exynos_gem_obj)) {
ret = PTR_ERR(exynos_gem_obj);
-   goto err_release_framebuffer;
+   goto err_release_fbi;
}
 
exynos_fbdev-exynos_gem_obj = exynos_gem_obj;
@@ -178,21 +178,13 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper 
*helper,
goto err_destroy_gem;
}
 
-   helper-fbdev = fbi;
-
fbi-par = helper;
fbi-flags = FBINFO_FLAG_DEFAULT;
fbi-fbops = exynos_drm_fb_ops;
 
-   ret = fb_alloc_cmap(fbi-cmap, 256, 0);
-   if (ret) {
-   DRM_ERROR(failed to allocate cmap.\n);
-   goto err_destroy_framebuffer;
-   }
-
ret = exynos_drm_fbdev_update(helper, sizes, helper-fb);
if (ret  0)
-   goto err_dealloc_cmap;
+   goto err_destroy_framebuffer;
 
mutex_unlock(dev-struct_mutex);
return ret;
@@ -203,8 +195,8 @@ err_destroy_framebuffer:
drm_framebuffer_cleanup(helper-fb);
 err_destroy_gem:
exynos_drm_gem_destroy(exynos_gem_obj);
-err_release_framebuffer:
-   framebuffer_release(fbi);
+err_release_fbi:
+   drm_fb_helper_release_fbi(helper);
 
 /*
  * if failed, all resources allocated above would be released by
@@ -312,21 +304,8 @@ static void exynos_drm_fbdev_destroy(struct drm_device 
*dev,
}
}
 
-   /* release linux framebuffer */
-   if (fb_helper-fbdev) {
-   struct fb_info *info;
-   int ret;
-
-   info = fb_helper-fbdev;
-   ret = unregister_framebuffer(info);
-   if (ret  0)
-   DRM_DEBUG_KMS(failed unregister_framebuffer()\n);
-
-   if (info-cmap.len)
-   fb_dealloc_cmap(info-cmap);
-
-   framebuffer_release(info);
-   }
+   drm_fb_helper_unregister_fbi(fb_helper);
+   drm_fb_helper_release_fbi(fb_helper);
 
drm_fb_helper_fini(fb_helper);
 }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 22/25] drm/boschs: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

COMPILE TESTED ONLY.

Cc: David Airlie airl...@linux.ie
Cc: Gerd Hoffmann kra...@redhat.com
Cc: Daniel Vetter daniel.vet...@ffwll.ch

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/bochs/bochs_drv.c   |  6 +++---
 drivers/gpu/drm/bochs/bochs_fbdev.c | 34 +++---
 2 files changed, 14 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_drv.c 
b/drivers/gpu/drm/bochs/bochs_drv.c
index 98837bd..7802fc6 100644
--- a/drivers/gpu/drm/bochs/bochs_drv.c
+++ b/drivers/gpu/drm/bochs/bochs_drv.c
@@ -109,7 +109,7 @@ static int bochs_pm_suspend(struct device *dev)
 
if (bochs-fb.initialized) {
console_lock();
-   fb_set_suspend(bochs-fb.helper.fbdev, 1);
+   drm_fb_helper_set_suspend(bochs-fb.helper, 1);
console_unlock();
}
 
@@ -126,7 +126,7 @@ static int bochs_pm_resume(struct device *dev)
 
if (bochs-fb.initialized) {
console_lock();
-   fb_set_suspend(bochs-fb.helper.fbdev, 0);
+   drm_fb_helper_set_suspend(bochs-fb.helper, 0);
console_unlock();
}
 
@@ -153,7 +153,7 @@ static int bochs_kick_out_firmware_fb(struct pci_dev *pdev)
 
ap-ranges[0].base = pci_resource_start(pdev, 0);
ap-ranges[0].size = pci_resource_len(pdev, 0);
-   remove_conflicting_framebuffers(ap, bochsdrmfb, false);
+   drm_fb_helper_remove_conflicting_framebuffers(ap, bochsdrmfb, false);
kfree(ap);
 
return 0;
diff --git a/drivers/gpu/drm/bochs/bochs_fbdev.c 
b/drivers/gpu/drm/bochs/bochs_fbdev.c
index 976d979..8c26d5b 100644
--- a/drivers/gpu/drm/bochs/bochs_fbdev.c
+++ b/drivers/gpu/drm/bochs/bochs_fbdev.c
@@ -24,9 +24,9 @@ static struct fb_ops bochsfb_ops = {
.owner = THIS_MODULE,
.fb_check_var = drm_fb_helper_check_var,
.fb_set_par = drm_fb_helper_set_par,
-   .fb_fillrect = sys_fillrect,
-   .fb_copyarea = sys_copyarea,
-   .fb_imageblit = sys_imageblit,
+   .fb_fillrect = drm_fb_helper_sys_fillrect,
+   .fb_copyarea = drm_fb_helper_sys_copyarea,
+   .fb_imageblit = drm_fb_helper_sys_imageblit,
.fb_pan_display = drm_fb_helper_pan_display,
.fb_blank = drm_fb_helper_blank,
.fb_setcmap = drm_fb_helper_setcmap,
@@ -106,22 +106,23 @@ static int bochsfb_create(struct drm_fb_helper *helper,
ttm_bo_unreserve(bo-bo);
 
/* init fb device */
-   info = framebuffer_alloc(0, device);
-   if (info == NULL)
-   return -ENOMEM;
+   info = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(info))
+   return PTR_ERR(info);
 
info-par = bochs-fb.helper;
 
ret = bochs_framebuffer_init(bochs-dev, bochs-fb.gfb, mode_cmd, 
gobj);
-   if (ret)
+   if (ret) {
+   drm_fb_helper_release_fbi(helper);
return ret;
+   }
 
bochs-fb.size = size;
 
/* setup helper */
fb = bochs-fb.gfb.base;
bochs-fb.helper.fb = fb;
-   bochs-fb.helper.fbdev = info;
 
strcpy(info-fix.id, bochsdrmfb);
 
@@ -139,30 +140,17 @@ static int bochsfb_create(struct drm_fb_helper *helper,
info-fix.smem_start = 0;
info-fix.smem_len = size;
 
-   ret = fb_alloc_cmap(info-cmap, 256, 0);
-   if (ret) {
-   DRM_ERROR(%s: can't allocate color map\n, info-fix.id);
-   return -ENOMEM;
-   }
-
return 0;
 }
 
 static int bochs_fbdev_destroy(struct bochs_device *bochs)
 {
struct bochs_framebuffer *gfb = bochs-fb.gfb;
-   struct fb_info *info;
 
DRM_DEBUG_DRIVER(\n);
 
-   if (bochs-fb.helper.fbdev) {
-   info = bochs-fb.helper.fbdev;
-
-   unregister_framebuffer(info);
-   if (info-cmap.len)
-   fb_dealloc_cmap(info-cmap);
-   framebuffer_release(info);
-   }
+   drm_fb_helper_unregister_fbi(bochs-fb.helper);
+   drm_fb_helper_release_fbi(bochs-fb.helper);
 
if (gfb-obj) {
drm_gem_object_unreference_unlocked(gfb-obj);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 21/25] drm/udl: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

COMPILE TESTED ONLY.

Cc: David Airlie airl...@linux.ie
Cc: Haixia Shi h...@chromium.org
Cc: Stéphane Marchesin marc...@chromium.org

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/udl/udl_fb.c | 40 
 1 file changed, 12 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
index 5fc16ce..9fd6e83 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -288,7 +288,7 @@ static void udl_fb_fillrect(struct fb_info *info, const 
struct fb_fillrect *rect
 {
struct udl_fbdev *ufbdev = info-par;
 
-   sys_fillrect(info, rect);
+   drm_fb_helper_sys_fillrect(info, rect);
 
udl_handle_damage(ufbdev-ufb, rect-dx, rect-dy, rect-width,
  rect-height);
@@ -298,7 +298,7 @@ static void udl_fb_copyarea(struct fb_info *info, const 
struct fb_copyarea *regi
 {
struct udl_fbdev *ufbdev = info-par;
 
-   sys_copyarea(info, region);
+   drm_fb_helper_sys_copyarea(info, region);
 
udl_handle_damage(ufbdev-ufb, region-dx, region-dy, region-width,
  region-height);
@@ -308,7 +308,7 @@ static void udl_fb_imageblit(struct fb_info *info, const 
struct fb_image *image)
 {
struct udl_fbdev *ufbdev = info-par;
 
-   sys_imageblit(info, image);
+   drm_fb_helper_sys_imageblit(info, image);
 
udl_handle_damage(ufbdev-ufb, image-dx, image-dy, image-width,
  image-height);
@@ -506,21 +506,20 @@ static int udlfb_create(struct drm_fb_helper *helper,
goto out_gfree;
}
 
-   info = framebuffer_alloc(0, device);
-   if (!info) {
-   ret = -ENOMEM;
+   info = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(info)) {
+   ret = PTR_ERR(info);
goto out_gfree;
}
info-par = ufbdev;
 
ret = udl_framebuffer_init(dev, ufbdev-ufb, mode_cmd, obj);
if (ret)
-   goto out_gfree;
+   goto out_destroy_fbi;
 
fb = ufbdev-ufb.base;
 
ufbdev-helper.fb = fb;
-   ufbdev-helper.fbdev = info;
 
strcpy(info-fix.id, udldrmfb);
 
@@ -533,18 +532,13 @@ static int udlfb_create(struct drm_fb_helper *helper,
drm_fb_helper_fill_fix(info, fb-pitches[0], fb-depth);
drm_fb_helper_fill_var(info, ufbdev-helper, sizes-fb_width, 
sizes-fb_height);
 
-   ret = fb_alloc_cmap(info-cmap, 256, 0);
-   if (ret) {
-   ret = -ENOMEM;
-   goto out_gfree;
-   }
-
-
DRM_DEBUG_KMS(allocated %dx%d vmal %p\n,
  fb-width, fb-height,
  ufbdev-ufb.obj-vmapping);
 
return ret;
+out_destroy_fbi:
+   drm_fb_helper_release_fbi(helper);
 out_gfree:
drm_gem_object_unreference(ufbdev-ufb.obj-base);
 out:
@@ -558,14 +552,8 @@ static const struct drm_fb_helper_funcs 
udl_fb_helper_funcs = {
 static void udl_fbdev_destroy(struct drm_device *dev,
  struct udl_fbdev *ufbdev)
 {
-   struct fb_info *info;
-   if (ufbdev-helper.fbdev) {
-   info = ufbdev-helper.fbdev;
-   unregister_framebuffer(info);
-   if (info-cmap.len)
-   fb_dealloc_cmap(info-cmap);
-   framebuffer_release(info);
-   }
+   drm_fb_helper_unregister_fbi(ufbdev-helper);
+   drm_fb_helper_release_fbi(ufbdev-helper);
drm_fb_helper_fini(ufbdev-helper);
drm_framebuffer_unregister_private(ufbdev-ufb.base);
drm_framebuffer_cleanup(ufbdev-ufb.base);
@@ -631,11 +619,7 @@ void udl_fbdev_unplug(struct drm_device *dev)
return;
 
ufbdev = udl-fbdev;
-   if (ufbdev-helper.fbdev) {
-   struct fb_info *info;
-   info = ufbdev-helper.fbdev;
-   unlink_framebuffer(info);
-   }
+   drm_fb_helper_unlink_fbi(ufbdev-helper);
 }
 
 struct drm_framebuffer *
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 25/25] drm/fb_cma_helper: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

COMPILE TESTED ONLY.

Cc: Lars-Peter Clausen l...@metafoo.de
Cc: Daniel Vetter daniel.vet...@ffwll.ch

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/drm_fb_cma_helper.c | 45 +
 1 file changed, 11 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
b/drivers/gpu/drm/drm_fb_cma_helper.c
index 5c1aca4..0da6a24 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -234,9 +234,9 @@ EXPORT_SYMBOL_GPL(drm_fb_cma_debugfs_show);
 
 static struct fb_ops drm_fbdev_cma_ops = {
.owner  = THIS_MODULE,
-   .fb_fillrect= sys_fillrect,
-   .fb_copyarea= sys_copyarea,
-   .fb_imageblit   = sys_imageblit,
+   .fb_fillrect= drm_fb_helper_sys_fillrect,
+   .fb_copyarea= drm_fb_helper_sys_copyarea,
+   .fb_imageblit   = drm_fb_helper_sys_imageblit,
.fb_check_var   = drm_fb_helper_check_var,
.fb_set_par = drm_fb_helper_set_par,
.fb_blank   = drm_fb_helper_blank,
@@ -275,10 +275,9 @@ static int drm_fbdev_cma_create(struct drm_fb_helper 
*helper,
if (IS_ERR(obj))
return -ENOMEM;
 
-   fbi = framebuffer_alloc(0, dev-dev);
-   if (!fbi) {
-   dev_err(dev-dev, Failed to allocate framebuffer info.\n);
-   ret = -ENOMEM;
+   fbi = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(fbi)) {
+   ret = PTR_ERR(fbi);
goto err_drm_gem_cma_free_object;
}
 
@@ -286,23 +285,16 @@ static int drm_fbdev_cma_create(struct drm_fb_helper 
*helper,
if (IS_ERR(fbdev_cma-fb)) {
dev_err(dev-dev, Failed to allocate DRM framebuffer.\n);
ret = PTR_ERR(fbdev_cma-fb);
-   goto err_framebuffer_release;
+   goto err_fb_info_destroy;
}
 
fb = fbdev_cma-fb-fb;
helper-fb = fb;
-   helper-fbdev = fbi;
 
fbi-par = helper;
fbi-flags = FBINFO_FLAG_DEFAULT;
fbi-fbops = drm_fbdev_cma_ops;
 
-   ret = fb_alloc_cmap(fbi-cmap, 256, 0);
-   if (ret) {
-   dev_err(dev-dev, Failed to allocate color map.\n);
-   goto err_drm_fb_cma_destroy;
-   }
-
drm_fb_helper_fill_fix(fbi, fb-pitches[0], fb-depth);
drm_fb_helper_fill_var(fbi, helper, sizes-fb_width, sizes-fb_height);
 
@@ -317,11 +309,8 @@ static int drm_fbdev_cma_create(struct drm_fb_helper 
*helper,
 
return 0;
 
-err_drm_fb_cma_destroy:
-   drm_framebuffer_unregister_private(fb);
-   drm_fb_cma_destroy(fb);
-err_framebuffer_release:
-   framebuffer_release(fbi);
+err_fb_info_destroy:
+   drm_fb_helper_release_fbi(helper);
 err_drm_gem_cma_free_object:
drm_gem_cma_free_object(obj-base);
return ret;
@@ -397,20 +386,8 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_init);
  */
 void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma)
 {
-   if (fbdev_cma-fb_helper.fbdev) {
-   struct fb_info *info;
-   int ret;
-
-   info = fbdev_cma-fb_helper.fbdev;
-   ret = unregister_framebuffer(info);
-   if (ret  0)
-   DRM_DEBUG_KMS(failed unregister_framebuffer()\n);
-
-   if (info-cmap.len)
-   fb_dealloc_cmap(info-cmap);
-
-   framebuffer_release(info);
-   }
+   drm_fb_helper_unregister_fbi(fbdev_cma-fb_helper);
+   drm_fb_helper_release_fbi(fbdev_cma-fb_helper);
 
if (fbdev_cma-fb) {
drm_framebuffer_unregister_private(fbdev_cma-fb-fb);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 24/25] drm/virtio: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

COMPILE TESTED ONLY.

Cc: David Airlie airl...@linux.ie
Cc: Gerd Hoffmann kra...@redhat.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c |  3 ++-
 drivers/gpu/drm/virtio/virtgpu_fb.c  | 30 +-
 2 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c 
b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c
index 88a3916..aea1bac 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c
@@ -52,7 +52,8 @@ static void virtio_pci_kick_out_firmware_fb(struct pci_dev 
*pci_dev)
primary = pci_dev-resource[PCI_ROM_RESOURCE].flags
 IORESOURCE_ROM_SHADOW;
 
-   remove_conflicting_framebuffers(ap, virtiodrmfb, primary);
+   drm_fb_helper_remove_conflicting_framebuffers(ap, virtiodrmfb,
+   primary);
 
kfree(ap);
 }
diff --git a/drivers/gpu/drm/virtio/virtgpu_fb.c 
b/drivers/gpu/drm/virtio/virtgpu_fb.c
index df198d9..3b5462b 100644
--- a/drivers/gpu/drm/virtio/virtgpu_fb.c
+++ b/drivers/gpu/drm/virtio/virtgpu_fb.c
@@ -173,7 +173,7 @@ static void virtio_gpu_3d_fillrect(struct fb_info *info,
   const struct fb_fillrect *rect)
 {
struct virtio_gpu_fbdev *vfbdev = info-par;
-   sys_fillrect(info, rect);
+   drm_fb_helper_sys_fillrect(info, rect);
virtio_gpu_dirty_update(vfbdev-vgfb, true, rect-dx, rect-dy,
 rect-width, rect-height);
schedule_delayed_work(vfbdev-work, VIRTIO_GPU_FBCON_POLL_PERIOD);
@@ -183,7 +183,7 @@ static void virtio_gpu_3d_copyarea(struct fb_info *info,
   const struct fb_copyarea *area)
 {
struct virtio_gpu_fbdev *vfbdev = info-par;
-   sys_copyarea(info, area);
+   drm_fb_helper_sys_copyarea(info, area);
virtio_gpu_dirty_update(vfbdev-vgfb, true, area-dx, area-dy,
   area-width, area-height);
schedule_delayed_work(vfbdev-work, VIRTIO_GPU_FBCON_POLL_PERIOD);
@@ -193,7 +193,7 @@ static void virtio_gpu_3d_imageblit(struct fb_info *info,
const struct fb_image *image)
 {
struct virtio_gpu_fbdev *vfbdev = info-par;
-   sys_imageblit(info, image);
+   drm_fb_helper_sys_imageblit(info, image);
virtio_gpu_dirty_update(vfbdev-vgfb, true, image-dx, image-dy,
 image-width, image-height);
schedule_delayed_work(vfbdev-work, VIRTIO_GPU_FBCON_POLL_PERIOD);
@@ -317,18 +317,12 @@ static int virtio_gpufb_create(struct drm_fb_helper 
*helper,
if (ret)
goto err_obj_attach;
 
-   info = framebuffer_alloc(0, device);
-   if (!info) {
-   ret = -ENOMEM;
+   info = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(info)) {
+   ret = PTR_ERR(info);
goto err_fb_alloc;
}
 
-   ret = fb_alloc_cmap(info-cmap, 256, 0);
-   if (ret) {
-   ret = -ENOMEM;
-   goto err_fb_alloc_cmap;
-   }
-
info-par = helper;
 
ret = virtio_gpu_framebuffer_init(dev, vfbdev-vgfb,
@@ -339,7 +333,6 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper,
fb = vfbdev-vgfb.base;
 
vfbdev-helper.fb = fb;
-   vfbdev-helper.fbdev = info;
 
strcpy(info-fix.id, virtiodrmfb);
info-flags = FBINFO_DEFAULT;
@@ -357,9 +350,7 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper,
return 0;
 
 err_fb_init:
-   fb_dealloc_cmap(info-cmap);
-err_fb_alloc_cmap:
-   framebuffer_release(info);
+   drm_fb_helper_release_fbi(helper);
 err_fb_alloc:
virtio_gpu_cmd_resource_inval_backing(vgdev, resid);
 err_obj_attach:
@@ -374,12 +365,9 @@ static int virtio_gpu_fbdev_destroy(struct drm_device *dev,
struct fb_info *info;
struct virtio_gpu_framebuffer *vgfb = vgfbdev-vgfb;
 
-   if (vgfbdev-helper.fbdev) {
-   info = vgfbdev-helper.fbdev;
+   drm_fb_helper_unregister_fbi(vgfbdev-helper);
+   drm_fb_helper_release_fbi(vgfbdev-helper);
 
-   unregister_framebuffer(info);
-   framebuffer_release(info);
-   }
if (vgfb-obj)
vgfb-obj = NULL;
drm_fb_helper_fini(vgfbdev-helper);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 16/25] drm/mgag200: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

COMPILE TESTED ONLY.

Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: David Airlie airl...@linux.ie
Cc: Alex Deucher alexander.deuc...@amd.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/mgag200/mgag200_drv.c  |  3 ++-
 drivers/gpu/drm/mgag200/mgag200_fb.c   | 36 --
 drivers/gpu/drm/mgag200/mgag200_main.c |  2 +-
 3 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c 
b/drivers/gpu/drm/mgag200/mgag200_drv.c
index 9774599..38363f8 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -55,7 +55,8 @@ static void mgag200_kick_out_firmware_fb(struct pci_dev *pdev)
 #ifdef CONFIG_X86
primary = pdev-resource[PCI_ROM_RESOURCE].flags  
IORESOURCE_ROM_SHADOW;
 #endif
-   remove_conflicting_framebuffers(ap, mgag200drmfb, primary);
+   drm_fb_helper_remove_conflicting_framebuffers(ap, mgag200drmfb,
+   primary);
kfree(ap);
 }
 
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c 
b/drivers/gpu/drm/mgag200/mgag200_fb.c
index c36b830..f7553b2 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -101,7 +101,7 @@ static void mga_fillrect(struct fb_info *info,
 const struct fb_fillrect *rect)
 {
struct mga_fbdev *mfbdev = info-par;
-   sys_fillrect(info, rect);
+   drm_fb_helper_sys_fillrect(info, rect);
mga_dirty_update(mfbdev, rect-dx, rect-dy, rect-width,
 rect-height);
 }
@@ -110,7 +110,7 @@ static void mga_copyarea(struct fb_info *info,
 const struct fb_copyarea *area)
 {
struct mga_fbdev *mfbdev = info-par;
-   sys_copyarea(info, area);
+   drm_fb_helper_sys_copyarea(info, area);
mga_dirty_update(mfbdev, area-dx, area-dy, area-width,
 area-height);
 }
@@ -119,7 +119,7 @@ static void mga_imageblit(struct fb_info *info,
  const struct fb_image *image)
 {
struct mga_fbdev *mfbdev = info-par;
-   sys_imageblit(info, image);
+   drm_fb_helper_sys_imageblit(info, image);
mga_dirty_update(mfbdev, image-dx, image-dy, image-width,
 image-height);
 }
@@ -191,9 +191,9 @@ static int mgag200fb_create(struct drm_fb_helper *helper,
if (!sysram)
return -ENOMEM;
 
-   info = framebuffer_alloc(0, device);
-   if (info == NULL)
-   return -ENOMEM;
+   info = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(info))
+   return PTR_ERR(info);
 
info-par = mfbdev;
 
@@ -208,14 +208,6 @@ static int mgag200fb_create(struct drm_fb_helper *helper,
 
/* setup helper */
mfbdev-helper.fb = fb;
-   mfbdev-helper.fbdev = info;
-
-   ret = fb_alloc_cmap(info-cmap, 256, 0);
-   if (ret) {
-   DRM_ERROR(%s: can't allocate color map\n, info-fix.id);
-   ret = -ENOMEM;
-   goto out;
-   }
 
strcpy(info-fix.id, mgadrmfb);
 
@@ -223,11 +215,6 @@ static int mgag200fb_create(struct drm_fb_helper *helper,
info-fbops = mgag200fb_ops;
 
/* setup aperture base/size for vesafb takeover */
-   info-apertures = alloc_apertures(1);
-   if (!info-apertures) {
-   ret = -ENOMEM;
-   goto out;
-   }
info-apertures-ranges[0].base = mdev-dev-mode_config.fb_base;
info-apertures-ranges[0].size = mdev-mc.vram_size;
 
@@ -249,17 +236,10 @@ out:
 static int mga_fbdev_destroy(struct drm_device *dev,
struct mga_fbdev *mfbdev)
 {
-   struct fb_info *info;
struct mga_framebuffer *mfb = mfbdev-mfb;
 
-   if (mfbdev-helper.fbdev) {
-   info = mfbdev-helper.fbdev;
-
-   unregister_framebuffer(info);
-   if (info-cmap.len)
-   fb_dealloc_cmap(info-cmap);
-   framebuffer_release(info);
-   }
+   drm_fb_helper_unregister_fbi(mfbdev-helper);
+   drm_fb_helper_release_fbi(mfbdev-helper);
 
if (mfb-obj) {
drm_gem_object_unreference_unlocked(mfb-obj);
diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c 
b/drivers/gpu/drm/mgag200/mgag200_main.c
index f6b283b..b435d3c 100644
--- a/drivers/gpu/drm/mgag200/mgag200_main.c
+++ b/drivers/gpu/drm/mgag200/mgag200_main.c
@@ -128,7 +128,7 @@ static int mga_vram_init(struct mga_device *mdev)
aper-ranges[0].base = mdev-mc.vram_base;
aper-ranges[0].size = mdev-mc.vram_window;
 
-   remove_conflicting_framebuffers(aper, mgafb, true);
+   drm_fb_helper_remove_conflicting_framebuffers(aper, mgafb, true);
kfree(aper);
 
if (!devm_request_mem_region(mdev-dev-dev, mdev

[PATCH 10/25] drm/ast: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

Cleaned up the error handling in astfb_create a bit.

COMPILE TESTED ONLY.

Cc: David Airlie airl...@linux.ie
Cc: Y.C. Chen yc_c...@aspeedtech.com
Cc: Alex Deucher alexander.deuc...@amd.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/ast/ast_fb.c | 47 
 1 file changed, 17 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index ff68eef..637a784 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -125,7 +125,7 @@ static void ast_fillrect(struct fb_info *info,
 const struct fb_fillrect *rect)
 {
struct ast_fbdev *afbdev = info-par;
-   sys_fillrect(info, rect);
+   drm_fb_helper_sys_fillrect(info, rect);
ast_dirty_update(afbdev, rect-dx, rect-dy, rect-width,
 rect-height);
 }
@@ -134,7 +134,7 @@ static void ast_copyarea(struct fb_info *info,
 const struct fb_copyarea *area)
 {
struct ast_fbdev *afbdev = info-par;
-   sys_copyarea(info, area);
+   drm_fb_helper_sys_copyarea(info, area);
ast_dirty_update(afbdev, area-dx, area-dy, area-width,
 area-height);
 }
@@ -143,7 +143,7 @@ static void ast_imageblit(struct fb_info *info,
  const struct fb_image *image)
 {
struct ast_fbdev *afbdev = info-par;
-   sys_imageblit(info, image);
+   drm_fb_helper_sys_imageblit(info, image);
ast_dirty_update(afbdev, image-dx, image-dy, image-width,
 image-height);
 }
@@ -217,40 +217,28 @@ static int astfb_create(struct drm_fb_helper *helper,
if (!sysram)
return -ENOMEM;
 
-   info = framebuffer_alloc(0, device);
-   if (!info) {
-   ret = -ENOMEM;
-   goto out;
+   info = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(info)) {
+   ret = PTR_ERR(info);
+   goto err_free_vram;
}
info-par = afbdev;
 
ret = ast_framebuffer_init(dev, afbdev-afb, mode_cmd, gobj);
if (ret)
-   goto out;
+   goto err_release_fbi;
 
afbdev-sysram = sysram;
afbdev-size = size;
 
fb = afbdev-afb.base;
afbdev-helper.fb = fb;
-   afbdev-helper.fbdev = info;
 
strcpy(info-fix.id, astdrmfb);
 
info-flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
info-fbops = astfb_ops;
 
-   ret = fb_alloc_cmap(info-cmap, 256, 0);
-   if (ret) {
-   ret = -ENOMEM;
-   goto out;
-   }
-
-   info-apertures = alloc_apertures(1);
-   if (!info-apertures) {
-   ret = -ENOMEM;
-   goto out;
-   }
info-apertures-ranges[0].base = pci_resource_start(dev-pdev, 0);
info-apertures-ranges[0].size = pci_resource_len(dev-pdev, 0);
 
@@ -266,7 +254,11 @@ static int astfb_create(struct drm_fb_helper *helper,
  fb-width, fb-height);
 
return 0;
-out:
+
+err_release_fbi:
+   drm_fb_helper_release_fbi(helper);
+err_free_vram:
+   vfree(afbdev-sysram);
return ret;
 }
 
@@ -297,15 +289,10 @@ static const struct drm_fb_helper_funcs 
ast_fb_helper_funcs = {
 static void ast_fbdev_destroy(struct drm_device *dev,
  struct ast_fbdev *afbdev)
 {
-   struct fb_info *info;
struct ast_framebuffer *afb = afbdev-afb;
-   if (afbdev-helper.fbdev) {
-   info = afbdev-helper.fbdev;
-   unregister_framebuffer(info);
-   if (info-cmap.len)
-   fb_dealloc_cmap(info-cmap);
-   framebuffer_release(info);
-   }
+
+   drm_fb_helper_unregister_fbi(afbdev-helper);
+   drm_fb_helper_release_fbi(afbdev-helper);
 
if (afb-obj) {
drm_gem_object_unreference_unlocked(afb-obj);
@@ -377,5 +364,5 @@ void ast_fbdev_set_suspend(struct drm_device *dev, int 
state)
if (!ast-fbdev)
return;
 
-   fb_set_suspend(ast-fbdev-helper.fbdev, state);
+   drm_fb_helper_set_suspend(ast-fbdev-helper, state);
 }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH 17/25] drm/radeon: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

COMPILE TESTED ONLY.

Cc: Alex Deucher alexander.deuc...@amd.com
Cc: Christian König christian.koe...@amd.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/radeon/radeon_drv.c |  4 +++-
 drivers/gpu/drm/radeon/radeon_fb.c  | 41 +++--
 2 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 5751446..98ee541 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -39,6 +39,7 @@
 #include linux/pm_runtime.h
 #include linux/vga_switcheroo.h
 #include drm/drm_gem.h
+#include drm/drm_fb_helper.h
 
 #include drm_crtc_helper.h
 #include radeon_kfd.h
@@ -390,7 +391,8 @@ static int radeon_kick_out_firmware_fb(struct pci_dev *pdev)
 #ifdef CONFIG_X86
primary = pdev-resource[PCI_ROM_RESOURCE].flags  
IORESOURCE_ROM_SHADOW;
 #endif
-   remove_conflicting_framebuffers(ap, radeondrmfb, primary);
+   drm_fb_helper_remove_conflicting_framebuffers(ap, radeondrmfb,
+   primary);
kfree(ap);
 
return 0;
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c 
b/drivers/gpu/drm/radeon/radeon_fb.c
index 634793e..8d6a834 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -82,9 +82,9 @@ static struct fb_ops radeonfb_ops = {
.owner = THIS_MODULE,
.fb_check_var = drm_fb_helper_check_var,
.fb_set_par = radeon_fb_helper_set_par,
-   .fb_fillrect = cfb_fillrect,
-   .fb_copyarea = cfb_copyarea,
-   .fb_imageblit = cfb_imageblit,
+   .fb_fillrect = drm_fb_helper_cfb_fillrect,
+   .fb_copyarea = drm_fb_helper_cfb_copyarea,
+   .fb_imageblit = drm_fb_helper_cfb_imageblit,
.fb_pan_display = drm_fb_helper_pan_display,
.fb_blank = drm_fb_helper_blank,
.fb_setcmap = drm_fb_helper_setcmap,
@@ -250,9 +250,9 @@ static int radeonfb_create(struct drm_fb_helper *helper,
rbo = gem_to_radeon_bo(gobj);
 
/* okay we have an object now allocate the framebuffer */
-   info = framebuffer_alloc(0, device);
-   if (info == NULL) {
-   ret = -ENOMEM;
+   info = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(info)) {
+   ret = PTR_ERR(info);
goto out_unref;
}
 
@@ -261,14 +261,13 @@ static int radeonfb_create(struct drm_fb_helper *helper,
ret = radeon_framebuffer_init(rdev-ddev, rfbdev-rfb, mode_cmd, 
gobj);
if (ret) {
DRM_ERROR(failed to initialize framebuffer %d\n, ret);
-   goto out_unref;
+   goto out_destroy_fbi;
}
 
fb = rfbdev-rfb.base;
 
/* setup helper */
rfbdev-helper.fb = fb;
-   rfbdev-helper.fbdev = info;
 
memset_io(rbo-kptr, 0x0, radeon_bo_size(rbo));
 
@@ -288,11 +287,6 @@ static int radeonfb_create(struct drm_fb_helper *helper,
drm_fb_helper_fill_var(info, rfbdev-helper, sizes-fb_width, 
sizes-fb_height);
 
/* setup aperture base/size for vesafb takeover */
-   info-apertures = alloc_apertures(1);
-   if (!info-apertures) {
-   ret = -ENOMEM;
-   goto out_unref;
-   }
info-apertures-ranges[0].base = rdev-ddev-mode_config.fb_base;
info-apertures-ranges[0].size = rdev-mc.aper_size;
 
@@ -300,13 +294,7 @@ static int radeonfb_create(struct drm_fb_helper *helper,
 
if (info-screen_base == NULL) {
ret = -ENOSPC;
-   goto out_unref;
-   }
-
-   ret = fb_alloc_cmap(info-cmap, 256, 0);
-   if (ret) {
-   ret = -ENOMEM;
-   goto out_unref;
+   goto out_destroy_fbi;
}
 
DRM_INFO(fb mappable at 0x%lX\n,  info-fix.smem_start);
@@ -318,6 +306,8 @@ static int radeonfb_create(struct drm_fb_helper *helper,
vga_switcheroo_client_fb_set(rdev-ddev-pdev, info);
return 0;
 
+out_destroy_fbi:
+   drm_fb_helper_release_fbi(helper);
 out_unref:
if (rbo) {
 
@@ -338,17 +328,10 @@ void radeon_fb_output_poll_changed(struct radeon_device 
*rdev)
 
 static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev 
*rfbdev)
 {
-   struct fb_info *info;
struct radeon_framebuffer *rfb = rfbdev-rfb;
 
-   if (rfbdev-helper.fbdev) {
-   info = rfbdev-helper.fbdev;
-
-   unregister_framebuffer(info);
-   if (info-cmap.len)
-   fb_dealloc_cmap(info-cmap);
-   framebuffer_release(info);
-   }
+   drm_fb_helper_unregister_fbi(rfbdev-helper);
+   drm_fb_helper_release_fbi(rfbdev-helper);
 
if (rfb-obj) {
radeonfb_destroy_pinned_object(rfb-obj);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code

[PATCH 23/25] drm/amdgpu: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

COMPILE TESTED ONLY.

Cc: Alex Deucher alexander.deuc...@amd.com
Cc: Oded Gabbay oded.gab...@gmail.com
Cc: Christian König christian.koe...@amd.com
Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  4 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c  | 43 +++--
 2 files changed, 17 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 56da962..52d7cfd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -35,6 +35,7 @@
 #include amdgpu_drv.h
 
 #include drm/drm_pciids.h
+#include drm/drm_fb_helper.h
 #include linux/console.h
 #include linux/module.h
 #include linux/pm_runtime.h
@@ -267,7 +268,8 @@ static int amdgpu_kick_out_firmware_fb(struct pci_dev *pdev)
 #ifdef CONFIG_X86
primary = pdev-resource[PCI_ROM_RESOURCE].flags  
IORESOURCE_ROM_SHADOW;
 #endif
-   remove_conflicting_framebuffers(ap, amdgpudrmfb, primary);
+   drm_fb_helper_remove_conflicting_framebuffers(ap, amdgpudrmfb,
+   primary);
kfree(ap);
 
return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index c1645d2..f49fdc2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -53,9 +53,9 @@ static struct fb_ops amdgpufb_ops = {
.owner = THIS_MODULE,
.fb_check_var = drm_fb_helper_check_var,
.fb_set_par = drm_fb_helper_set_par,
-   .fb_fillrect = cfb_fillrect,
-   .fb_copyarea = cfb_copyarea,
-   .fb_imageblit = cfb_imageblit,
+   .fb_fillrect = drm_fb_helper_cfb_fillrect,
+   .fb_copyarea = drm_fb_helper_cfb_copyarea,
+   .fb_imageblit = drm_fb_helper_cfb_imageblit,
.fb_pan_display = drm_fb_helper_pan_display,
.fb_blank = drm_fb_helper_blank,
.fb_setcmap = drm_fb_helper_setcmap,
@@ -201,9 +201,9 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
rbo = gem_to_amdgpu_bo(gobj);
 
/* okay we have an object now allocate the framebuffer */
-   info = framebuffer_alloc(0, device);
-   if (info == NULL) {
-   ret = -ENOMEM;
+   info = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(info)) {
+   ret = PTR_ERR(ret);
goto out_unref;
}
 
@@ -212,14 +212,13 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
ret = amdgpu_framebuffer_init(adev-ddev, rfbdev-rfb, mode_cmd, 
gobj);
if (ret) {
DRM_ERROR(failed to initialize framebuffer %d\n, ret);
-   goto out_unref;
+   goto out_destroy_fbi;
}
 
fb = rfbdev-rfb.base;
 
/* setup helper */
rfbdev-helper.fb = fb;
-   rfbdev-helper.fbdev = info;
 
memset_io(rbo-kptr, 0x0, amdgpu_bo_size(rbo));
 
@@ -239,11 +238,6 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
drm_fb_helper_fill_var(info, rfbdev-helper, sizes-fb_width, 
sizes-fb_height);
 
/* setup aperture base/size for vesafb takeover */
-   info-apertures = alloc_apertures(1);
-   if (!info-apertures) {
-   ret = -ENOMEM;
-   goto out_unref;
-   }
info-apertures-ranges[0].base = adev-ddev-mode_config.fb_base;
info-apertures-ranges[0].size = adev-mc.aper_size;
 
@@ -251,13 +245,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 
if (info-screen_base == NULL) {
ret = -ENOSPC;
-   goto out_unref;
-   }
-
-   ret = fb_alloc_cmap(info-cmap, 256, 0);
-   if (ret) {
-   ret = -ENOMEM;
-   goto out_unref;
+   goto out_destroy_fbi;
}
 
DRM_INFO(fb mappable at 0x%lX\n,  info-fix.smem_start);
@@ -269,6 +257,8 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
vga_switcheroo_client_fb_set(adev-ddev-pdev, info);
return 0;
 
+out_destroy_fbi:
+   drm_fb_helper_release_fbi(helper);
 out_unref:
if (rbo) {
 
@@ -293,14 +283,8 @@ static int amdgpu_fbdev_destroy(struct drm_device *dev, 
struct amdgpu_fbdev *rfb
struct fb_info *info;
struct amdgpu_framebuffer *rfb = rfbdev-rfb;
 
-   if (rfbdev-helper.fbdev) {
-   info = rfbdev-helper.fbdev;
-
-   unregister_framebuffer(info);
-   if (info-cmap.len)
-   fb_dealloc_cmap(info-cmap);
-   framebuffer_release(info);
-   }
+   drm_fb_helper_unregister_fbi(rfbdev-helper);
+   drm_fb_helper_release_fbi(rfbdev-helper);
 
if (rfb-obj) {
amdgpufb_destroy_pinned_object(rfb-obj);
@@ -395,7 +379,8 @@ void amdgpu_fbdev_fini(struct amdgpu_device *adev)
 void

[PATCH 20/25] drm/nouveau: Use new drm_fb_helper functions

2015-07-13 Thread Archit Taneja
Use the newly created wrapper drm_fb_helper functions instead of calling
core fbdev functions directly. They also simplify the fb_info creation.

COMPILE TESTED ONLY.

Cc: David Airlie airl...@linux.ie
Cc: Ben Skeggs bske...@redhat.com
Cc: Alexandre Courbot acour...@nvidia.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/nouveau/nouveau_drm.c   |  3 ++-
 drivers/gpu/drm/nouveau/nouveau_fbcon.c | 38 +++--
 2 files changed, 14 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 649024d..01d3fb2 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -317,7 +317,8 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
boot = pdev-resource[PCI_ROM_RESOURCE].flags  IORESOURCE_ROM_SHADOW;
 #endif
if (nouveau_modeset != 2)
-   remove_conflicting_framebuffers(aper, nouveaufb, boot);
+   drm_fb_helper_remove_conflicting_framebuffers(aper, nouveaufb,
+   boot);
kfree(aper);
 
ret = nvkm_device_create(pdev, NVKM_BUS_PCI,
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c 
b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 6751553..443ea87 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -84,7 +84,7 @@ nouveau_fbcon_fillrect(struct fb_info *info, const struct 
fb_fillrect *rect)
 
if (ret != -ENODEV)
nouveau_fbcon_gpu_lockup(info);
-   cfb_fillrect(info, rect);
+   drm_fb_helper_cfb_fillrect(info, rect);
 }
 
 static void
@@ -116,7 +116,7 @@ nouveau_fbcon_copyarea(struct fb_info *info, const struct 
fb_copyarea *image)
 
if (ret != -ENODEV)
nouveau_fbcon_gpu_lockup(info);
-   cfb_copyarea(info, image);
+   drm_fb_helper_cfb_copyarea(info, image);
 }
 
 static void
@@ -148,7 +148,7 @@ nouveau_fbcon_imageblit(struct fb_info *info, const struct 
fb_image *image)
 
if (ret != -ENODEV)
nouveau_fbcon_gpu_lockup(info);
-   cfb_imageblit(info, image);
+   drm_fb_helper_cfb_imageblit(info, image);
 }
 
 static int
@@ -197,9 +197,9 @@ static struct fb_ops nouveau_fbcon_sw_ops = {
.owner = THIS_MODULE,
.fb_check_var = drm_fb_helper_check_var,
.fb_set_par = drm_fb_helper_set_par,
-   .fb_fillrect = cfb_fillrect,
-   .fb_copyarea = cfb_copyarea,
-   .fb_imageblit = cfb_imageblit,
+   .fb_fillrect = drm_fb_helper_cfb_fillrect,
+   .fb_copyarea = drm_fb_helper_cfb_copyarea,
+   .fb_imageblit = drm_fb_helper_cfb_imageblit,
.fb_pan_display = drm_fb_helper_pan_display,
.fb_blank = drm_fb_helper_blank,
.fb_setcmap = drm_fb_helper_setcmap,
@@ -365,20 +365,13 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
 
mutex_lock(dev-struct_mutex);
 
-   info = framebuffer_alloc(0, pdev-dev);
-   if (!info) {
-   ret = -ENOMEM;
+   info = drm_fb_helper_alloc_fbi(helper);
+   if (IS_ERR(info)) {
+   ret = PTR_ERR(info);
goto out_unlock;
}
info-skip_vt_switch = 1;
 
-   ret = fb_alloc_cmap(info-cmap, 256, 0);
-   if (ret) {
-   ret = -ENOMEM;
-   framebuffer_release(info);
-   goto out_unlock;
-   }
-
info-par = fbcon;
 
nouveau_framebuffer_init(dev, fbcon-nouveau_fb, mode_cmd, nvbo);
@@ -388,7 +381,6 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
 
/* setup helper */
fbcon-helper.fb = fb;
-   fbcon-helper.fbdev = info;
 
strcpy(info-fix.id, nouveaufb);
if (!chan)
@@ -450,15 +442,9 @@ static int
 nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon)
 {
struct nouveau_framebuffer *nouveau_fb = fbcon-nouveau_fb;
-   struct fb_info *info;
 
-   if (fbcon-helper.fbdev) {
-   info = fbcon-helper.fbdev;
-   unregister_framebuffer(info);
-   if (info-cmap.len)
-   fb_dealloc_cmap(info-cmap);
-   framebuffer_release(info);
-   }
+   drm_fb_helper_unregister_fbi(fbcon-helper);
+   drm_fb_helper_release_fbi(fbcon-helper);
 
if (nouveau_fb-nvbo) {
nouveau_bo_unmap(nouveau_fb-nvbo);
@@ -496,7 +482,7 @@ nouveau_fbcon_set_suspend(struct drm_device *dev, int state)
console_lock();
if (state == FBINFO_STATE_RUNNING)
nouveau_fbcon_accel_restore(dev);
-   fb_set_suspend(drm-fbcon-helper.fbdev, state);
+   drm_fb_helper_set_suspend(drm-fbcon-helper, state);
if (state != FBINFO_STATE_RUNNING)
nouveau_fbcon_accel_save_disable(dev);
console_unlock();
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux

[RFC 07/21] drm/gma500: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc:Daniel Vetter daniel.vet...@ffwll.ch
Cc: Patrik Jakobsson patrik.r.jakobs...@gmail.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/gma500/Kconfig | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/gma500/Kconfig b/drivers/gpu/drm/gma500/Kconfig
index 17f928e..8906d67 100644
--- a/drivers/gpu/drm/gma500/Kconfig
+++ b/drivers/gpu/drm/gma500/Kconfig
@@ -1,11 +1,7 @@
 config DRM_GMA500
tristate Intel GMA5/600 KMS Framebuffer
depends on DRM  PCI  X86
-   select FB_CFB_COPYAREA
-   select FB_CFB_FILLRECT
-   select FB_CFB_IMAGEBLIT
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
select DRM_TTM
# GMA500 depends on ACPI_VIDEO when ACPI is enabled, just like i915
select ACPI_VIDEO if ACPI
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 09/21] drm/radeon: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc: Alex Deucher alexander.deuc...@amd.com
Cc: Christian König christian.koe...@amd.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/radeon/Kconfig | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/Kconfig b/drivers/gpu/drm/radeon/Kconfig
index 82c623b..3f1af32 100644
--- a/drivers/gpu/drm/radeon/Kconfig
+++ b/drivers/gpu/drm/radeon/Kconfig
@@ -1,12 +1,8 @@
 config DRM_RADEON
tristate ATI Radeon
depends on DRM  PCI
-   select FB_CFB_FILLRECT
-   select FB_CFB_COPYAREA
-   select FB_CFB_IMAGEBLIT
select FW_LOADER
 select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
 select DRM_TTM
select POWER_SUPPLY
select HWMON
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 08/21] drm/mgag200: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: David Airlie airl...@linux.ie
Cc: Alex Deucher alexander.deuc...@amd.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/mgag200/Kconfig | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/Kconfig b/drivers/gpu/drm/mgag200/Kconfig
index 3a1c5fb..520e5e6 100644
--- a/drivers/gpu/drm/mgag200/Kconfig
+++ b/drivers/gpu/drm/mgag200/Kconfig
@@ -1,11 +1,7 @@
 config DRM_MGAG200
tristate Kernel modesetting driver for MGA G200 server engines
depends on DRM  PCI
-   select FB_SYS_FILLRECT
-   select FB_SYS_COPYAREA
-   select FB_SYS_IMAGEBLIT
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
select DRM_TTM
help
 This is a KMS driver for the MGA G200 server chips, it
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 05/21] drm/omap: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc: Tomi Valkeinen tomi.valkei...@ti.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/omapdrm/Kconfig | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
index 6c220cd..340ece7 100644
--- a/drivers/gpu/drm/omapdrm/Kconfig
+++ b/drivers/gpu/drm/omapdrm/Kconfig
@@ -5,11 +5,6 @@ config DRM_OMAP
depends on ARCH_OMAP2PLUS || ARCH_MULTIPLATFORM
depends on OMAP2_DSS
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
-   select FB_SYS_FILLRECT
-   select FB_SYS_COPYAREA
-   select FB_SYS_IMAGEBLIT
-   select FB_SYS_FOPS
default n
help
  DRM display driver for OMAP2/3/4 based boards.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 04/21] drm/ast: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc: David Airlie airl...@linux.ie
Cc: Y.C. Chen yc_c...@aspeedtech.com
Cc: Alex Deucher alexander.deuc...@amd.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/ast/Kconfig | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/ast/Kconfig b/drivers/gpu/drm/ast/Kconfig
index 8a784c4..15f6ce7 100644
--- a/drivers/gpu/drm/ast/Kconfig
+++ b/drivers/gpu/drm/ast/Kconfig
@@ -2,11 +2,7 @@ config DRM_AST
tristate AST server chips
depends on DRM  PCI
select DRM_TTM
-   select FB_SYS_COPYAREA
-   select FB_SYS_FILLRECT
-   select FB_SYS_IMAGEBLIT
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
select DRM_TTM
help
 Say yes for experimental AST GPU driver. Do not enable
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 01/21] drm/cirrus: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc: Thierry Reding tred...@nvidia.com
Cc: Zach Reizner za...@google.com
Cc: Russell King rmk+ker...@arm.linux.org.uk
Cc: Fabian Frederick f...@skynet.be

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/cirrus/Kconfig | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/Kconfig b/drivers/gpu/drm/cirrus/Kconfig
index 9864559..04b3c16 100644
--- a/drivers/gpu/drm/cirrus/Kconfig
+++ b/drivers/gpu/drm/cirrus/Kconfig
@@ -1,11 +1,7 @@
 config DRM_CIRRUS_QEMU
tristate Cirrus driver for QEMU emulated device
depends on DRM  PCI
-   select FB_SYS_FILLRECT
-   select FB_SYS_COPYAREA
-   select FB_SYS_IMAGEBLIT
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
select DRM_TTM
help
 This is a KMS driver for emulated cirrus device in qemu.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 10/21] drm/qxl: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

The code relying on DEFERRED_IO can't be stubbed out using drm_fb_helper
functions. This is because the deferred io members in fbdev core structs
are defined based on whether FB_DEFERRED_IO is defined or not.

For now, wrap around deferred io code with an #ifdef check for
CONFIG_DEFERRED_IO. We could consider creating stub fb helper functions
here, but this would require some changes in the core fbdev structs.

Cc: David Airlie airl...@linux.ie
Cc: Frediano Ziglio fzig...@redhat.com
Cc: Maarten Lankhorst maarten.lankho...@canonical.com

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/qxl/Kconfig  | 5 -
 drivers/gpu/drm/qxl/qxl_fb.c | 4 
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/qxl/Kconfig b/drivers/gpu/drm/qxl/Kconfig
index 38c2bb7..da45b11 100644
--- a/drivers/gpu/drm/qxl/Kconfig
+++ b/drivers/gpu/drm/qxl/Kconfig
@@ -1,12 +1,7 @@
 config DRM_QXL
tristate QXL virtual GPU
depends on DRM  PCI
-   select FB_SYS_FILLRECT
-   select FB_SYS_COPYAREA
-   select FB_SYS_IMAGEBLIT
-   select FB_DEFERRED_IO
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
select DRM_TTM
select CRC32
help
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 41c422f..9391dfe 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -163,6 +163,7 @@ static void qxl_dirty_update(struct qxl_fbdev *qfbdev,
schedule_work(qdev-fb_work);
 }
 
+#ifdef CONFIG_FB_DEFERRED_IO
 static void qxl_deferred_io(struct fb_info *info,
struct list_head *pagelist)
 {
@@ -191,6 +192,7 @@ static struct fb_deferred_io qxl_defio = {
.delay  = QXL_DIRTY_DELAY,
.deferred_io= qxl_deferred_io,
 };
+#endif
 
 static void qxl_fb_fillrect(struct fb_info *info,
const struct fb_fillrect *rect)
@@ -420,8 +422,10 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
goto out_destroy_fbi;
}
 
+#ifdef CONFIG_FB_DEFERRED_IO
info-fbdefio = qxl_defio;
fb_deferred_io_init(info);
+#endif
 
qdev-fbdev_info = info;
qdev-fbdev_qfb = qfbdev-qfb;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 02/21] drm/rockchip: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Archit Taneja
Remove FB_* config options since the driver doesn't call any fbdev
functions directly.

Remove FB_KMS_HELPER as this would now be selected by the top level
FBDEV_EMULATION config option. If the fbdev emulation isn't selected,
the drm_fb_helper functions will be stubbed out.

Cc: Mark Yao mark@rock-chips.com
Cc: Daniel Vetter dan...@ffwll.ch
Cc: Rob Clark robdcl...@gmail.com
Cc: Daniel Kurtz djku...@chromium.org

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/gpu/drm/rockchip/Kconfig | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index 35215f6..65d5fdd 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -3,11 +3,7 @@ config DRM_ROCKCHIP
depends on DRM  ROCKCHIP_IOMMU
depends on RESET_CONTROLLER
select DRM_KMS_HELPER
-   select DRM_KMS_FB_HELPER
select DRM_PANEL
-   select FB_CFB_FILLRECT
-   select FB_CFB_COPYAREA
-   select FB_CFB_IMAGEBLIT
select VIDEOMODE_HELPERS
help
  Choose this option if you have a Rockchip soc chipset.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[RFC 00/21] drm: fb emulation: Step 3: Remove FB_KMS_HELPER config from drivers

2015-07-13 Thread Archit Taneja
With the top level DRM_FBDEV_EMULATION option, drivers don't need to
select DRM_FB_KMS_HELPER or other FB related config options in the
driver.

Even if FBDEV_EMULATION isn't select, the stubbed out versions of
the drm_fb_helper functions will be called.

There are some drivers which still need some FB stuff even after
these changes. They are qxl, udl and nouveau. These are handled a bit
differently compared to the other patches.

Archit Taneja (21):
  drm/cirrus: Remove FB_KMS_HELPER and FB related config options
  drm/rockchip: Remove FB_KMS_HELPER and FB related config options
  drm/armada: Remove FB_KMS_HELPER and FB related config options
  drm/ast: Remove FB_KMS_HELPER and FB related config options
  drm/omap: Remove FB_KMS_HELPER and FB related config options
  drm/exynos: Remove FB_KMS_HELPER and FB related config options
  drm/gma500: Remove FB_KMS_HELPER and FB related config options
  drm/mgag200: Remove FB_KMS_HELPER and FB related config options
  drm/radeon: Remove FB_KMS_HELPER and FB related config options
  drm/qxl: Remove FB_KMS_HELPER and FB related config options
  drm/nouveau: Remove FB_KMS_HELPER and FB related config options
  drm/udl: Remove FB_KMS_HELPER and FB related config options
  drm/bochs: Remove FB_KMS_HELPER and FB related config options
  drm/amdgpu: Remove FB_KMS_HELPER and FB related config options
  drm/virtio: Remove FB_KMS_HELPER and FB related config options
  drm/fb_cma_helper: Remove FB_KMS_HELPER and FB related config options
  drm/atmel-hlcdc: Remove FB_KMS_HELPER config option
  drm/imx: Remove FB_KMS_HELPER config option
  drm/rcar-du: Remove FB_KMS_HELPER config option
  drm/shmobile: Remove FB_KMS_HELPER config option
  drm/tilcdc: Remove FB_KMS_HELPER config option

 drivers/gpu/drm/Kconfig |  4 
 drivers/gpu/drm/amd/amdgpu/Kconfig  |  4 
 drivers/gpu/drm/armada/Kconfig  |  4 
 drivers/gpu/drm/ast/Kconfig |  4 
 drivers/gpu/drm/atmel-hlcdc/Kconfig |  1 -
 drivers/gpu/drm/bochs/Kconfig   |  4 
 drivers/gpu/drm/cirrus/Kconfig  |  4 
 drivers/gpu/drm/exynos/Kconfig  |  6 --
 drivers/gpu/drm/gma500/Kconfig  |  4 
 drivers/gpu/drm/imx/Kconfig |  1 -
 drivers/gpu/drm/mgag200/Kconfig |  4 
 drivers/gpu/drm/nouveau/Kconfig |  7 +--
 drivers/gpu/drm/omapdrm/Kconfig |  5 -
 drivers/gpu/drm/qxl/Kconfig |  5 -
 drivers/gpu/drm/qxl/qxl_fb.c|  4 
 drivers/gpu/drm/radeon/Kconfig  |  4 
 drivers/gpu/drm/rcar-du/Kconfig |  1 -
 drivers/gpu/drm/rockchip/Kconfig|  4 
 drivers/gpu/drm/shmobile/Kconfig|  1 -
 drivers/gpu/drm/tilcdc/Kconfig  |  1 -
 drivers/gpu/drm/udl/Kconfig |  5 -
 drivers/gpu/drm/udl/udl_fb.c| 10 ++
 drivers/gpu/drm/virtio/Kconfig  |  4 
 23 files changed, 15 insertions(+), 76 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH v2 3/5] dt/bindings: qcom_nandc: Add DT bindings

2015-07-21 Thread Archit Taneja
Add DT bindings document for the Qualcomm NAND controller driver.

Cc: devicet...@vger.kernel.org

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 .../devicetree/bindings/mtd/qcom_nandc.txt | 48 ++
 1 file changed, 48 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/qcom_nandc.txt

diff --git a/Documentation/devicetree/bindings/mtd/qcom_nandc.txt 
b/Documentation/devicetree/bindings/mtd/qcom_nandc.txt
new file mode 100644
index 000..e24c77a
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/qcom_nandc.txt
@@ -0,0 +1,48 @@
+* Qualcomm NAND controller
+
+Required properties:
+- compatible:  should be qcom,ebi2-nand for IPQ806x
+- reg: MMIO address range
+- clocks:  must contain core clock and always on clock
+- clock-names: must contain core for the core clock and aon for the
+   always on clock
+- dmas:DMA specifier, consisting of a phandle to the 
ADM DMA
+   controller node and the channel number to be used for
+   NAND. Refer to dma.txt and qcom_adm.txt for more details
+- dma-names:   must be rxtx
+- qcom,cmd-crci:   must contain the ADM command type CRCI block instance
+   number specified for the NAND controller on the given
+   platform
+- qcom,data-crci:  must contain the ADM data type CRCI block instance
+   number specified for the NAND controller on the given
+   platform
+
+Optional properties:
+- nand-bus-width:  bus width. Must be 8 or 16. If not present, 8 is chosen
+   as default
+
+- nand-ecc-strength:   number of bits to correct per ECC step. Must be 4 or 8
+   bits. If not present, 4 is chosen as default
+
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
+
+Example:
+
+nand@0x1ac0 {
+   compatible = qcom,ebi2-nandc;
+   reg = 0x1ac0 0x800;
+
+   clocks = gcc EBI2_CLK,
+gcc EBI2_AON_CLK;
+   clock-names = core, aon;
+
+   dmas = adm_dma 3;
+   dma-names = rxtx;
+   qcom,cmd-crci = 15;
+   qcom,data-crci = 3;
+
+   partition@0 {
+   ...
+   };
+};
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH v2 2/5] mtd: nand: Qualcomm NAND controller driver

2015-07-21 Thread Archit Taneja
The Qualcomm NAND controller is found in SoCs like IPQ806x, MSM7xx,
MDM9x15 series.

It exists as a sub block inside the IPs EBI2 (External Bus Interface 2)
and QPIC (Qualcomm Parallel Interface Controller). These IPs provide a
broader interface for external slow peripheral devices such as LCD and
NAND/NOR flash memory or SRAM like interfaces.

We add support for the NAND controller found within EBI2. For the SoCs
of our interest, we only use the NAND controller within EBI2. Therefore,
it's safe for us to assume that the NAND controller is a standalone block
within the SoC.

The controller supports 512B, 2kB, 4kB and 8kB page 8-bit and 16-bit NAND
flash devices. It contains a HW ECC block that supports BCH ECC (4, 8 and
16 bit correction/step) and RS ECC(4 bit correction/step) that covers main
and spare data. The controller contains an internal 512 byte page buffer
to which we read/write via DMA. The EBI2 type NAND controller uses ADM DMA
for register read/write and data transfers. The controller performs page
reads and writes at a codeword/step level of 512 bytes. It can support up
to 2 external chips of different configurations.

The driver prepares register read and write configuration descriptors for
each codeword, followed by data descriptors to read or write data from the
controller's internal buffer. It uses a single ADM DMA channel that we get
via dmaengine API. The controller requires 2 ADM CRCIs for command and
data flow control. These are passed via DT.

The ecc layout used by the controller is syndrome like, but we can't use
the standard syndrome ecc ops because of several reasons. First, the amount
of data bytes covered by ecc isn't same in each step. Second, writing to
free oob space requires us writing to the entire step in which the oob
lies. This forces us to create our own ecc ops.

One more difference is how the controller accesses the bad block marker.
The controller ignores reading the marker when ECC is enabled. ECC needs
to be explicity disabled to read or write to the bad block marker. For
this reason, we use the newly created flag NAND_BBT_ACCESS_BBM_RAW to
read the factory provided bad block markers.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/mtd/nand/Kconfig  |7 +
 drivers/mtd/nand/Makefile |1 +
 drivers/mtd/nand/qcom_nandc.c | 2019 +
 3 files changed, 2027 insertions(+)
 create mode 100644 drivers/mtd/nand/qcom_nandc.c

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 5b2806a..31951fc 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -538,4 +538,11 @@ config MTD_NAND_HISI504
help
  Enables support for NAND controller on Hisilicon SoC Hip04.
 
+config MTD_NAND_QCOM
+   tristate Support for NAND on QCOM SoCs
+   depends on ARCH_QCOM  QCOM_ADM
+   help
+ Enables support for NAND flash chips on SoCs containing the EBI2 NAND
+ controller. This controller is found on IPQ806x SoC.
+
 endif # MTD_NAND
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 1f897ec..87b6a1d 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -53,5 +53,6 @@ obj-$(CONFIG_MTD_NAND_BCM47XXNFLASH)  += bcm47xxnflash/
 obj-$(CONFIG_MTD_NAND_SUNXI)   += sunxi_nand.o
 obj-$(CONFIG_MTD_NAND_HISI504) += hisi504_nand.o
 obj-$(CONFIG_MTD_NAND_BRCMNAND)+= brcmnand/
+obj-$(CONFIG_MTD_NAND_QCOM)+= qcom_nandc.o
 
 nand-objs := nand_base.o nand_bbt.o nand_timings.o
diff --git a/drivers/mtd/nand/qcom_nandc.c b/drivers/mtd/nand/qcom_nandc.c
new file mode 100644
index 000..51c284c
--- /dev/null
+++ b/drivers/mtd/nand/qcom_nandc.c
@@ -0,0 +1,2019 @@
+/*
+ * Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/clk.h
+#include linux/slab.h
+#include linux/interrupt.h
+#include linux/bitops.h
+#include linux/dma-mapping.h
+#include linux/dmaengine.h
+#include linux/module.h
+#include linux/mtd/nand.h
+#include linux/mtd/partitions.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/of_mtd.h
+#include linux/delay.h
+
+/* NANDc reg offsets */
+#define NAND_FLASH_CMD 0x00
+#define NAND_ADDR0 0x04
+#define NAND_ADDR1 0x08
+#define NAND_FLASH_CHIP_SELECT 0x0c
+#define NAND_EXEC_CMD  0x10
+#define NAND_FLASH_STATUS  0x14
+#define NAND_BUFFER_STATUS 0x18
+#define NAND_DEV0_CFG0

[PATCH v2 5/5] arm: qcom: dts: Enale NAND node on IPQ8064 AP148 platform

2015-07-21 Thread Archit Taneja
Enable the NAND controller node on the AP148 platform. Provide pinmux
information.

Cc: devicet...@vger.kernel.org
Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 arch/arm/boot/dts/qcom-ipq8064-ap148.dts | 36 
 1 file changed, 36 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-ipq8064-ap148.dts 
b/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
index 7f9ea50..03fd6b7 100644
--- a/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
+++ b/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
@@ -30,6 +30,28 @@
bias-none;
};
};
+   nand_pins: nand_pins {
+   mux {
+   pins = gpio34, gpio35, gpio36,
+  gpio37, gpio38, gpio39,
+  gpio40, gpio41, gpio42,
+  gpio43, gpio44, gpio45,
+  gpio46, gpio47;
+   function = nand;
+   drive-strength = 10;
+   bias-disable;
+   };
+   pullups {
+   pins = gpio39;
+   bias-pull-up;
+   };
+   hold {
+   pins = gpio40, gpio41, gpio42,
+  gpio43, gpio44, gpio45,
+  gpio46, gpio47;
+   bias-bus-hold;
+   };
+   };
};
 
gsbi@1630 {
@@ -93,5 +115,19 @@
sata@2900 {
status = ok;
};
+
+   nand@0x1ac0 {
+   status = ok;
+
+   pinctrl-0 = nand_pins;
+   pinctrl-names = default;
+
+   nand-ecc-strength = 4;
+   nand-bus-width = 8;
+   };
};
 };
+
+adm_dma {
+   status = ok;
+};
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH v2 4/5] arm: qcom: dts: Add NAND controller node for ipq806x

2015-07-21 Thread Archit Taneja
The nand controller in IPQ806x is of the 'EBI2 type'. Use the corresponding
compatible string.

Cc: devicet...@vger.kernel.org
Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 arch/arm/boot/dts/qcom-ipq8064.dtsi | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi 
b/arch/arm/boot/dts/qcom-ipq8064.dtsi
index 1e1b3f0..08dc2ef 100644
--- a/arch/arm/boot/dts/qcom-ipq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi
@@ -350,5 +350,20 @@
status = disabled;
};
 
+   nand@0x1ac0 {
+   compatible = qcom,ebi2-nandc;
+   reg = 0x1ac0 0x800;
+
+   clocks = gcc EBI2_CLK,
+gcc EBI2_AON_CLK;
+   clock-names = core, aon;
+
+   dmas = adm_dma 3;
+   dma-names = rxtx;
+   qcom,cmd-crci = 15;
+   qcom,data-crci = 3;
+
+   status = disabled;
+   };
};
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH v2 0/5] mtd: Qualcomm NAND controller driver

2015-07-21 Thread Archit Taneja
Add support for the NAND controller driver for SoC's that contain EBI2.
For now, the only SoC upstream that has EBI2 is IPQ806x.

The original version was posted a while back. The main comments were
about the driver not being able to use nand_bbt. This was because the
controller could read factory bad block markers only in RAW mode. This
forced us to implement our own versions of chip-block_bad and
chip-blobk_markbad, and also we had to skip creating a BBT.

Discussions with Kevin Cernekee concluded that having a new BBT flag
that incorporates this controller's special requirement is a possible
option.

The new version makes use of this flag and now uses nand_bbt, at the
cost of implement read_oob_raw and write_oob_raw ops.

The patchset requires the v6 ADM dmaengine patches posted by Andy:

https://lkml.org/lkml/2015/3/17/19

v1:
- original series:
  https://lkml.org/lkml/2015/1/16/317

v2:
- Added a new BBT flag that allows us to read BBM in raw mode
- reduce memcpy-s in the driver
- some refactor and clean ups because of above changes


Archit Taneja (5):
  mtd: nand: Create a BBT flag to access bad block markers in raw mode
  mtd: nand: Qualcomm NAND controller driver
  dt/bindings: qcom_nandc: Add DT bindings
  arm: qcom: dts: Add NAND controller node for ipq806x
  arm: qcom: dts: Enale NAND node on IPQ8064 AP148 platform

 .../devicetree/bindings/mtd/qcom_nandc.txt |   48 +
 arch/arm/boot/dts/qcom-ipq8064-ap148.dts   |   36 +
 arch/arm/boot/dts/qcom-ipq8064.dtsi|   15 +
 drivers/mtd/nand/Kconfig   |7 +
 drivers/mtd/nand/Makefile  |1 +
 drivers/mtd/nand/nand_base.c   |6 +-
 drivers/mtd/nand/nand_bbt.c|6 +-
 drivers/mtd/nand/qcom_nandc.c  | 2019 
 include/linux/mtd/bbm.h|7 +
 9 files changed, 2143 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/qcom_nandc.txt
 create mode 100644 drivers/mtd/nand/qcom_nandc.c

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH v2 1/5] mtd: nand: Create a BBT flag to access bad block markers in raw mode

2015-07-21 Thread Archit Taneja
Some controllers can access the factory bad block marker from OOB only
when they read it in raw mode. When ECC is enabled, these controllers
discard reading/writing bad block markers, preventing access to them
altogether.

The bbt driver assumes MTD_OPS_PLACE_OOB when scanning for bad blocks.
This results in the nand driver's ecc-read_oob() op to be called, which
works with ECC enabled.

Create a new BBT option flag that tells nand_bbt to force the mode to
MTD_OPS_RAW. This would result in the correct op being called for the
underlying nand controller driver.

Signed-off-by: Archit Taneja arch...@codeaurora.org
---
 drivers/mtd/nand/nand_base.c | 6 +-
 drivers/mtd/nand/nand_bbt.c  | 6 +-
 include/linux/mtd/bbm.h  | 7 +++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ceb68ca..0a0c524 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -394,7 +394,11 @@ static int nand_default_block_markbad(struct mtd_info 
*mtd, loff_t ofs)
} else {
ops.len = ops.ooblen = 1;
}
-   ops.mode = MTD_OPS_PLACE_OOB;
+
+   if (unlikely(chip-bbt_options  NAND_BBT_ACCESS_BBM_RAW))
+   ops.mode = MTD_OPS_RAW;
+   else
+   ops.mode = MTD_OPS_PLACE_OOB;
 
/* Write to first/last page(s) if necessary */
if (chip-bbt_options  NAND_BBT_SCANLASTPAGE)
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 63a1a36..f2d89c9 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -420,7 +420,11 @@ static int scan_block_fast(struct mtd_info *mtd, struct 
nand_bbt_descr *bd,
ops.oobbuf = buf;
ops.ooboffs = 0;
ops.datbuf = NULL;
-   ops.mode = MTD_OPS_PLACE_OOB;
+
+   if (unlikely(bd-options  NAND_BBT_ACCESS_BBM_RAW))
+   ops.mode = MTD_OPS_RAW;
+   else
+   ops.mode = MTD_OPS_PLACE_OOB;
 
for (j = 0; j  numpages; j++) {
/*
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 36bb6a5..f67f84a 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -116,6 +116,13 @@ struct nand_bbt_descr {
 #define NAND_BBT_NO_OOB_BBM0x0008
 
 /*
+ * Force MTD_OPS_RAW mode when trying to access bad block markes from OOB. To
+ * be used by controllers which can access BBM only when ECC is disabled, i.e,
+ * when in RAW access mode
+ */
+#define NAND_BBT_ACCESS_BBM_RAW0x0010
+
+/*
  * Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr
  * was allocated dynamicaly and must be freed in nand_release(). Has no meaning
  * in nand_chip.bbt_options.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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


[PATCH] drm/msm/mdp5: high precision vblank timestamp support

2015-10-26 Thread Archit Taneja
MDP5 has line count and frame count registers for each interface. Enable
these counters and use them to implement the get_vblank_timestamp drm
driver op.

The line counter starts with the value 1 at the beginning of the VSYNC
pulse and ends with value VTOTAL at the end of VFP. This value is used
to determine whether we're in blanking period or not, and an adjusted
value of this counter is used to get vpos as expected by
get_scanout_position. Since there is no way to calculate hpos, we always
set it to 0.

Signed-off-by: Archit Taneja <arch...@codeaurora.org>
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c |  18 
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 129 
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h |   2 +
 3 files changed, 149 insertions(+)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
index c9e32b0..a019656 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
@@ -293,6 +293,24 @@ static const struct drm_encoder_helper_funcs 
mdp5_encoder_helper_funcs = {
.enable = mdp5_encoder_enable,
 };
 
+int mdp5_encoder_get_linecount(struct drm_encoder *encoder)
+{
+   struct mdp5_encoder *mdp5_encoder = to_mdp5_encoder(encoder);
+   struct mdp5_kms *mdp5_kms = get_kms(encoder);
+   int intf = mdp5_encoder->intf.num;
+
+   return mdp5_read(mdp5_kms, REG_MDP5_INTF_LINE_COUNT(intf));
+}
+
+u32 mdp5_encoder_get_framecount(struct drm_encoder *encoder)
+{
+   struct mdp5_encoder *mdp5_encoder = to_mdp5_encoder(encoder);
+   struct mdp5_kms *mdp5_kms = get_kms(encoder);
+   int intf = mdp5_encoder->intf.num;
+
+   return mdp5_read(mdp5_kms, REG_MDP5_INTF_FRAME_COUNT(intf));
+}
+
 int mdp5_encoder_set_split_display(struct drm_encoder *encoder,
struct drm_encoder *slave_encoder)
 {
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
index b532faa..e115318 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
@@ -468,6 +468,127 @@ static int get_clk(struct platform_device *pdev, struct 
clk **clkp,
return 0;
 }
 
+static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
+{
+   struct drm_device *dev = crtc->dev;
+   struct drm_encoder *encoder;
+
+   drm_for_each_encoder(encoder, dev)
+   if (encoder->crtc == crtc)
+   return encoder;
+
+   return NULL;
+}
+
+static int mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,
+  unsigned int flags, int *vpos, int *hpos,
+  ktime_t *stime, ktime_t *etime,
+  const struct drm_display_mode *mode)
+{
+   struct msm_drm_private *priv = dev->dev_private;
+   struct drm_crtc *crtc;
+   struct drm_encoder *encoder;
+   int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
+   int ret = 0;
+
+   crtc = priv->crtcs[pipe];
+   if (!crtc) {
+   DRM_ERROR("Invalid crtc %d\n", pipe);
+   return 0;
+   }
+
+   encoder = get_encoder_from_crtc(crtc);
+   if (!encoder) {
+   DRM_ERROR("no encoder found for crtc %d\n", pipe);
+   return 0;
+   }
+
+   ret |= DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_ACCURATE;
+
+   vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
+   vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
+
+   /*
+* the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
+* the end of VFP. Translate the porch values relative to the line
+* counter positions.
+*/
+
+   vactive_start = vsw + vbp + 1;
+
+   vactive_end = vactive_start + mode->crtc_vdisplay;
+
+   /* last scan line before VSYNC */
+   vfp_end = mode->crtc_vtotal;
+
+   if (stime)
+   *stime = ktime_get();
+
+   line = mdp5_encoder_get_linecount(encoder);
+
+   if (line < vactive_start) {
+   line -= vactive_start;
+   ret |= DRM_SCANOUTPOS_IN_VBLANK;
+   } else if (line > vactive_end) {
+   line = line - vfp_end - vactive_start;
+   ret |= DRM_SCANOUTPOS_IN_VBLANK;
+   } else {
+   line -= vactive_start;
+   }
+
+   *vpos = line;
+   *hpos = 0;
+
+   if (etime)
+   *etime = ktime_get();
+
+   return ret;
+}
+
+static int mdp5_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
+int *max_error,
+struct timeval *vblank_time,
+unsigned flags)
+{
+   struct msm_drm_private *priv = dev->dev_private;
+   struct drm_crtc *crtc;
+
+   if (pipe < 0 || pipe

Re: [PATCH] drm/msm/mdp5: high precision vblank timestamp support

2015-10-26 Thread Archit Taneja



On 10/27/2015 05:33 AM, Rob Clark wrote:

On Mon, Oct 26, 2015 at 5:54 AM, Archit Taneja <arch...@codeaurora.org> wrote:

MDP5 has line count and frame count registers for each interface. Enable
these counters and use them to implement the get_vblank_timestamp drm
driver op.

The line counter starts with the value 1 at the beginning of the VSYNC
pulse and ends with value VTOTAL at the end of VFP. This value is used
to determine whether we're in blanking period or not, and an adjusted
value of this counter is used to get vpos as expected by
get_scanout_position. Since there is no way to calculate hpos, we always
set it to 0.


What are the odds that mdp(n!=5) could support the same?  If/when that
ever happens I could see making some of this helpers to duplicate a
bit less in mdpN backend.. but I guess also fine to cross that bridge
when we come to it.  Other than that, lgtm, thanks


The MDP4 line counter only loops within the active region, making it 
sort of ineffective. That's the main reason why I didn't attempt to 
implement it for mdp4.


There seems to be a 12 bit frame counter available to implement a
vblank counter, but without the line counter, I'm not sure if that'll
be any better than using the software vblank counter.

Archit



BR,
-R


Signed-off-by: Archit Taneja <arch...@codeaurora.org>
---
  drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c |  18 
  drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 129 
  drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h |   2 +
  3 files changed, 149 insertions(+)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
index c9e32b0..a019656 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
@@ -293,6 +293,24 @@ static const struct drm_encoder_helper_funcs 
mdp5_encoder_helper_funcs = {
 .enable = mdp5_encoder_enable,
  };

+int mdp5_encoder_get_linecount(struct drm_encoder *encoder)
+{
+   struct mdp5_encoder *mdp5_encoder = to_mdp5_encoder(encoder);
+   struct mdp5_kms *mdp5_kms = get_kms(encoder);
+   int intf = mdp5_encoder->intf.num;
+
+   return mdp5_read(mdp5_kms, REG_MDP5_INTF_LINE_COUNT(intf));
+}
+
+u32 mdp5_encoder_get_framecount(struct drm_encoder *encoder)
+{
+   struct mdp5_encoder *mdp5_encoder = to_mdp5_encoder(encoder);
+   struct mdp5_kms *mdp5_kms = get_kms(encoder);
+   int intf = mdp5_encoder->intf.num;
+
+   return mdp5_read(mdp5_kms, REG_MDP5_INTF_FRAME_COUNT(intf));
+}
+
  int mdp5_encoder_set_split_display(struct drm_encoder *encoder,
 struct drm_encoder *slave_encoder)
  {
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
index b532faa..e115318 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
@@ -468,6 +468,127 @@ static int get_clk(struct platform_device *pdev, struct 
clk **clkp,
 return 0;
  }

+static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
+{
+   struct drm_device *dev = crtc->dev;
+   struct drm_encoder *encoder;
+
+   drm_for_each_encoder(encoder, dev)
+   if (encoder->crtc == crtc)
+   return encoder;
+
+   return NULL;
+}
+
+static int mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,
+  unsigned int flags, int *vpos, int *hpos,
+  ktime_t *stime, ktime_t *etime,
+  const struct drm_display_mode *mode)
+{
+   struct msm_drm_private *priv = dev->dev_private;
+   struct drm_crtc *crtc;
+   struct drm_encoder *encoder;
+   int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
+   int ret = 0;
+
+   crtc = priv->crtcs[pipe];
+   if (!crtc) {
+   DRM_ERROR("Invalid crtc %d\n", pipe);
+   return 0;
+   }
+
+   encoder = get_encoder_from_crtc(crtc);
+   if (!encoder) {
+   DRM_ERROR("no encoder found for crtc %d\n", pipe);
+   return 0;
+   }
+
+   ret |= DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_ACCURATE;
+
+   vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
+   vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
+
+   /*
+* the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
+* the end of VFP. Translate the porch values relative to the line
+* counter positions.
+*/
+
+   vactive_start = vsw + vbp + 1;
+
+   vactive_end = vactive_start + mode->crtc_vdisplay;
+
+   /* last scan line before VSYNC */
+   vfp_end = mode->crtc_vtotal;
+
+   if (stime)
+   *stime = ktime_get();
+
+   line = mdp5_encoder_get_linecount(encoder);
+
+   if (line < vactive_start) {
+   line -= vactive_start;
+

Re: [PATCH] clk: qcom: msm8960: Fix dsi1/2 halt bits

2015-10-26 Thread Archit Taneja



On 10/27/2015 06:53 AM, Stephen Boyd wrote:

The halt bits for these clocks seem wrong. I get the following
warning while booting on an msm8960-cdp:

WARNING: CPU: 0 PID: 1 at drivers/clk/qcom/clk-branch.c:97 
clk_branch_toggle+0xd0/0x138()
dsi1_clk status stuck at 'on'
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.3.0-rc3-00113-g5532cfb567fe #110
Hardware name: Qualcomm (Flattened Device Tree)
[] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[] (show_stack) from [] (dump_stack+0x70/0xbc)
[] (dump_stack) from [] (warn_slowpath_common+0x78/0xb4)
[] (warn_slowpath_common) from [] 
(warn_slowpath_fmt+0x30/0x40)
[] (warn_slowpath_fmt) from [] 
(clk_branch_toggle+0xd0/0x138)
[] (clk_branch_toggle) from [] 
(clk_disable_unused_subtree+0x98/0x1b0)
[] (clk_disable_unused_subtree) from [] 
(clk_disable_unused_subtree+0x20/0x1b0)
[] (clk_disable_unused_subtree) from [] 
(clk_disable_unused+0x58/0xd8)
[] (clk_disable_unused) from [] (do_one_initcall+0xac/0x1ec)
[] (do_one_initcall) from [] 
(kernel_init_freeable+0x11c/0x1e8)
[] (kernel_init_freeable) from [] (kernel_init+0x8/0xec)
[] (kernel_init) from [] (ret_from_fork+0x14/0x3c)

Fix the status bits and the errors go away.

Fixes: 5532cfb567fe ("clk: qcom: mmcc-8960: Add DSI related clocks")
Cc: Archit Taneja <arch...@codeaurora.org>
Signed-off-by: Stephen Boyd <sb...@codeaurora.org>
---


Acked-by: Archit Taneja <arch...@codeaurora.org>

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum, hosted by The Linux Foundation

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


Re: [PATCH v4 1/5] mtd: nand: Create a BBT flag to access bad block markers in raw mode

2015-11-09 Thread Archit Taneja

Hi,

On 10/12/2015 01:33 AM, Brian Norris wrote:

Hi Boris,

On Fri, Oct 02, 2015 at 08:27:38AM +0200, Boris Brezillon wrote:

Brian, Archit,

On Thu, 1 Oct 2015 19:44:34 -0700
Brian Norris <computersforpe...@gmail.com> wrote:


On Wed, Aug 19, 2015 at 10:19:02AM +0530, Archit Taneja wrote:

Some controllers can access the factory bad block marker from OOB only
when they read it in raw mode. When ECC is enabled, these controllers
discard reading/writing bad block markers, preventing access to them
altogether.

The bbt driver assumes MTD_OPS_PLACE_OOB when scanning for bad blocks.
This results in the nand driver's ecc->read_oob() op to be called, which
works with ECC enabled.

Create a new BBT option flag that tells nand_bbt to force the mode to
MTD_OPS_RAW. This would result in the correct op being called for the
underlying nand controller driver.


Actually I have the same kind of patch in my local tree (for a
different reason though: the HW randomizer can mess up with the BBM
byte if it's not disabled, and the only way to disable it in my current
implementation is to switch to raw mode).



MTD_OPS_RAW is probably the best way to do this, and we should switch
back to it for all users (rather than a new flag).


I'm fine with this solution, but will that be acceptable for everybody?
I mean, some NAND controllers are able to protect some OOB bytes, and
the BBM might fall in those OOB bytes. In this case, shouldn't we rely
on the ECC protection instead of reading the OOB in raw mode?


I think ECC is kind of misused a bit here. It's not really meant for
protecting BBMs, and it's also really not sufficient, esp. given
bitflips in erased areas.


But to do this, we
need to fix up some things. Particularly, we need to extend
'badblockbits' support so that it is applied consistently in all places
(I recall there is one code path in which bad block scanning does take
this into account, and one that doesn't.)


Yes, IIRC Andrea has posted a patch addressing that problem [1].
Another problem I see is that badblockbits is currently assigned a
fixed value by the NAND controller driver (or a default value of 8).
There's no specific logic to correlate it to the required ECC strength.
IMO, we should not let each NAND controller driver decide what is the
appropriate value for each chip but rather implement the logic in
nand_base.c based on ecc->strength and ecc->size, and IIRC this was
the question Andrea asked when he posted his proposal.



About badblockbits: it allows us to do a relaxed heuristic on matching
bad block markers, where we say the BBM is "bad" if more than fewer than
N bits are '1'. Right now, we just say that if there are any 0 bits in
the Bad Block Marker (BBM) region, then the block is bad. But this is
problematic for pages that have been worn down and might have bitflips.
So right now, part of a (bad) solution is to read with ECC, so worn
blocks that have data won't be later interpreted as bad blocks if we
rescan the BBMs (ECC will correct the bitflips, if the OOB is
protected).

But that solution is not really good, since ECC is not really a panacea
for misinterpreted BBMs. And HW like yours apparently won't work like
this.


Okay, I see you gave pretty much the same explanation, which makes mine
useless :-).



So in summary: if we can consistently make BBM checks look for 6 or 7
"one" bits (rather than a full 8 bits, i.e. BBM == 0xff), then we can
just unconditionally switch to RAW rather than PLACE_OOB. And we don't
need a flag like this pach introduces.


I guess it all depends whether we want to let NAND controllers that can
protect their BBM keep doing it (which IMO is not such a bad idea).


I think I was the only one consciously trying to do this. (Though I
guess it's possible some people discreetly hacked it in by not
supporting raw mode properly.) And for my cases, I'm pretty sure a
properly-improved raw mode BBM scan would be just as good, or actually
better. So I'm not sure anyone would really notice if we switched back
and properly accounted for flips.


Was there any progress on the badblockbits work? I'd seen a thread on
linux-mtd but that had sort of died too.

Brian,

Could we get this driver merged for now without BBT support? In my next
revision, I could populate chip->block_bad and chip->block_markbad
and add NAND_SKIP_BBTSCAN to chip->options. I can remove this once
we have badblockbits support.

Thanks,
Archit



Brian

__
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum, hosted by The Linux Foundation

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


Re: [RFC v2 4/5] drm/dsi: Add routine to unregister dsi device

2015-11-02 Thread Archit Taneja



On 11/02/2015 04:12 PM, Andrzej Hajda wrote:

On 11/02/2015 07:28 AM, Archit Taneja wrote:


On 10/30/2015 07:51 PM, Andrzej Hajda wrote:

On 10/06/2015 11:24 AM, Archit Taneja wrote:

A driver calling mipi_dsi_device_new might want to unregister the device
once it's done. It might also require it in an error handling path in
case something didn't go right.

When the dsi host driver calls mipi_dsi_host_unregister, the devices
created by both DT and and without DT will be removed. This does leave
the possibility of the host removing the dsi device without the
peripheral driver being aware of it. I don't know a good way to solve
this. Some suggestions here would be of help too.

The 2nd paragraph is not relevant here. It is another issue. Some comments
about it:

Yes, it's probably not the best to put it in the commit message of this
patch.


I am not sure, but I guess device should not be removed if it is refcounted
properly, it will be just detached from the driver, bus and system (whatever it
means:) ).
It does not mean it will be usable and probably some races can occur anyway.
I guess i2c and other buses have the same problem, am I right?

I was concerned about one particular sequence:

1) DSI host driver calls mipi_dsi_host_unregister: All dsi devices would
be unregistered.

2) dsi device driver calls mipi_dsi_device_unregister: This will try to
unregister our dsi device

The problem here is that the device will cease to exist after step (1)
itself, because the refcount of our device will never be 2.

mipi_dsi_host_register() will only register devices represented in DT,
not the one the drivers register manually.

In other words, the dsi pointer in our driver will point to nothing
valid after mipi_dsi_host_unregister is called.

As you said, I guess this exists in other buses too, and it's the
drivers job to not use them.


I think the whole problem is due to fact we try to use devices
as interfaces to some bus hosts (DSI in our case), these devices
are owned by bus host and we cannot control their lifetime from other code.
The best solution IMO would be to create separate lightweight framework
as I suggested in previous discussion[1]. It should be cleaner solution
without any 'dummy' proxy devices.
But even in this case we would need some callbacks to notify that the provider
is about to be removed.

2nd 'solution' is to leave it as is and pretend everything is OK,
as in case of other frameworks :)

Maybe it would be possible 3rd solution - we could use probe and remove 
callbacks
from dsi driver to notify clients about adding/removal of dsi device to/from 
bus.
So during dummy dsi dev creation we would provide some callbacks which would be
called
by dummy dsi driver probe/remove to notifiy client it can start/stop using dsi
device.
This crazy construction probably can work but looks insane :)

[1]: http://www.spinics.net/lists/linux-arm-msm/msg16945.html


I'm okay with the 2nd solution :). We can add callbacks or a
notification mechanism if anyone needs it in the future.

Thanks,
Archit



Regards
Andrzej




Signed-off-by: Archit Taneja <arch...@codeaurora.org>
---
   drivers/gpu/drm/drm_mipi_dsi.c | 7 +++
   include/drm/drm_mipi_dsi.h | 2 ++
   2 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index db6130a..cbb7373 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -183,6 +183,13 @@ err:
   }
   EXPORT_SYMBOL(mipi_dsi_device_new);

+void mipi_dsi_device_unregister(struct mipi_dsi_device *dsi)
+{
+   if (dsi)
+   device_unregister(>dev);
+}
+EXPORT_SYMBOL(mipi_dsi_device_unregister);
+

I guess NULL check can be removed and the whole function can be inlined.

Yeah, this check won't help anyway.

I think I'll mention that drivers should use this only in error
handling paths, and not in the driver's remove() op.

I'll also change this to inlined.

Archit


Regards
Andrzej

   static struct mipi_dsi_device *
   of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
   {
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 93dec7b..68f49f4 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -197,6 +197,8 @@ ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, 
const void *params,

   struct mipi_dsi_device *mipi_dsi_device_new(struct mipi_dsi_host *host,
struct mipi_dsi_device_info *info);
+void mipi_dsi_device_unregister(struct mipi_dsi_device *dsi);
+
   /**
* enum mipi_dsi_dcs_tear_mode - Tearing Effect Output Line mode
* @MIPI_DSI_DCS_TEAR_MODE_VBLANK: the TE output line consists of V-Blanking

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" 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 th

<    1   2   3   4   >