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: [PATCH v7 4/9] nvmem: Add bindings for simple nvmem framework

2015-07-13 Thread Srinivas Kandagatla


Thanks Rob for quick review,

On 10/07/15 20:04, Rob Herring wrote:

On Fri, Jul 10, 2015 at 4:45 AM, Srinivas Kandagatla
srinivas.kandaga...@linaro.org wrote:

This patch adds bindings for simple nvmem framework which allows nvmem
consumers to talk to nvmem providers to get access to nvmem cell data.

Signed-off-by: Maxime Ripard maxime.rip...@free-electrons.com
[Maxime Ripard: intial version of eeprom framework]
Signed-off-by: Srinivas Kandagatla srinivas.kandaga...@linaro.org
---
  Documentation/devicetree/bindings/nvmem/nvmem.txt | 85 +++
  1 file changed, 85 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/nvmem/nvmem.txt

diff --git a/Documentation/devicetree/bindings/nvmem/nvmem.txt 
b/Documentation/devicetree/bindings/nvmem/nvmem.txt
new file mode 100644
index 000..849f1e1
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/nvmem.txt
@@ -0,0 +1,85 @@
+= NVMEM(Non Volatile Memory) Data Device Tree Bindings =
+
+This binding is intended to represent the location of hardware
+configuration data stored in NVMEMs like eeprom, efuses and so on.
+
+On a significant proportion of boards, the manufacturer has stored
+some data on NVMEM, for the OS to be able to retrieve these information
+and act upon it. Obviously, the OS has to know about where to retrieve
+these data from, and where they are stored on the storage device.
+
+This document is here to document this.
+
+= Data providers =
+Contains bindings specific to provider drivers and data cells as children
+of this node.


#address-cells and #size-cells are required here.


+
+Optional properties:
+ read-only: Mark the provider as read only.


Couldn't this be per field rather than global?

Not ATM, The reason for making this property global is to mark the 
complete nvmem to be readonly/read-write. Which most of the use-cases 
will have. Currently this property is used for setting permissions on 
the sysfs binary file, also it would be impossible to apply per field 
read-only property to such file.


Am also planning to send few patches on top of these to expose fields in 
sysfs which would then allow us to use per field read-only property.
Again not sure how the direct access to nvmem would fit in with such 
requirements. Need to evaluate this option in more detail though. :-)



+
+= Data cells =
+These are the child nodes of the provider which contain data cell
+information like offset and size in nvmem provider.
+
+Required properties:
+reg:   specifies the offset in byte within that storage device, start bit
+   in the byte and the length in bytes of the data we care about.
+   There could be more than one offset-length pairs in this property.
+
+Optional properties:
+
+bit-offset: specifies the offset in bit within the address range specified
+   by reg property. Can take values from 0-7.
+nbits: specifies number of bits this cell occupies starting from bit-offset.


How about just: bits = offset size

Thats another possible way to specify the same info, Only reason I came 
up with bit-offset and nbits is due to the fact that similar properties 
were seen in other device DT bindings.


I will try your suggestion and see how it looks before I send new version.


Then the bit specification is more aligned with the byte location
(i.e. reg property).

You could also do this all in the reg property with 2 address cells
for byte and bit position and then size can be in bits. reg doesn't
have to match a memory mapped bus addressing meanings. If you wanted
to handle ranges and address translation, then you would need custom
functions like PCI does. I'm not sure you would need that.

I wanted to keep things simple for this first version.




--srini
--
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 Daniel Vetter
On Mon, Jul 13, 2015 at 03:59:25PM +0530, Archit Taneja wrote:
 
 
 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?

I think we only need that once we pull in the driver-specific parts for
step23, right? Personally I don't really care about the Kconfig
organization all that much, so I'd like to see some Acks from other
maintainers before I pull that in. If that happens I can pull in the
patches for old/legacy drivers into topic/drm-misc sure.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
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 v7 0/9] Add simple NVMEM Framework via regmap.

2015-07-13 Thread Srinivas Kandagatla



On 13/07/15 19:54, Stefan Wahren wrote:

Hi Srinivas,

[add Ezequiel Garcia to CC]


Srinivas Kandagatla srinivas.kandaga...@linaro.org hat am 10. Juli 2015 um
11:43 geschrieben:


Hi Greg,

This patchset adds a new simple NVMEM framework to kernel, and it is tested
with various drivers like QCOM thermal sensors, QCOM cpr driver,
begal bone cape manager and few more on the way.

Thankyou all for providing inputs and comments on previous versions of this
patchset. Here is the v7 of the patchset addressing all the issues raised as
part of previous versions review.

Up until now, NVMEM drivers like eeprom were stored in drivers/misc, where
they
all had to duplicate pretty much the same code to register a sysfs file, allow
in-kernel users to access the content of the devices they were driving, etc.
This was also a problem as far as other in-kernel users were involved, since
the solutions used were pretty much different from on driver to another, there
was a rather big abstraction leak.


i only want to mention that there are more places of NVMEM drivers like:

drivers/mfd/ab3100-otp.c
drivers/soc/tegra/fuse/*.c


Thanks for mentioning.





Introduction of this framework aims at solving this. It also introduces DT
representation for consumer devices to go get the data they require (MAC
Addresses, SoC/Revision ID, part numbers, and so on) from the NVMEMs.

After learning few things about QCOM qfprom and other eeprom/efuses, which
has packed fields at bit level. Which makes it important to add support to
such memories. This version adds support to this type of non volatile
memories by adding support to bit level nvmem-cells.

Having regmap interface to this framework would give much better
abstraction for nvmems on different buses.

patch 1-4 Introduces the NVMEM framework.
Patch 5-6 Adds Qualcomm specific qfprom driver.
Patch 7 migrates an existing driver to nvmem framework.
Patch 8 adds entry in MAINTAINERS.

Its also possible to migrate other nvmem drivers to this framework, and I
think
some of them already posted patches based on this framework.

Providers APIs:
nvmem_register/unregister();


How do i get the cell info from the devicetree into the nvmem_config?

Not sure what is the real use-case here, But this is how it is supposed 
to work.


cellinfo in nvmem_config is used to pass cell information in non-dt 
style to the core. The core would parse it and convert into nvmem-cells. 
Am not sure why would you want to do other way round. Could you explain 
the real use case here?




I expected a function something like of_nvmem_cell_info_get() in the Providers
API.






...


userspace interface: binary file in /sys/bus/nvmem/devices/*/nvmem

ex:
hexdump /sys/bus/nvmem/devices/qfprom0/nvmem

000        
*
0a0 db10 2240  e000 0c00 0c00  0c00
000        
...
*
0001000


Since we're entering userspace the behavior should be clear.

How do we treat register gaps? Fill them with zero?
nvmem file would read full nvmem size which is passed to it as regmap. 
So It would dump whatever the provider returns.



--srini


Best regards
Stefan


--
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 v7 0/9] Add simple NVMEM Framework via regmap.

2015-07-13 Thread Stefan Wahren
Hi Srinivas,

[add Ezequiel Garcia to CC]

 Srinivas Kandagatla srinivas.kandaga...@linaro.org hat am 10. Juli 2015 um
 11:43 geschrieben:


 Hi Greg,

 This patchset adds a new simple NVMEM framework to kernel, and it is tested
 with various drivers like QCOM thermal sensors, QCOM cpr driver,
 begal bone cape manager and few more on the way.

 Thankyou all for providing inputs and comments on previous versions of this
 patchset. Here is the v7 of the patchset addressing all the issues raised as
 part of previous versions review.

 Up until now, NVMEM drivers like eeprom were stored in drivers/misc, where
 they
 all had to duplicate pretty much the same code to register a sysfs file, allow
 in-kernel users to access the content of the devices they were driving, etc.
 This was also a problem as far as other in-kernel users were involved, since
 the solutions used were pretty much different from on driver to another, there
 was a rather big abstraction leak.

i only want to mention that there are more places of NVMEM drivers like:

drivers/mfd/ab3100-otp.c
drivers/soc/tegra/fuse/*.c


 Introduction of this framework aims at solving this. It also introduces DT
 representation for consumer devices to go get the data they require (MAC
 Addresses, SoC/Revision ID, part numbers, and so on) from the NVMEMs.

 After learning few things about QCOM qfprom and other eeprom/efuses, which
 has packed fields at bit level. Which makes it important to add support to
 such memories. This version adds support to this type of non volatile
 memories by adding support to bit level nvmem-cells.

 Having regmap interface to this framework would give much better
 abstraction for nvmems on different buses.

 patch 1-4 Introduces the NVMEM framework.
 Patch 5-6 Adds Qualcomm specific qfprom driver.
 Patch 7 migrates an existing driver to nvmem framework.
 Patch 8 adds entry in MAINTAINERS.

 Its also possible to migrate other nvmem drivers to this framework, and I
 think
 some of them already posted patches based on this framework.

 Providers APIs:
 nvmem_register/unregister();

How do i get the cell info from the devicetree into the nvmem_config?

I expected a function something like of_nvmem_cell_info_get() in the Providers
API.


 Consumers APIs:
 Cell based apis for both DT/Non-DT:
 nvmem_cell_get()/nvmem_cell_put();
 devm_nvmem_cell_get()/devm_nvmem_cell_put();
 of_nvmem_cell_get()
 nvmem_cell_read()/nvmem_cell_write();

 Raw byte access apis for both DT/non-DT.
 nvmem_device_get()/nvmem_device_put()
 devm_nvmem_device_get()/nvmem_device_put()
 of_nvmem_device_get()

 nvmem_device_read()/nvmem_device_write();
 nvmem_device_cell_read()/nvmem_device_cell_write();

 Device Tree:

 /* Provider */
 qfprom: qfprom@0070 {
 ...

 /* Data cells */
 tsens_calibration: calib@404 {
 reg = 0x404 0x10;
 };

 tsens_calibration_bckp: calib_bckp@504 {
 reg = 0x504 0x11;
 bit-offset = 6;
 nbits = 128;
 };

 pvs_version: pvs-version@6 {
 reg = 0x6 0x2
 bit-offset = 7;
 nbits = 2;
 };

 speed_bin: speed-bin@c{
 reg = 0xc 0x1;
 bit-offset = 2;
 nbits = 3;

 };
 ...
 };
 /* Consumer */
 tsens {
 ...
 nvmem-cells = tsens_calibration;
 nvmem-cell-names = calibration;
 };

 userspace interface: binary file in /sys/bus/nvmem/devices/*/nvmem

 ex:
 hexdump /sys/bus/nvmem/devices/qfprom0/nvmem

 000        
 *
 0a0 db10 2240  e000 0c00 0c00  0c00
 000        
 ...
 *
 0001000

Since we're entering userspace the behavior should be clear.

How do we treat register gaps? Fill them with zero?

Best regards
Stefan
--
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 v7 2/9] nvmem: Add a simple NVMEM framework for consumers

2015-07-13 Thread Stefan Wahren
Hi Srinivas,

 Srinivas Kandagatla srinivas.kandaga...@linaro.org hat am 10. Juli 2015 um
 11:44 geschrieben:


 [...]
 ---
 drivers/nvmem/core.c | 424 -
 include/linux/nvmem-consumer.h | 76 
 2 files changed, 498 insertions(+), 2 deletions(-)
 create mode 100644 include/linux/nvmem-consumer.h

 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
 index a779ad1..f429ad4 100644
 --- a/drivers/nvmem/core.c
 +++ b/drivers/nvmem/core.c
 @@ -15,14 +15,15 @@
 */

 #include linux/device.h
 -#include linux/nvmem-provider.h
 #include linux/export.h
 #include linux/fs.h
 #include linux/idr.h
 #include linux/init.h
 -#include linux/regmap.h

please avoid such changes in your patch series. This should be fixed in the
first patch.

Thanks
Stefan
--
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 v7 2/9] nvmem: Add a simple NVMEM framework for consumers

2015-07-13 Thread Srinivas Kandagatla



On 13/07/15 20:06, Stefan Wahren wrote:

-#include linux/nvmem-provider.h
#include linux/export.h
#include linux/fs.h
#include linux/idr.h
#include linux/init.h
-#include linux/regmap.h

please avoid such changes in your patch series. This should be fixed in the
first patch.
Sure, I know why this happened, the headers were re-ordered in this 
patch.. I will take care of it.


--srini
--
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-13 Thread Alex Deucher
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 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

 ___
 dri-devel mailing list
 dri-de...@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
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-13 Thread Daniel Vetter
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?

Thanks, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
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 v7 1/9] nvmem: Add a simple NVMEM framework for nvmem providers

2015-07-13 Thread Philipp Zabel
Hi Srinivas,

Am Freitag, den 10.07.2015, 10:44 +0100 schrieb Srinivas Kandagatla:
 This patch adds just providers part of the framework just to enable easy
 review.
[...]
 +/**
 + * nvmem_register() - Register a nvmem device for given nvmem_config.
 + * Also creates an binary entry in /sys/bus/nvmem/devices/dev-name/nvmem
 + *
 + * @config: nvmem device configuration with which nvmem device is created.
 + *
 + * The return value will be an ERR_PTR() on error or a valid pointer
 + * to nvmem_device.
 + */
 +
 +struct nvmem_device *nvmem_register(struct nvmem_config *config)
 +{
[...]
 + nvmem-read_only = nvmem-dev.of_node ?
 + of_property_read_bool(nvmem-dev.of_node,
 + read-only) :
 + config-read_only;

I think read_only should be set if any of the device node property or
nvmem_config-read_only request it. That way, even if the nvmem is
theoretically writeable (no read-only property in DT), the driver still
can make it read-only if writing isn't implemented:

+   nvmem-read_only = nvmem-dev.of_node ?
+   of_property_read_bool(nvmem-dev.of_node,
+   read-only) : 0;
+   nvmem-read_only |= config-read_only;

[...]
 new file mode 100644
 index 000..f589d3b
 --- /dev/null
 +++ b/include/linux/nvmem-provider.h
[...]
 +struct nvmem_config {
 + struct device   *dev;
 + const char  *name;
 + int id;
 + struct module   *owner;
 + struct nvmem_cell_info  *cells;

Should that be const?

 + int ncells;
 + boolread_only;
 +};
 +
 +#if IS_ENABLED(CONFIG_NVMEM)
 +
 +struct nvmem_device *nvmem_register(struct nvmem_config *cfg);

Then that could be made const, too.

best regards
Philipp

--
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 Alex Deucher
On Mon, Jul 13, 2015 at 2:37 AM, Archit Taneja arch...@codeaurora.org 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


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


 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

 ___
 dri-devel mailing list
 dri-de...@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More 

Re: [PATCH v7 0/9] Add simple NVMEM Framework via regmap.

2015-07-13 Thread Stefan Wahren
Hi Srinivas,

 Srinivas Kandagatla srinivas.kandaga...@linaro.org hat am 13. Juli 2015 um
 21:35 geschrieben:

 On 13/07/15 19:54, Stefan Wahren wrote:
  Hi Srinivas,
 
  [...]
 
  Providers APIs:
  nvmem_register/unregister();
 
  How do i get the cell info from the devicetree into the nvmem_config?
 
 Not sure what is the real use-case here, But this is how it is supposed
 to work.

 cellinfo in nvmem_config is used to pass cell information in non-dt
 style to the core. The core would parse it and convert into nvmem-cells.
 Am not sure why would you want to do other way round. Could you explain
 the real use case here?


my question comes from porting mxs_ocotp to NVMEM framework.

Here is the devicetree part:

ocotp: ocotp@8002c000 {
compatible = fsl,imx28-ocotp, fsl,ocotp;
#address-cells = 1;
#size-cells = 1;
reg = 0x8002c000 0x2000;
clocks = clks 25;
read-only;

/* Data cells */
ocotp_customer: costumer@20 {
reg = 0x20 0x10;
};

ocotp_rom0: rom0@1a0 {
reg = 0x1a0 0x4;
};
};

After calling nvmem_register() in the provider driver [1] no data cell is
registered. So
i looked at the core code and i thought that retrieving the cell info and put it
into the nvmem_config
is job of the provider driver.

Did i missed something?

[1] -
https://github.com/lategoodbye/fsl_ocotp/commit/7c98e19755b69f761885b0e1ceb2c258a7c47ade



 
 ...

  userspace interface: binary file in /sys/bus/nvmem/devices/*/nvmem
 
  ex:
  hexdump /sys/bus/nvmem/devices/qfprom0/nvmem
 
  000        
  *
  0a0 db10 2240  e000 0c00 0c00  0c00
  000        
  ...
  *
  0001000
 
  Since we're entering userspace the behavior should be clear.
 
  How do we treat register gaps? Fill them with zero?
 nvmem file would read full nvmem size which is passed to it as regmap.
 So It would dump whatever the provider returns.

Sure, but wouldn't it be nice if different provider behave the same?



 --srini
 
  Best regards
  Stefan
 
--
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] Input: pmic8xxx-pwrkey - Support shutdown

2015-07-13 Thread Bjorn Andersson
On Mon 06 Jul 18:08 PDT 2015, Stephen Boyd wrote:

 On pm8xxx PMICs, shutdown and restart are signaled to the PMIC
 via a pin called PS_HOLD. When this pin goes low, the PMIC
 performs a configurable power sequence. Add a .shutdown hook so
 that we can properly configure this power sequence for shutdown
 or restart depending on the system state.
 
 Signed-off-by: Stephen Boyd sb...@codeaurora.org
 ---
  drivers/input/misc/pmic8xxx-pwrkey.c | 287 
 ++-
  1 file changed, 280 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c 
 b/drivers/input/misc/pmic8xxx-pwrkey.c

[..]

  
  /**
   * struct pmic8xxx_pwrkey - pmic8xxx pwrkey information
   * @key_press_irq: key press irq number
 + * @regmap: device regmap

Please also document the shutdown_fn.

   */
  struct pmic8xxx_pwrkey {
   int key_press_irq;
 + struct regmap *regmap;
 + int (*shutdown_fn)(struct pmic8xxx_pwrkey *, bool);
 +};
 +
 +struct pm8xxx_nbs {
 + int (*shutdown_fn)(struct pmic8xxx_pwrkey *, bool);
  };

This struct is unused.

[..]

  static struct platform_driver pmic8xxx_pwrkey_driver = {
   .probe  = pmic8xxx_pwrkey_probe,
   .remove = pmic8xxx_pwrkey_remove,
 + .shutdown   = pmic8xxx_pwrkey_shutdown,

I tried to find pros/cons of using this approach instead of register a
reboot notifier like I did in the pm8941 driver, but I haven't come up
with any good reason to pick one or the other.

   .driver = {
   .name   = pm8xxx-pwrkey,
   .pm = pm8xxx_pwr_key_pm_ops,

With above nits I think this looks good.

Regards,
Bjorn
--
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] Input: pmic8xxx-pwrkey - Support shutdown

2015-07-13 Thread Stephen Boyd
On pm8xxx PMICs, shutdown and restart are signaled to the PMIC
via a pin called PS_HOLD. When this pin goes low, the PMIC
performs a configurable power sequence. Add a .shutdown hook so
that we can properly configure this power sequence for shutdown
or restart depending on the system state.

Cc: Bjorn Andersson bjorn.anders...@sonymobile.com
Signed-off-by: Stephen Boyd sb...@codeaurora.org
---
 drivers/input/misc/pmic8xxx-pwrkey.c | 284 ++-
 1 file changed, 277 insertions(+), 7 deletions(-)

diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c 
b/drivers/input/misc/pmic8xxx-pwrkey.c
index c4ca20e63221..1d1ee5951b3a 100644
--- a/drivers/input/misc/pmic8xxx-pwrkey.c
+++ b/drivers/input/misc/pmic8xxx-pwrkey.c
@@ -20,17 +20,72 @@
 #include linux/regmap.h
 #include linux/log2.h
 #include linux/of.h
+#include linux/of_device.h
 
 #define PON_CNTL_1 0x1C
 #define PON_CNTL_PULL_UP BIT(7)
 #define PON_CNTL_TRIG_DELAY_MASK (0x7)
+#define PON_CNTL_1_PULL_UP_EN  0xe0
+#define PON_CNTL_1_USB_PWR_EN  0x10
+#define PON_CNTL_1_WD_EN_RESET 0x08
+
+#define PM8058_SLEEP_CTRL  0x02b
+#define PM8921_SLEEP_CTRL  0x10a
+
+#define SLEEP_CTRL_SMPL_EN_RESET   0x04
+
+/* Regulator master enable addresses */
+#define REG_PM8058_VREG_EN_MSM 0x018
+#define REG_PM8058_VREG_EN_GRP_5_4 0x1C8
+
+/* Regulator control registers for shutdown/reset */
+#define PM8058_S0_CTRL 0x004
+#define PM8058_S1_CTRL 0x005
+#define PM8058_S3_CTRL 0x111
+#define PM8058_L21_CTRL0x120
+#define PM8058_L22_CTRL0x121
+
+#define PM8058_REGULATOR_ENABLE_MASK   0x80
+#define PM8058_REGULATOR_ENABLE0x80
+#define PM8058_REGULATOR_DISABLE   0x00
+#define PM8058_REGULATOR_PULL_DOWN_MASK0x40
+#define PM8058_REGULATOR_PULL_DOWN_EN  0x40
+
+/* Buck CTRL register */
+#define PM8058_SMPS_LEGACY_VREF_SEL0x20
+#define PM8058_SMPS_LEGACY_VPROG_MASK  0x1F
+#define PM8058_SMPS_ADVANCED_BAND_MASK 0xC0
+#define PM8058_SMPS_ADVANCED_BAND_SHIFT6
+#define PM8058_SMPS_ADVANCED_VPROG_MASK0x3F
+
+/* Buck TEST2 registers for shutdown/reset */
+#define PM8058_S0_TEST20x084
+#define PM8058_S1_TEST20x085
+#define PM8058_S3_TEST20x11A
+
+#define PM8058_REGULATOR_BANK_WRITE0x80
+#define PM8058_REGULATOR_BANK_MASK 0x70
+#define PM8058_REGULATOR_BANK_SHIFT4
+#define PM8058_REGULATOR_BANK_SEL(n)   ((n)  PM8058_REGULATOR_BANK_SHIFT)
+
+/* Buck TEST2 register bank 1 */
+#define PM8058_SMPS_LEGACY_VLOW_SEL0x01
+
+/* Buck TEST2 register bank 7 */
+#define PM8058_SMPS_ADVANCED_MODE_MASK 0x02
+#define PM8058_SMPS_ADVANCED_MODE  0x02
+#define PM8058_SMPS_LEGACY_MODE0x00
 
 /**
  * struct pmic8xxx_pwrkey - pmic8xxx pwrkey information
  * @key_press_irq: key press irq number
+ * @regmap: device regmap
+ * @shutdown_fn: shutdown configuration function
  */
 struct pmic8xxx_pwrkey {
int key_press_irq;
+   struct regmap *regmap;
+   int (*shutdown_fn)(struct pmic8xxx_pwrkey *, bool);
 };
 
 static irqreturn_t pwrkey_press_irq(int irq, void *_pwr)
@@ -76,6 +131,220 @@ static int __maybe_unused pmic8xxx_pwrkey_resume(struct 
device *dev)
 static SIMPLE_DEV_PM_OPS(pm8xxx_pwr_key_pm_ops,
pmic8xxx_pwrkey_suspend, pmic8xxx_pwrkey_resume);
 
+static void pmic8xxx_pwrkey_shutdown(struct platform_device *pdev)
+{
+   struct pmic8xxx_pwrkey *pwrkey = platform_get_drvdata(pdev);
+   int ret;
+   u8 mask, val;
+   bool reset = system_state == SYSTEM_RESTART;
+
+   if (pwrkey-shutdown_fn) {
+   ret = pwrkey-shutdown_fn(pwrkey, reset);
+   if (ret)
+   return;
+   }
+
+   /*
+* Select action to perform (reset or shutdown) when PS_HOLD goes low.
+* Also ensure that KPD, CBL0, and CBL1 pull ups are enabled and that
+* USB charging is enabled.
+*/
+   mask = PON_CNTL_1_PULL_UP_EN | PON_CNTL_1_USB_PWR_EN;
+   mask |= PON_CNTL_1_WD_EN_RESET;
+   val = mask;
+   if (!reset)
+   val = ~PON_CNTL_1_WD_EN_RESET;
+
+   regmap_update_bits(pwrkey-regmap, PON_CNTL_1, mask, val);
+}
+
+/*
+ * Set an SMPS regulator to be disabled in its CTRL register, but enabled
+ * in the master enable register.  Also set it's pull down enable bit.
+ * Take care to make sure that the output voltage doesn't change if switching
+ * from advanced mode to legacy mode.
+ */
+static int pm8058_disable_smps_locally_set_pull_down(struct regmap *regmap,
+   u16 ctrl_addr, u16 test2_addr, u16 

[PATCH 2/3] ARM: qcom: Add coincell charger driver

2015-07-13 Thread Tim Bird
This driver is used to configure the coincell charger found in
Qualcomm PMICs.

The driver allows configuring the current-limiting resistor for
the charger, as well as the voltage to apply to the coincell
(or capacitor) when charging.

Signed-off-by: Tim Bird tim.b...@sonymobile.com
---
 drivers/misc/Kconfig |  11 
 drivers/misc/Makefile|   1 +
 drivers/misc/qcom-coincell.c | 154 +++
 3 files changed, 166 insertions(+)
 create mode 100644 drivers/misc/qcom-coincell.c

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 42c3852..0909869 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -271,6 +271,17 @@ config HP_ILO
  To compile this driver as a module, choose M here: the
  module will be called hpilo.
 
+config QCOM_COINCELL
+   tristate Qualcomm coincell charger support
+   depends on OF
+   select REGMAP
+   help
+ This driver supports the coincell block found inside of
+ Qualcomm PMICs.  The coincell charger provides a means to
+ charge a coincell battery or backup capacitor which is used
+ to maintain PMIC register and RTC state in the absence of
+ external power.
+
 config SGI_GRU
tristate SGI GRU driver
depends on X86_UV  SMP
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index d056fb7..537d7f3 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_LKDTM)   += lkdtm.o
 obj-$(CONFIG_TIFM_CORE)+= tifm_core.o
 obj-$(CONFIG_TIFM_7XX1)+= tifm_7xx1.o
 obj-$(CONFIG_PHANTOM)  += phantom.o
+obj-$(CONFIG_QCOM_COINCELL)+= qcom-coincell.o
 obj-$(CONFIG_SENSORS_BH1780)   += bh1780gli.o
 obj-$(CONFIG_SENSORS_BH1770)   += bh1770glc.o
 obj-$(CONFIG_SENSORS_APDS990X) += apds990x.o
diff --git a/drivers/misc/qcom-coincell.c b/drivers/misc/qcom-coincell.c
new file mode 100644
index 000..9c019e4
--- /dev/null
+++ b/drivers/misc/qcom-coincell.c
@@ -0,0 +1,154 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015, Sony Mobile Communications Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/slab.h
+#include linux/of.h
+#include linux/regmap.h
+#include linux/of_device.h
+#include linux/platform_device.h
+
+struct qcom_coincell {
+   struct device   *dev;
+   struct regmap   *regmap;
+   u32 base_addr;
+};
+
+#define QCOM_COINCELL_REG_RSET 0x44
+#define QCOM_COINCELL_REG_VSET 0x45
+#define QCOM_COINCELL_REG_ENABLE   0x46
+
+#define QCOM_COINCELL_ENABLE   BIT(7)
+
+static const int qcom_rset_map[] = {2100, 1700, 1200, 800};
+static const int qcom_vset_map[] = {2500, 3200, 3100, 3000};
+/* NOTE: for pm8921 and others, voltage of 2500 is 16 (1b), not 0 */
+
+static int qcom_coincell_chgr_config(struct qcom_coincell *chgr, int rset,
+int vset, int enable)
+{
+   int i, rc;
+   unsigned int value;
+
+   /* select current-limiting resistor */
+   for (i = 0; i  ARRAY_SIZE(qcom_rset_map); i++)
+   if (rset == qcom_rset_map[i])
+   break;
+
+   if (i = ARRAY_SIZE(qcom_rset_map)) {
+   dev_err(chgr-dev, invalid rset-ohms value %d\n, rset);
+   return -EINVAL;
+   }
+
+   rc = regmap_write(chgr-regmap,
+ chgr-base_addr + QCOM_COINCELL_REG_RSET, i);
+   if (rc)
+   dev_err(chgr-dev, could not write to RSET register\n);
+   return rc;
+
+   /* select charge voltage */
+   for (i = 0; i  ARRAY_SIZE(qcom_vset_map); i++)
+   if (vset == qcom_vset_map[i])
+   break;
+
+   if (i = ARRAY_SIZE(qcom_vset_map)) {
+   dev_err(chgr-dev, invalid vset-millivolts value %d\n, vset);
+   return -EINVAL;
+   }
+
+   rc = regmap_write(chgr-regmap,
+   chgr-base_addr + QCOM_COINCELL_REG_VSET, i);
+   if (rc)
+   dev_err(chgr-dev, could not write to VSET register\n);
+   return rc;
+
+   /* set 'enable' register */
+   value = enable ? QCOM_COINCELL_ENABLE : 0;
+   rc = regmap_write(chgr-regmap,
+ chgr-base_addr + QCOM_COINCELL_REG_ENABLE, value);
+   if (rc)
+   dev_err(chgr-dev, could not write to ENABLE register\n);
+
+   return rc;
+}
+
+static int qcom_coincell_probe(struct 

[PATCH 1/3] ARM: dts: qcom: Add binding for the qcom coincell charger

2015-07-13 Thread Tim Bird
This binding is used to configure the driver for the coincell charger
found in Qualcomm PMICs.

Signed-off-by: Tim Bird tim.b...@sonymobile.com
---
 .../bindings/power/qcom,coincell-charger.txt   | 44 ++
 1 file changed, 44 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/power/qcom,coincell-charger.txt

diff --git a/Documentation/devicetree/bindings/power/qcom,coincell-charger.txt 
b/Documentation/devicetree/bindings/power/qcom,coincell-charger.txt
new file mode 100644
index 000..bf39e2a
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/qcom,coincell-charger.txt
@@ -0,0 +1,44 @@
+Qualcomm Coincell Charger:
+
+The hardware block controls charging for a coincell or capacitor that is
+used to provide power backup for certain features of the power management
+IC (PMIC)
+
+- compatible:
+   Usage: required
+   Value type: string
+   Definition: must be: qcom,pm8941-coincell
+
+- reg:
+   Usage: required
+   Value type: u32
+   Definition: base address of the coincell charger registers
+
+- qcom,rset-ohms:
+   Usage: required
+   Value type: u32
+   Definition: resistance (in ohms) for current-limiting resistor
+   must be one of: 800, 1200, 1700, 2100
+
+- qcom,vset-millivolts:
+   Usage: required
+   Value type: u32
+   Definition: voltage (in millivolts) to apply for charging
+   must be one of: 2500, 3000, 3100, 3200
+
+- qcom,charge-enable:
+   Usage: optional
+   Value type: u32 or none
+   Definition: definining this property, with an optional non-zero
+   value, enables charging
+
+Examples:
+
+   qcom,coincell@2800 {
+   compatible = qcom,pm8941-coincell;
+   reg = 0x2800;
+
+   qcom,rset-ohms = 2100;
+   qcom,vset-millivolts = 3000;
+   qcom,charge-enable;
+   };
--
1.8.2.2

--
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/10] drm/misc: Kconfig cleanup

2015-07-13 Thread Alex Deucher
On Mon, Jul 13, 2015 at 2:36 AM, Archit Taneja arch...@codeaurora.org wrote:
 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

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


 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

 ___
 dri-devel mailing list
 dri-de...@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
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] pinctrl: qcom: Hook pm_power_down for shutdown support

2015-07-13 Thread Bjorn Andersson
On Mon 06 Jul 18:09 PDT 2015, Stephen Boyd wrote:

 Assign pm_power_off() if we have the PS_HOLD functionality so
 that we can properly shutdown the SoC. Otherwise, shutdown won't
 do anything besides put the CPU into a tight loop. Unfortunately,
 we have to use a singleton here because pm_power_off() doesn't
 take any arguments. Fortunately there's only one instance of the
 pinctrl device on a running system so this isn't a problem.
 
 Cc: Bjorn Andersson bjorn.anders...@sonymobile.com
 Cc: Pramod Gurav pramod.gu...@smartplayin.com
 Signed-off-by: Stephen Boyd sb...@codeaurora.org


I do find it odd that there's generic handling for restart but only the
crude way pm_power_off to shut the system down... But this seems to be
the way it should be done...

Acked-by: Bjorn Andersson bjorn.anders...@sonymobile.com

Regards,
Bjorn
--
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] Input: pmic8xxx-pwrkey - Support shutdown

2015-07-13 Thread Stephen Boyd
On 07/13, Bjorn Andersson wrote:
 On Mon 06 Jul 18:08 PDT 2015, Stephen Boyd wrote:
 
  On pm8xxx PMICs, shutdown and restart are signaled to the PMIC
  via a pin called PS_HOLD. When this pin goes low, the PMIC
  performs a configurable power sequence. Add a .shutdown hook so
  that we can properly configure this power sequence for shutdown
  or restart depending on the system state.
  
  Signed-off-by: Stephen Boyd sb...@codeaurora.org
  ---
   drivers/input/misc/pmic8xxx-pwrkey.c | 287 
  ++-
   1 file changed, 280 insertions(+), 7 deletions(-)
  
  diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c 
  b/drivers/input/misc/pmic8xxx-pwrkey.c
 
 [..]
 
   
   /**
* struct pmic8xxx_pwrkey - pmic8xxx pwrkey information
* @key_press_irq: key press irq number
  + * @regmap: device regmap
 
 Please also document the shutdown_fn.

Sure.

 
*/
   struct pmic8xxx_pwrkey {
  int key_press_irq;
  +   struct regmap *regmap;
  +   int (*shutdown_fn)(struct pmic8xxx_pwrkey *, bool);
  +};
  +
  +struct pm8xxx_nbs {
  +   int (*shutdown_fn)(struct pmic8xxx_pwrkey *, bool);
   };
 
 This struct is unused.

Thanks. I switched the approach half-way through and forgot to
delete this struct.

-- 
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] Input: pmic8xxx-pwrkey - Support shutdown

2015-07-13 Thread Bjorn Andersson
On Mon 13 Jul 16:30 PDT 2015, Stephen Boyd wrote:

 On pm8xxx PMICs, shutdown and restart are signaled to the PMIC
 via a pin called PS_HOLD. When this pin goes low, the PMIC
 performs a configurable power sequence. Add a .shutdown hook so
 that we can properly configure this power sequence for shutdown
 or restart depending on the system state.
 
 Cc: Bjorn Andersson bjorn.anders...@sonymobile.com
 Signed-off-by: Stephen Boyd sb...@codeaurora.org
 ---
  drivers/input/misc/pmic8xxx-pwrkey.c | 284 
 ++-
  1 file changed, 277 insertions(+), 7 deletions(-)
 

Reviewed-by: Bjorn Andersson bjorn.anders...@sonymobile.com

Regards,
Bjorn
--
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 3/3] ARM: dts: qcom: Add dts changes for qcom coincell charger

2015-07-13 Thread Tim Bird
Add framework for the coincell charger DT block in pm8941 file, and
actual values for honami battery in the honami dts file.

Signed-off-by: Tim Bird tim.b...@sonymobile.com
---
 arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts | 11 +++
 arch/arm/boot/dts/qcom-pm8941.dtsi|  6 ++
 2 files changed, 17 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts 
b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts
index bd35b06..a7440fd 100644
--- a/arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts
+++ b/arch/arm/boot/dts/qcom-msm8974-sony-xperia-honami.dts
@@ -17,3 +17,14 @@
status = ok;
};
 };
+
+spmi_bus {
+   pm8941@0 {
+   qcom,coincell@2800 {
+   status = ok;
+   qcom,rset-ohms = 2100;
+   qcom,vset-millivolts = 3000;
+   qcom,charge-enable;
+   };
+   };
+};
diff --git a/arch/arm/boot/dts/qcom-pm8941.dtsi 
b/arch/arm/boot/dts/qcom-pm8941.dtsi
index aa774e6..a7d9c4b 100644
--- a/arch/arm/boot/dts/qcom-pm8941.dtsi
+++ b/arch/arm/boot/dts/qcom-pm8941.dtsi
@@ -125,6 +125,12 @@
interrupts = 0x0 0x36 0x0 IRQ_TYPE_EDGE_RISING;
qcom,external-resistor-micro-ohms = 1;
};
+
+   qcom,coincell@2800 {
+   compatible = qcom,pm8941-coincell;
+   reg = 0x2800;
+   status = disabled;
+   };
};
 
usid1: pm8941@1 {
-- 
1.8.2.2

--
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 v7 0/9] Add simple NVMEM Framework via regmap.

2015-07-13 Thread Srinivas Kandagatla



On 13/07/15 21:11, Stefan Wahren wrote:

Hi Srinivas,


Srinivas Kandagatla srinivas.kandaga...@linaro.org hat am 13. Juli 2015 um
21:35 geschrieben:

On 13/07/15 19:54, Stefan Wahren wrote:

Hi Srinivas,


[...]

Providers APIs:
nvmem_register/unregister();


How do i get the cell info from the devicetree into the nvmem_config?


Not sure what is the real use-case here, But this is how it is supposed
to work.

cellinfo in nvmem_config is used to pass cell information in non-dt
style to the core. The core would parse it and convert into nvmem-cells.
Am not sure why would you want to do other way round. Could you explain
the real use case here?



my question comes from porting mxs_ocotp to NVMEM framework.

Here is the devicetree part:

ocotp: ocotp@8002c000 {
compatible = fsl,imx28-ocotp, fsl,ocotp;
#address-cells = 1;
#size-cells = 1;
reg = 0x8002c000 0x2000;
clocks = clks 25;
read-only;

/* Data cells */
ocotp_customer: costumer@20 {
reg = 0x20 0x10;
};

ocotp_rom0: rom0@1a0 {
reg = 0x1a0 0x4;
};
};

After calling nvmem_register() in the provider driver [1] no data cell is
registered. So
i looked at the core code and i thought that retrieving the cell info and put it
into the nvmem_config
is job of the provider driver.

Did i missed something?

Ok,
There are 2 possible ways to specify nvmem cells
1 via the DT cell entries.
2 via provider driver directly using cell_info struct.

In the ocotp case its done via dt, so you dont need pass the cell info 
in nvmem_config.


You should also note that cell structure in DT is only created when an 
attempt to access is made as the provider lookup is straight forward in 
this case. In non-DT case the cell structure is created immediately and 
added to the global cell list.



--srini


[1] -
https://github.com/lategoodbye/fsl_ocotp/commit/7c98e19755b69f761885b0e1ceb2c258a7c47ade







...


userspace interface: binary file in /sys/bus/nvmem/devices/*/nvmem

ex:
hexdump /sys/bus/nvmem/devices/qfprom0/nvmem

000        
*
0a0 db10 2240  e000 0c00 0c00  0c00
000        
...
*
0001000


Since we're entering userspace the behavior should be clear.

How do we treat register gaps? Fill them with zero?

nvmem file would read full nvmem size which is passed to it as regmap.
So It would dump whatever the provider returns.


Sure, but wouldn't it be nice if different provider behave the same?




--srini


Best regards
Stefan


--
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 06/11] mfd: qcom-smd-rpm: Driver for the Qualcomm RPM over SMD

2015-07-13 Thread Bjorn Andersson
On Tue 07 Jul 05:37 PDT 2015, Lee Jones wrote:

 On Fri, 26 Jun 2015, bj...@kryo.se wrote:
 
  From: Bjorn Andersson bjorn.anders...@sonymobile.com
[..]

  diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig

[..]

  +config MFD_QCOM_SMD_RPM
  +   tristate Qualcomm Resource Power Manager (RPM) over SMD
  +   depends on QCOM_SMD  OF
  +   help
  + If you say yes to this option, support will be included for the
  + Resource Power Manager system found in the Qualcomm 8974 based
  + devices.
  +
  + This is required to access many regulators, clocks and bus
  + frequencies controlled by the RPM on these devices.
  +
  + Say M here if you want to include support for the Qualcomm RPM as a
  + module. This will build a module called qcom-smd-rpm.
 
 I'm not exactly sure what makes this an MFD device.
 

It represents a piece of hardware (a micro-controller) that exposes
control of a multitude of regulators and clocks in the Qualcomm
platforms.

It's basically just a successor of the qcom_rpm driver - same
functionality but a new communication method is used.

[..]

  diff --git a/drivers/mfd/qcom-smd-rpm.c b/drivers/mfd/qcom-smd-rpm.c

[..]

  +
  +#define RPM_ERR_INVALID_RESOURCE resource does not exist
 
 I don't like this at all.
 

Which part of it?

It should probably be a static const char *, inlined in the function
below. Would that be to your liking?

  +static int qcom_smd_rpm_callback(struct qcom_smd_device *qsdev,
  +const void *data,
  +size_t count)
  +{
  +   const struct qcom_rpm_header *hdr = data;
  +   const struct qcom_rpm_message *msg;
  +   const size_t inv_res_len = sizeof(RPM_ERR_INVALID_RESOURCE) - 1;
  +   struct qcom_smd_rpm *rpm = dev_get_drvdata(qsdev-dev);
  +   const u8 *buf = data + sizeof(struct qcom_rpm_header);
  +   const u8 *end = buf + hdr-length;
  +   int status = 0;
  +
  +   if (hdr-service_type != RPM_SERVICE_TYPE_REQUEST ||
  +   hdr-length  sizeof(struct qcom_rpm_message)) {
  +   dev_err(qsdev-dev, invalid request\n);
  +   return 0;
  +   }
  +
  +   while (buf  end) {
  +   msg = (struct qcom_rpm_message *)buf;
  +   switch (msg-msg_type) {
  +   case RPM_MSG_TYPE_MSG_ID:
  +   break;
  +   case RPM_MSG_TYPE_ERR:
  +   if (msg-length == inv_res_len 
  +   !memcmp(msg-message,
  +   RPM_ERR_INVALID_RESOURCE,
  +   inv_res_len))
 
 strncpy(msg-message, resource does not exist, 23);
 

No, I want to compare the content of msg-message with the string
resource does not exist - as that's the only way to know what type of
error we got.

This is unfortunately how the protocol looks :/

  +   status = -ENXIO;
  +   else
  +   status = -EIO;
  +   break;
  +   }
  +
  +   buf = PTR_ALIGN(buf + 2 * sizeof(u32) + msg-length, 4);
  +   }
  +
  +   rpm-ack_status = status;
  +   complete(rpm-ack);
  +   return 0;
  +}
  +

[..]

  +
  +static struct qcom_smd_driver qcom_smd_rpm_driver = {
  +   .probe = qcom_smd_rpm_probe,
  +   .remove = qcom_smd_rpm_remove,
  +   .callback = qcom_smd_rpm_callback,
  +   .driver  = {
  +   .name  = qcom_smd_rpm,
  +   .owner = THIS_MODULE,
 
 Remove this line.
 

The module_qcom_smd_driver does not initialize the .owner, but to follow
the general direction of the kernel I can add that to the macro...

  +   .of_match_table = qcom_smd_rpm_of_match,
  +   },
  +};
  +
  +module_qcom_smd_driver(qcom_smd_rpm_driver);
  +
  +MODULE_AUTHOR(Bjorn Andersson bjorn.anders...@sonymobile.com);
  +MODULE_DESCRIPTION(Qualcomm SMD backed RPM driver);
  +MODULE_LICENSE(GPL v2);

Thanks,
Bjorn
--
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 04/11] soc: qcom: Add Shared Memory Driver

2015-07-13 Thread Bjorn Andersson
On Tue 07 Jul 06:45 PDT 2015, Georgi Djakov wrote:

 Hi Bjorn,
 Thank you for this patchset! Some nits and a question below.
 

Thank you!

 On 06/27/2015 12:50 AM, bj...@kryo.se wrote:
  From: Bjorn Andersson bjorn.anders...@sonymobile.com
  
  This adds the Qualcomm Shared Memory Driver (SMD) providing
  communication channels to remote processors, ontop of SMEM.
  
  Signed-off-by: Bjorn Andersson bjorn.anders...@sonymobile.com
  ---
   drivers/soc/qcom/Kconfig |8 +
   drivers/soc/qcom/Makefile|1 +
   drivers/soc/qcom/smd.c   | 1324 
  ++
   include/linux/soc/qcom/smd.h |   46 ++
   4 files changed, 1379 insertions(+)
   create mode 100644 drivers/soc/qcom/smd.c
   create mode 100644 include/linux/soc/qcom/smd.h
  
 [...]
  --- /dev/null
  +++ b/drivers/soc/qcom/smd.c
  @@ -0,0 +1,1324 @@
  +/*
  + * Copyright (c) 2015, Sony Mobile Communications AB.
  + * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
  + *
  + * This program is free software; you can redistribute it and/or modify
  + * it under the terms of the GNU General Public License version 2 and
  + * only version 2 as published by the Free Software Foundation.
  + *
  + * This program is distributed in the hope that it will be useful,
  + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  + * GNU General Public License for more details.
  + */
  +
  +#include linux/delay.h
 
 unused?
 

Right, used to just delay on the tx buffer being full, will drop.

 [...]
  +
  +#define GET_RX_CHANNEL_INFO(channel, param) \
  +   (channel-rx_info_word ? \
  +   channel-rx_info_word-param : \
  +   channel-rx_info-param)
  +
  +#define SET_RX_CHANNEL_INFO(channel, param, value) \
  +   (channel-rx_info_word ? \
  +   (channel-rx_info_word-param = value) : \
  +   (channel-rx_info-param = value))
  +
  +#define GET_TX_CHANNEL_INFO(channel, param) \
  +   (channel-rx_info_word ? \
 
 Maybe this should be tx_info_word?
 

There's no practical difference, but I'll update it.

  +   channel-tx_info_word-param : \
  +   channel-tx_info-param)
  +
  +#define SET_TX_CHANNEL_INFO(channel, param, value) \
  +   (channel-rx_info_word ? \
 
 ditto?
 

ditto...

  +   (channel-tx_info_word-param = value) : \
  +   (channel-tx_info-param = value))
  +
 [...]
  +   ret = qcom_smem_get(edge-edge_id, smem_fifo_item, fifo_base, 
  fifo_size);
  +   if (ret)
  +   goto free_name_and_channel;
  +
  +   /* The channel consist of a rx and tx fifo of equal size */
  +   fifo_size /= 2;
  +
  +   dev_dbg(smd-dev, new channel '%s' info-size: %d fifo-size: %zu\n,
 
 %zu for info-size?
 

Hmm, the compiler only complained about the fifo_size, but you're of
course right.

  + name, info_size, fifo_size);
  +
 
 [...]
  +static int __init qcom_smd_init(void)
  +{
  +   int ret;
  +
  +   ret = bus_register(qcom_smd_bus);
  +   if (ret) {
  +   pr_err(failed to register smd bus: %d\n, ret);
  +   return ret;
  +   }
  +
  +   return platform_driver_register(qcom_smd_driver);
  +}
  +arch_initcall(qcom_smd_init);
  +
  +static void __exit qcom_smd_exit(void)
  +{
  +   platform_driver_unregister(qcom_smd_driver);
  +   bus_unregister(qcom_smd_bus);
  +}
  +module_exit(qcom_smd_exit);
  +
 [...]
  +/**
  + * struct qcom_smd_driver - smd driver struct
  + * @driver:underlying device driver
  + * @probe: invoked when the smd channel is found
  + * @remove:invoked when the smd channel is closed
  + * @callback:  invoked when an inbound message is received on the 
  channel,
  + * should return 0 on success or -EBUSY if the data cannot be
  + * consumed at this time
  + */
  +struct qcom_smd_driver {
  +   struct device_driver driver;
  +   int (*probe)(struct qcom_smd_device *dev);
  +   void (*remove)(struct qcom_smd_device *dev);
  +   int (*callback)(struct qcom_smd_device *, const void *, size_t);
  +};
  +
  +int qcom_smd_driver_register(struct qcom_smd_driver *drv);
  +void qcom_smd_driver_unregister(struct qcom_smd_driver *drv);
  +
  +#define module_qcom_smd_driver(__smd_driver) \
  +   module_driver(__smd_driver, qcom_smd_driver_register, \
  + qcom_smd_driver_unregister)
  +
 
 This comment is mostly related to your RPM over SMD driver patch, as
 i have a RPM clock driver based on it. The RPM clock driver registers
 some fundamental stuff like XO and i had to hack smd-rpm to probe
 earlier, so that most other drivers can initialize. So i was wondering,
 what if we register the drivers on the bus earlier? What do you think?
 

My only concern would be that if we're calling
qcom_smd_driver_register() before the smd arch_initcall has registered
the bus it will fail.

Part of this I see no problem with modifying the rpm driver to register
earlier - and it would be 

Re: [PATCH v2 01/11] soc: qcom: Add device tree binding for SMEM

2015-07-13 Thread Bjorn Andersson
On Wed 08 Jul 16:56 PDT 2015, Stephen Boyd wrote:

 On 06/26/2015 02:50 PM, bj...@kryo.se wrote:
  += EXAMPLE
  +The following example shows the SMEM setup for MSM8974, with a main SMEM 
  region
  +at 0xfa0 and an auxiliary region at 0xfc428000:
  +
  +   reserved-memory {
  +   #address-cells = 1;
  +   #size-cells = 1;
  +   ranges;
  +
  +   smem_region: smem@fa0 {
  +   reg = 0xfa0 0x20;
  +   no-map;
  +   };
  +   };
  +
  +   smem@fa0 {
 
 This should be smem@fc428000 matching the first reg property. It's weird
 though, because if smem is using a secondary region it will be under the
 SoC node and have a reg property. Otherwise it would be directly under
 the root node and only have a memory-region. It would be nice if we
 could somehow move the rpm message ram (0xfc428000) into the
 reserved-memory node so that we could use memory-region for both regions.
 

I agree, the semantics here became a little bit odd.

I do not think we should list the 0xfc428000 region as a memory-region,
as it's device memory and I do like the fact that we don't repeat
ourselves with listing the memory-region as a reg.

Therefor I think this is the least ugly option, but the address in the
name of the node should be updated.

  +   compatible = qcom,smem;
  +
  +   memory-region = smem_region;
  +   reg = 0xfc428000 0x4000;
  +
  +   hwlocks = tcsr_mutex 3;
  +   };
 

Thanks,
Bjorn
--
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 1/2] clk: qcom: Add support for RPM Clocks

2015-07-13 Thread Bjorn Andersson
On Thu 09 Jul 08:22 PDT 2015, Georgi Djakov wrote:

 Hi Srini,
 
 On 07/09/2015 03:27 PM, Srinivas Kandagatla wrote:
  
  On 09/07/15 13:18, Georgi Djakov wrote:
  This patch adds initial support for clocks controlled by the RPM
  (Resource Power Manager) processor found on some Qualcomm SoCs.
 
  The RPM is a dedicated hardware engine for managing the shared
  SoC resources in order to keep the lowest power profile. It
  communicates with other hardware subsystems via shared memory
  and accepts clock requests, aggregates the requests and turns
  the clocks on/off or scales them on demand.
 
  This work is based on the codeaurora.org driver:
  https://www.codeaurora.org/cgit/quic/la/kernel/msm-3.10/tree/drivers/clk/qcom/clock-rpm.c
 
  Signed-off-by: Georgi Djakov georgi.dja...@linaro.org
  ---
drivers/clk/qcom/Makefile  |1 +
drivers/clk/qcom/clk-rpm.c |  164 
  
drivers/clk/qcom/clk-rpm.h |  137 
3 files changed, 302 insertions(+)
create mode 100644 drivers/clk/qcom/clk-rpm.c
create mode 100644 drivers/clk/qcom/clk-rpm.h
 
  diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile
  index 50b337a24a87..4d14a73ee4ed 100644
  --- a/drivers/clk/qcom/Makefile
  +++ b/drivers/clk/qcom/Makefile
  @@ -8,6 +8,7 @@ clk-qcom-y += clk-rcg2.o
clk-qcom-y += clk-branch.o
clk-qcom-y += clk-regmap-divider.o
clk-qcom-y += clk-regmap-mux.o
  +clk-qcom-y += clk-rpm.o
  
  Is this generic enough to be built by default. It will break builds on A 
  family whose rpm clocks are not based on SMD.
  
  IMO, this should be either renamed to clk-rpm-smd.* or only built with 
  SOC's which support rpm-clks based on SMD.
  
 
 There is no A-family RPM clock support in the upstream kernel yet,
 but sure, you are right, we want to build only what is actually used.
 Thanks for the suggestion!
 

Following the regulator naming I would suggest this being the
clk-smd-rpm driver - unless one driver is enough for both.

It should definitely be possible to build and boot a kernel with both a
family A and B rpm-clock driver compiled in. The details seems to be a
little bit different in the A driver, but I think that with this driver
as reference it should be an easy writeup.

Regards,
Bjorn
--
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 05/11] mfd: devicetree: bindings: Add Qualcomm SMD based RPM DT binding

2015-07-13 Thread Bjorn Andersson
On Tue 07 Jul 05:16 PDT 2015, Lee Jones wrote:

 FAO Mark and DT chaps,
 
  From: Bjorn Andersson bjorn.anders...@sonymobile.com
  
  Add binding documentation for the Qualcomm Resource Power Manager (RPM)
  using shared memory (Qualcomm SMD) as transport mechanism. This is found
  in 8974 and newer based devices.
  
  The binding currently describes the rpm itself and the regulator
  subnodes.
  
  Signed-off-by: Bjorn Andersson bjorn.anders...@sonymobile.com
  ---
   .../devicetree/bindings/mfd/qcom-rpm-smd.txt   | 117 
  +
   include/dt-bindings/mfd/qcom-smd-rpm.h |  28 +
   2 files changed, 145 insertions(+)
   create mode 100644 Documentation/devicetree/bindings/mfd/qcom-rpm-smd.txt
   create mode 100644 include/dt-bindings/mfd/qcom-smd-rpm.h
  
  diff --git a/Documentation/devicetree/bindings/mfd/qcom-rpm-smd.txt 
  b/Documentation/devicetree/bindings/mfd/qcom-rpm-smd.txt

[..]

  +- qcom,smd-channels:
  +   Usage: required
  +   Value type: stringlist
  +   Definition: Shared Memory channel used for communication with the RPM
 
 This is going to require a DT Ack.
 
 Also, I don't see it being used anywhere.
 

It's a common property of all smd devices, defining the smd channel this
driver should bind to.

  += SUBDEVICES
  +
  +The RPM exposes resources to its subnodes. The below bindings specify the 
  set
  +of valid subnodes that can operate on these resources.
  +
  +== Regulators
  +

[..]

  +The content of each sub-node is defined by the standard binding for 
  regulators -
  +see regulator.txt.
 
 s-regulator.txt-../regulator/regulator.txt-
 

Right.

  +
  += EXAMPLE
  +
  +   smd {
  +   compatible = qcom,smd;
 
 Is an SMD (Shared Memory Device?) real hardware?
 

SMD is a mechanism for using shared memory for point-to-point
communication channels with remote processors in all Qualcomm platforms.

So it's not hardware, it's the control mechanism for communicating with
real hardware.

  +   rpm {
  +   interrupts = 0 168 1;
  +   qcom,ipc = apcs 8 0;
  +   qcom,smd-edge = 15;
 
 The child node won't probe without a compatible string.  Shouldn't
 qcom,rpm-msm8974 be in here instead?
 

These sub-nodes represents a logical grouping of the various channels
that exist to this remote processor. For the rpm there is only the
rpm_requests channel - used for sending regulator  clock requests.

  +   rpm_requests {
 
 This node appears to be undocumented.
 

This is the actual rpm device node, the smd  rpm nodes above are
included for completeness of the example.

They should perhaps be dropped to make this clearer.

 Does it represent real h/w?
 

The other end of this smd channel is a micro controller that handles
regulator and clock requests for the platform - so this is hardware.

This is equivalent to the qcom_rpm driver, but instead of a hardware
like register window this uses the same packet based messaging mechanism
that's used for other remote peripherals in the Qualcomm platform.

  +   compatible = qcom,rpm-msm8974;
  +   qcom,smd-channels = rpm_requests;
  +
  +   pm8941-regulators {
  +   compatible = 
  qcom,rpm-pm8941-regulators;
  +   vdd_l13_l20_l23_l24-supply = 
  pm8941_boost;
 
 I'd like Mark to glance at this.
 

Right.

  +   pm8941_s3: s3 {
  +   regulator-min-microvolt = 
  180;
  +   regulator-max-microvolt = 
  180;
 
 Aren't these fixed regulators?
 

In this system configuration most of the regulators have fixed values,
but the regulators (hw) are not fixed.

  +   };
  +
  +   pm8941_boost: s4 {
  +   regulator-min-microvolt = 
  500;
  +   regulator-max-microvolt = 
  500;
  +   };
  +
  +   pm8941_l20: l20 {
  +   regulator-min-microvolt = 
  295;
  +   regulator-max-microvolt = 
  295;
  +   };
  +   };
  +   };
  +   };
  +   };
  +

Thanks,
Bjorn
--
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] Input: pmic8xxx-pwrkey - Support shutdown

2015-07-13 Thread Dmitry Torokhov
Hi Stephen,

On Mon, Jul 13, 2015 at 04:30:34PM -0700, Stephen Boyd wrote:
 On pm8xxx PMICs, shutdown and restart are signaled to the PMIC
 via a pin called PS_HOLD. When this pin goes low, the PMIC
 performs a configurable power sequence. Add a .shutdown hook so
 that we can properly configure this power sequence for shutdown
 or restart depending on the system state.

Just a bit of bikeshedding on my part...

 
 Cc: Bjorn Andersson bjorn.anders...@sonymobile.com
 Signed-off-by: Stephen Boyd sb...@codeaurora.org
 ---
  drivers/input/misc/pmic8xxx-pwrkey.c | 284 
 ++-
  1 file changed, 277 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c 
 b/drivers/input/misc/pmic8xxx-pwrkey.c
 index c4ca20e63221..1d1ee5951b3a 100644
 --- a/drivers/input/misc/pmic8xxx-pwrkey.c
 +++ b/drivers/input/misc/pmic8xxx-pwrkey.c
 @@ -20,17 +20,72 @@
  #include linux/regmap.h
  #include linux/log2.h
  #include linux/of.h
 +#include linux/of_device.h
  
  #define PON_CNTL_1 0x1C
  #define PON_CNTL_PULL_UP BIT(7)
  #define PON_CNTL_TRIG_DELAY_MASK (0x7)
 +#define PON_CNTL_1_PULL_UP_EN0xe0
 +#define PON_CNTL_1_USB_PWR_EN0x10
 +#define PON_CNTL_1_WD_EN_RESET   0x08
 +
 +#define PM8058_SLEEP_CTRL0x02b
 +#define PM8921_SLEEP_CTRL0x10a
 +
 +#define SLEEP_CTRL_SMPL_EN_RESET 0x04
 +
 +/* Regulator master enable addresses */
 +#define REG_PM8058_VREG_EN_MSM   0x018
 +#define REG_PM8058_VREG_EN_GRP_5_4   0x1C8
 +
 +/* Regulator control registers for shutdown/reset */
 +#define PM8058_S0_CTRL   0x004
 +#define PM8058_S1_CTRL   0x005
 +#define PM8058_S3_CTRL   0x111
 +#define PM8058_L21_CTRL  0x120
 +#define PM8058_L22_CTRL  0x121
 +
 +#define PM8058_REGULATOR_ENABLE_MASK 0x80
 +#define PM8058_REGULATOR_ENABLE  0x80
 +#define PM8058_REGULATOR_DISABLE 0x00
 +#define PM8058_REGULATOR_PULL_DOWN_MASK  0x40
 +#define PM8058_REGULATOR_PULL_DOWN_EN0x40
 +
 +/* Buck CTRL register */
 +#define PM8058_SMPS_LEGACY_VREF_SEL  0x20
 +#define PM8058_SMPS_LEGACY_VPROG_MASK0x1F
 +#define PM8058_SMPS_ADVANCED_BAND_MASK   0xC0
 +#define PM8058_SMPS_ADVANCED_BAND_SHIFT  6
 +#define PM8058_SMPS_ADVANCED_VPROG_MASK  0x3F
 +
 +/* Buck TEST2 registers for shutdown/reset */
 +#define PM8058_S0_TEST2  0x084
 +#define PM8058_S1_TEST2  0x085
 +#define PM8058_S3_TEST2  0x11A
 +
 +#define PM8058_REGULATOR_BANK_WRITE  0x80
 +#define PM8058_REGULATOR_BANK_MASK   0x70
 +#define PM8058_REGULATOR_BANK_SHIFT  4
 +#define PM8058_REGULATOR_BANK_SEL(n) ((n)  PM8058_REGULATOR_BANK_SHIFT)
 +
 +/* Buck TEST2 register bank 1 */
 +#define PM8058_SMPS_LEGACY_VLOW_SEL  0x01
 +
 +/* Buck TEST2 register bank 7 */
 +#define PM8058_SMPS_ADVANCED_MODE_MASK   0x02
 +#define PM8058_SMPS_ADVANCED_MODE0x02
 +#define PM8058_SMPS_LEGACY_MODE  0x00
  
  /**
   * struct pmic8xxx_pwrkey - pmic8xxx pwrkey information
   * @key_press_irq: key press irq number
 + * @regmap: device regmap
 + * @shutdown_fn: shutdown configuration function
   */
  struct pmic8xxx_pwrkey {
   int key_press_irq;
 + struct regmap *regmap;
 + int (*shutdown_fn)(struct pmic8xxx_pwrkey *, bool);
  };
  
  static irqreturn_t pwrkey_press_irq(int irq, void *_pwr)
 @@ -76,6 +131,220 @@ static int __maybe_unused pmic8xxx_pwrkey_resume(struct 
 device *dev)
  static SIMPLE_DEV_PM_OPS(pm8xxx_pwr_key_pm_ops,
   pmic8xxx_pwrkey_suspend, pmic8xxx_pwrkey_resume);
  
 +static void pmic8xxx_pwrkey_shutdown(struct platform_device *pdev)
 +{
 + struct pmic8xxx_pwrkey *pwrkey = platform_get_drvdata(pdev);
 + int ret;
 + u8 mask, val;
 + bool reset = system_state == SYSTEM_RESTART;
 +
 + if (pwrkey-shutdown_fn) {
 + ret = pwrkey-shutdown_fn(pwrkey, reset);
 + if (ret)
 + return;

Can we call this variable error please?

 + }
 +
 + /*
 +  * Select action to perform (reset or shutdown) when PS_HOLD goes low.
 +  * Also ensure that KPD, CBL0, and CBL1 pull ups are enabled and that
 +  * USB charging is enabled.
 +  */
 + mask = PON_CNTL_1_PULL_UP_EN | PON_CNTL_1_USB_PWR_EN;
 + mask |= PON_CNTL_1_WD_EN_RESET;
 + val = mask;
 + if (!reset)
 + val = ~PON_CNTL_1_WD_EN_RESET;
 +
 + regmap_update_bits(pwrkey-regmap, PON_CNTL_1, mask, val);
 +}
 +
 +/*
 + * Set an SMPS regulator to be disabled in its CTRL register, but enabled
 + * in the master enable register.  Also set it's pull 

Re: [PATCH v2] Input: pmic8xxx-pwrkey - Support shutdown

2015-07-13 Thread Stephen Boyd

On 07/13/2015 05:25 PM, Dmitry Torokhov wrote:


@@ -76,6 +131,220 @@ static int __maybe_unused pmic8xxx_pwrkey_resume(struct 
device *dev)
  static SIMPLE_DEV_PM_OPS(pm8xxx_pwr_key_pm_ops,
pmic8xxx_pwrkey_suspend, pmic8xxx_pwrkey_resume);
  
+static void pmic8xxx_pwrkey_shutdown(struct platform_device *pdev)

+{
+   struct pmic8xxx_pwrkey *pwrkey = platform_get_drvdata(pdev);
+   int ret;
+   u8 mask, val;
+   bool reset = system_state == SYSTEM_RESTART;
+
+   if (pwrkey-shutdown_fn) {
+   ret = pwrkey-shutdown_fn(pwrkey, reset);
+   if (ret)
+   return;

Can we call this variable error please?


Ok.




+   }
+
+   /*
+* Select action to perform (reset or shutdown) when PS_HOLD goes low.
+* Also ensure that KPD, CBL0, and CBL1 pull ups are enabled and that
+* USB charging is enabled.
+*/
+   mask = PON_CNTL_1_PULL_UP_EN | PON_CNTL_1_USB_PWR_EN;
+   mask |= PON_CNTL_1_WD_EN_RESET;
+   val = mask;
+   if (!reset)
+   val = ~PON_CNTL_1_WD_EN_RESET;
+
+   regmap_update_bits(pwrkey-regmap, PON_CNTL_1, mask, val);
+}
+
+/*
+ * Set an SMPS regulator to be disabled in its CTRL register, but enabled
+ * in the master enable register.  Also set it's pull down enable bit.
+ * Take care to make sure that the output voltage doesn't change if switching
+ * from advanced mode to legacy mode.
+ */
+static int pm8058_disable_smps_locally_set_pull_down(struct regmap *regmap,
+   u16 ctrl_addr, u16 test2_addr, u16 master_enable_addr,
+   u8 master_enable_bit)
+{
+   int ret = 0;

Why does it need to be initialized? And error too please.


Doesn't need to be.




+
+   /* Enable LDO in master control register. */
+   ret = regmap_update_bits(regmap, master_enable_addr,
+   master_enable_bit, master_enable_bit);
+   if (ret)
+   return ret;
+
+   /* Disable LDO in CTRL register and set pull down */
+   return regmap_update_bits(regmap, ctrl_addr,
+   PM8058_REGULATOR_ENABLE_MASK | PM8058_REGULATOR_PULL_DOWN_MASK,
+   PM8058_REGULATOR_DISABLE | PM8058_REGULATOR_PULL_DOWN_EN);
+}
+
+static int pm8058_pwrkey_shutdown(struct pmic8xxx_pwrkey *pwrkey, bool reset)
+{
+   int ret;

And here.


Ok.




+   struct regmap *regmap = pwrkey-regmap;
+   u8 mask, val;
+
+   /* When shutting down, enable active pulldowns on important rails. */
+   if (!reset) {
+   /* Disable SMPS's 0,1,3 locally and set pulldown enable bits. */
+   pm8058_disable_smps_locally_set_pull_down(regmap,
+   PM8058_S0_CTRL, PM8058_S0_TEST2,
+   REG_PM8058_VREG_EN_MSM, BIT(7));
+   pm8058_disable_smps_locally_set_pull_down(regmap,
+   PM8058_S1_CTRL, PM8058_S1_TEST2,
+   REG_PM8058_VREG_EN_MSM, BIT(6));
+   pm8058_disable_smps_locally_set_pull_down(regmap,
+   PM8058_S3_CTRL, PM8058_S3_TEST2,
+   REG_PM8058_VREG_EN_GRP_5_4, BIT(7) | BIT(4));
+   /* Disable LDO 21 locally and set pulldown enable bit. */
+   pm8058_disable_ldo_locally_set_pull_down(regmap,
+   PM8058_L21_CTRL, REG_PM8058_VREG_EN_GRP_5_4,
+   BIT(1));
+   }
+
+   /*
+* Fix-up: Set regulator LDO22 to 1.225 V in high power mode. Leave its
+* pull-down state intact. This ensures a safe shutdown.
+*/
+   ret = regmap_update_bits(regmap, PM8058_L22_CTRL, 0xbf, 0x93);
+   if (ret)
+   return ret;
+
+   /* Enable SMPL if resetting is desired */
+   mask = SLEEP_CTRL_SMPL_EN_RESET;
+   val = 0;
+   if (reset)
+   val = mask;
+   return regmap_update_bits(regmap, PM8058_SLEEP_CTRL, mask, val);
+

Stray empty line.


Ok.




+}
+
+static int pm8921_pwrkey_shutdown(struct pmic8xxx_pwrkey *pwrkey, bool reset)
+{
+   struct regmap *regmap = pwrkey-regmap;
+   u8 mask = SLEEP_CTRL_SMPL_EN_RESET;
+   u8 val = 0;
+
+   /* Enable SMPL if resetting is desired */
+   if (reset)
+   val = mask;
+   return regmap_update_bits(regmap, PM8921_SLEEP_CTRL, mask, val);
+}
+
+static const struct of_device_id pm8xxx_pwr_key_id_table[] = {
+   { .compatible = qcom,pm8058-pwrkey, .data = pm8058_pwrkey_shutdown },
+   { .compatible = qcom,pm8921-pwrkey, .data = pm8921_pwrkey_shutdown },
+   { }
+};
+MODULE_DEVICE_TABLE(of, pm8xxx_pwr_key_id_table);
+

Can we please keep IDs and device table where it was, close to the
driver definition?


That would require forward declaring the array here. Is that desired? I 
moved it so that I could use it in the probe function.


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

--
To unsubscribe from this list: send the 

Re: [PATCH v2] Input: pmic8xxx-pwrkey - Support shutdown

2015-07-13 Thread Stephen Boyd

On 07/13/2015 05:46 PM, Dmitry Torokhov wrote:

On Mon, Jul 13, 2015 at 05:34:57PM -0700, Stephen Boyd wrote:

On 07/13/2015 05:25 PM, Dmitry Torokhov wrote:

+
+static const struct of_device_id pm8xxx_pwr_key_id_table[] = {
+   { .compatible = qcom,pm8058-pwrkey, .data = pm8058_pwrkey_shutdown },
+   { .compatible = qcom,pm8921-pwrkey, .data = pm8921_pwrkey_shutdown },
+   { }
+};
+MODULE_DEVICE_TABLE(of, pm8xxx_pwr_key_id_table);
+

Can we please keep IDs and device table where it was, close to the
driver definition?

That would require forward declaring the array here. Is that
desired? I moved it so that I could use it in the probe function.

Ah, yes, OF data is not passed into probe() :(... But we can always do:

match = of_match_device(pdev-dev.driver-of_match_table, pdev-dev);

Maybe we could have a helper for this like:

const struct of_device_id *of_get_current_match(struct device *dev)
{
return dev-drv ?
of_match_device(dev-driver-of_match_table, dev) :
NULL;
}


Nice. I'll update and Cc the OF maintainers.

--
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] Input: pmic8xxx-pwrkey - Support shutdown

2015-07-13 Thread Stephen Boyd

On 07/13/2015 05:58 PM, Stephen Boyd wrote:

On 07/13/2015 05:46 PM, Dmitry Torokhov wrote:

On Mon, Jul 13, 2015 at 05:34:57PM -0700, Stephen Boyd wrote:

On 07/13/2015 05:25 PM, Dmitry Torokhov wrote:

+
+static const struct of_device_id pm8xxx_pwr_key_id_table[] = {
+{ .compatible = qcom,pm8058-pwrkey, .data = 
pm8058_pwrkey_shutdown },
+{ .compatible = qcom,pm8921-pwrkey, .data = 
pm8921_pwrkey_shutdown },

+{ }
+};
+MODULE_DEVICE_TABLE(of, pm8xxx_pwr_key_id_table);
+

Can we please keep IDs and device table where it was, close to the
driver definition?

That would require forward declaring the array here. Is that
desired? I moved it so that I could use it in the probe function.

Ah, yes, OF data is not passed into probe() :(... But we can always do:

match = of_match_device(pdev-dev.driver-of_match_table, 
pdev-dev);


Maybe we could have a helper for this like:

const struct of_device_id *of_get_current_match(struct device *dev)
{
return dev-drv ?
of_match_device(dev-driver-of_match_table, dev) :
NULL;
}


Nice. I'll update and Cc the OF maintainers.



Actually, this already exists I just didn't know. See 
of_device_get_match_data().


--
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
--- 

[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


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

2015-07-13 Thread Daniel Vetter
On Mon, Jul 13, 2015 at 12:12:05PM +0530, Archit Taneja wrote:
 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

Ah I guess you can disregard some of my comments here. Since this was
in-reply-to the old thread but step 1 wasn't I've read the patches
out-of-order ;-)
-Daniel

 
  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
 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
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, 

[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


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

2015-07-13 Thread Daniel Vetter
On Mon, Jul 13, 2015 at 12:12:06PM +0530, Archit Taneja wrote:
 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.

Maybe add an If unsure say Y. here.

 +
  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)
 +{
 +  

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

2015-07-13 Thread Daniel Vetter
On Mon, Jul 13, 2015 at 12:12:11PM +0530, Archit Taneja wrote:
 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

Hm, your new generic fbdev emulation doesn't select the FB helpers we need
here, which probably breaks compilation. I think we just need to add all
these selects to the new core fbev emulation config - most drivers want
them anyway. And even for the drivers that have their own drawing routines
(udl and qxl afaik) the only thing they do is wrap calls to the -dirty
callback around the cfb helpers. And we probably want to move this to the
fbdev helper library eventually anyway.

 - 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

Hm for i915 I'd prefer to just replace one Kconfig symbol with the new one
and leave all the #ifdefs around. We try hard to remove all the fbdev
related code completely and that won't be the case when reintroducing some
of the runtime checks like you do. We could do something like

#ifdef CONFIG_DRM_FBDEV_EMULATION
#define HAS_FBDEV(dev_priv) 0
#else
#define HAS_FBDEV(dev_priv) ((dev_priv)-fbdev)
#endif

though. But really doing that is not your job ;-)

Cheers, Daniel

   /* 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 

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

2015-07-13 Thread Daniel Vetter
On Mon, Jul 13, 2015 at 12:07:58PM +0530, Archit Taneja wrote:
 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)

In anticipation of adding a runtime knob for fbdev emulation, shouldn't we
be checking for
if (fb_helper  fb_helper-fbdev)

here? Applies to all the other patches too.

Other big missing thing is (simple) kerneldoc for all these new functions.
-Daniel

 + 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
 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
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 03/25] drm/fb_helper: Create wrappers for fb_sys_read/write funcs

2015-07-13 Thread Daniel Vetter
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.
-Daniel

 + return fb_sys_read(info, buf, count, ppos);
 +
 + return -ENODEV;
 +}
 +EXPORT_SYMBOL(drm_fb_helper_sys_read);
 +
 +ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
 + size_t count, loff_t *ppos)
 +{
 + if (info)
 + return fb_sys_write(info, buf, count, ppos);
 +
 + return -ENODEV;
 +}
 +EXPORT_SYMBOL(drm_fb_helper_sys_write);
 +
  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 4c90837..f74e59e 100644
 --- a/include/drm/drm_fb_helper.h
 +++ b/include/drm/drm_fb_helper.h
 @@ -147,6 +147,11 @@ void drm_fb_helper_fill_fix(struct fb_info *info, 
 uint32_t pitch,
  
  void drm_fb_helper_unlink_fbi(struct drm_fb_helper *fb_helper);
  
 +ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
 + size_t count, loff_t *ppos);
 +ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
 + size_t count, loff_t *ppos);
 +
  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
 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
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 10/21] drm/qxl: Remove FB_KMS_HELPER and FB related config options

2015-07-13 Thread Daniel Vetter
On Mon, Jul 13, 2015 at 12:13:57PM +0530, 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.
 
 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.

Yeah if more drivers grow a -dirty callback that does something we'd
probably want to pull all that code out of qxl/udl into core fbdev. i915
now also has a dirty callback, but for fbcon we're going with a slightly
different options: Since all our frontbuffer dirtying are for optional
features we just disable them right now.

Anyway just an idea for future patches when someone works in this area.
For now I think we simply have to select the relevant options if FBDEV
emulation is enabled.
 
 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

I.e.
select FB_DEFERRED_IO if DRM_FBDEV_EMULATION

   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

and using CONFIG_DMR_FBDEV_EMULATION here instead. Same for udl changes.
-Daniel

  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
 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
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


  1   2   >