mirror of https://gitee.com/openkylin/linux.git
drm/gma500: Convert to use new SCU IPC API
Convert the GMA500 driver to use the new SCU IPC API. This allows us to get rid of the duplicate PMC IPC implementation which is now covered in SCU IPC driver. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
5c8fe583cc
commit
bfc838f859
|
@ -30,6 +30,7 @@ config DRM_GMA3600
|
||||||
config DRM_MEDFIELD
|
config DRM_MEDFIELD
|
||||||
bool "Intel Medfield support (Experimental)"
|
bool "Intel Medfield support (Experimental)"
|
||||||
depends on DRM_GMA500 && X86_INTEL_MID
|
depends on DRM_GMA500 && X86_INTEL_MID
|
||||||
|
select INTEL_SCU_IPC
|
||||||
help
|
help
|
||||||
Say yes to include support for the Intel Medfield platform.
|
Say yes to include support for the Intel Medfield platform.
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/gpio/machine.h>
|
#include <linux/gpio/machine.h>
|
||||||
|
|
||||||
#include <asm/intel_scu_ipc.h>
|
|
||||||
|
|
||||||
#include "mdfld_dsi_output.h"
|
#include "mdfld_dsi_output.h"
|
||||||
#include "mdfld_output.h"
|
#include "mdfld_output.h"
|
||||||
#include "mid_bios.h"
|
#include "mid_bios.h"
|
||||||
|
|
|
@ -30,8 +30,6 @@
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/gpio/consumer.h>
|
#include <linux/gpio/consumer.h>
|
||||||
|
|
||||||
#include <asm/intel_scu_ipc.h>
|
|
||||||
|
|
||||||
#include "mdfld_dsi_dpi.h"
|
#include "mdfld_dsi_dpi.h"
|
||||||
#include "mdfld_dsi_output.h"
|
#include "mdfld_dsi_output.h"
|
||||||
#include "mdfld_dsi_pkg_sender.h"
|
#include "mdfld_dsi_pkg_sender.h"
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
* Scott Rowe <scott.m.rowe@intel.com>
|
* Scott Rowe <scott.m.rowe@intel.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <asm/intel_scu_ipc.h>
|
||||||
|
|
||||||
#include "mdfld_output.h"
|
#include "mdfld_output.h"
|
||||||
#include "mdfld_dsi_dpi.h"
|
#include "mdfld_dsi_dpi.h"
|
||||||
#include "mdfld_dsi_output.h"
|
#include "mdfld_dsi_output.h"
|
||||||
|
@ -58,11 +60,14 @@ static void mdfld_init_panel(struct drm_device *dev, int mipi_pipe,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int mdfld_output_init(struct drm_device *dev)
|
int mdfld_output_init(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||||
|
|
||||||
|
dev_priv->scu = devm_intel_scu_ipc_dev_get(&dev->pdev->dev);
|
||||||
|
if (!dev_priv->scu)
|
||||||
|
return -EPROBE_DEFER;
|
||||||
|
|
||||||
/* FIXME: hardcoded for now */
|
/* FIXME: hardcoded for now */
|
||||||
dev_priv->mdfld_panel_id = TC35876X;
|
dev_priv->mdfld_panel_id = TC35876X;
|
||||||
/* MIPI panel 1 */
|
/* MIPI panel 1 */
|
||||||
|
@ -71,4 +76,3 @@ int mdfld_output_init(struct drm_device *dev)
|
||||||
mdfld_init_panel(dev, 1, HDMI);
|
mdfld_init_panel(dev, 1, HDMI);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
#include <linux/dmi.h>
|
#include <linux/dmi.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
|
||||||
#include <asm/intel-mid.h>
|
|
||||||
#include <asm/intel_scu_ipc.h>
|
|
||||||
|
|
||||||
#include <drm/drm.h>
|
#include <drm/drm.h>
|
||||||
|
|
||||||
#include "intel_bios.h"
|
#include "intel_bios.h"
|
||||||
|
|
|
@ -428,6 +428,8 @@ struct psb_ops;
|
||||||
|
|
||||||
#define PSB_NUM_PIPE 3
|
#define PSB_NUM_PIPE 3
|
||||||
|
|
||||||
|
struct intel_scu_ipc_dev;
|
||||||
|
|
||||||
struct drm_psb_private {
|
struct drm_psb_private {
|
||||||
struct drm_device *dev;
|
struct drm_device *dev;
|
||||||
struct pci_dev *aux_pdev; /* Currently only used by mrst */
|
struct pci_dev *aux_pdev; /* Currently only used by mrst */
|
||||||
|
@ -567,6 +569,7 @@ struct drm_psb_private {
|
||||||
* Used for modifying backlight from
|
* Used for modifying backlight from
|
||||||
* xrandr -- consider removing and using HAL instead
|
* xrandr -- consider removing and using HAL instead
|
||||||
*/
|
*/
|
||||||
|
struct intel_scu_ipc_dev *scu;
|
||||||
struct backlight_device *backlight_device;
|
struct backlight_device *backlight_device;
|
||||||
struct drm_property *backlight_property;
|
struct drm_property *backlight_property;
|
||||||
bool backlight_enabled;
|
bool backlight_enabled;
|
||||||
|
|
|
@ -444,6 +444,7 @@ static inline u16 calc_clkdiv(unsigned long baseclk, unsigned int f)
|
||||||
|
|
||||||
static void tc35876x_brightness_init(struct drm_device *dev)
|
static void tc35876x_brightness_init(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
|
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||||
int ret;
|
int ret;
|
||||||
u8 pwmctrl;
|
u8 pwmctrl;
|
||||||
u16 clkdiv;
|
u16 clkdiv;
|
||||||
|
@ -451,23 +452,23 @@ static void tc35876x_brightness_init(struct drm_device *dev)
|
||||||
/* Make sure the PWM reference is the 19.2 MHz system clock. Read first
|
/* Make sure the PWM reference is the 19.2 MHz system clock. Read first
|
||||||
* instead of setting directly to catch potential conflicts between PWM
|
* instead of setting directly to catch potential conflicts between PWM
|
||||||
* users. */
|
* users. */
|
||||||
ret = intel_scu_ipc_ioread8(GPIOPWMCTRL, &pwmctrl);
|
ret = intel_scu_ipc_dev_ioread8(dev_priv->scu, GPIOPWMCTRL, &pwmctrl);
|
||||||
if (ret || pwmctrl != 0x01) {
|
if (ret || pwmctrl != 0x01) {
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(&dev->pdev->dev, "GPIOPWMCTRL read failed\n");
|
dev_err(&dev->pdev->dev, "GPIOPWMCTRL read failed\n");
|
||||||
else
|
else
|
||||||
dev_warn(&dev->pdev->dev, "GPIOPWMCTRL was not set to system clock (pwmctrl = 0x%02x)\n", pwmctrl);
|
dev_warn(&dev->pdev->dev, "GPIOPWMCTRL was not set to system clock (pwmctrl = 0x%02x)\n", pwmctrl);
|
||||||
|
|
||||||
ret = intel_scu_ipc_iowrite8(GPIOPWMCTRL, 0x01);
|
ret = intel_scu_ipc_dev_iowrite8(dev_priv->scu, GPIOPWMCTRL, 0x01);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(&dev->pdev->dev, "GPIOPWMCTRL set failed\n");
|
dev_err(&dev->pdev->dev, "GPIOPWMCTRL set failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
clkdiv = calc_clkdiv(SYSTEMCLK, PWM_FREQUENCY);
|
clkdiv = calc_clkdiv(SYSTEMCLK, PWM_FREQUENCY);
|
||||||
|
|
||||||
ret = intel_scu_ipc_iowrite8(PWM0CLKDIV1, (clkdiv >> 8) & 0xff);
|
ret = intel_scu_ipc_dev_iowrite8(dev_priv->scu, PWM0CLKDIV1, (clkdiv >> 8) & 0xff);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = intel_scu_ipc_iowrite8(PWM0CLKDIV0, clkdiv & 0xff);
|
ret = intel_scu_ipc_dev_iowrite8(dev_priv->scu, PWM0CLKDIV0, clkdiv & 0xff);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(&dev->pdev->dev, "PWM0CLKDIV set failed\n");
|
dev_err(&dev->pdev->dev, "PWM0CLKDIV set failed\n");
|
||||||
|
@ -480,6 +481,7 @@ static void tc35876x_brightness_init(struct drm_device *dev)
|
||||||
|
|
||||||
void tc35876x_brightness_control(struct drm_device *dev, int level)
|
void tc35876x_brightness_control(struct drm_device *dev, int level)
|
||||||
{
|
{
|
||||||
|
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||||
int ret;
|
int ret;
|
||||||
u8 duty_val;
|
u8 duty_val;
|
||||||
u8 panel_duty_val;
|
u8 panel_duty_val;
|
||||||
|
@ -495,7 +497,7 @@ void tc35876x_brightness_control(struct drm_device *dev, int level)
|
||||||
panel_duty_val = (2 * level - 100) * 0xA9 /
|
panel_duty_val = (2 * level - 100) * 0xA9 /
|
||||||
MDFLD_DSI_BRIGHTNESS_MAX_LEVEL + 0x56;
|
MDFLD_DSI_BRIGHTNESS_MAX_LEVEL + 0x56;
|
||||||
|
|
||||||
ret = intel_scu_ipc_iowrite8(PWM0DUTYCYCLE, duty_val);
|
ret = intel_scu_ipc_dev_iowrite8(dev_priv->scu, PWM0DUTYCYCLE, duty_val);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(&tc35876x_client->dev, "%s: ipc write fail\n",
|
dev_err(&tc35876x_client->dev, "%s: ipc write fail\n",
|
||||||
__func__);
|
__func__);
|
||||||
|
|
Loading…
Reference in New Issue