summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/gma500/intel_i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/gma500/intel_i2c.c')
-rw-r--r--drivers/gpu/drm/gma500/intel_i2c.c57
1 files changed, 23 insertions, 34 deletions
diff --git a/drivers/gpu/drm/gma500/intel_i2c.c b/drivers/gpu/drm/gma500/intel_i2c.c
index 98a28c209555..9d02a7b6d9a3 100644
--- a/drivers/gpu/drm/gma500/intel_i2c.c
+++ b/drivers/gpu/drm/gma500/intel_i2c.c
@@ -1,25 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright © 2006-2007 Intel Corporation
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
* Authors:
* Eric Anholt <eric@anholt.net>
*/
+
+#include <linux/delay.h>
#include <linux/export.h>
-#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
+#include <linux/i2c.h>
#include "psb_drv.h"
#include "psb_intel_reg.h"
@@ -32,7 +22,7 @@
static int get_clock(void *data)
{
- struct psb_intel_i2c_chan *chan = data;
+ struct gma_i2c_chan *chan = data;
struct drm_device *dev = chan->drm_dev;
u32 val;
@@ -42,7 +32,7 @@ static int get_clock(void *data)
static int get_data(void *data)
{
- struct psb_intel_i2c_chan *chan = data;
+ struct gma_i2c_chan *chan = data;
struct drm_device *dev = chan->drm_dev;
u32 val;
@@ -52,7 +42,7 @@ static int get_data(void *data)
static void set_clock(void *data, int state_high)
{
- struct psb_intel_i2c_chan *chan = data;
+ struct gma_i2c_chan *chan = data;
struct drm_device *dev = chan->drm_dev;
u32 reserved = 0, clock_bits;
@@ -72,7 +62,7 @@ static void set_clock(void *data, int state_high)
static void set_data(void *data, int state_high)
{
- struct psb_intel_i2c_chan *chan = data;
+ struct gma_i2c_chan *chan = data;
struct drm_device *dev = chan->drm_dev;
u32 reserved = 0, data_bits;
@@ -93,9 +83,8 @@ static void set_data(void *data, int state_high)
}
/**
- * psb_intel_i2c_create - instantiate an Intel i2c bus using the specified GPIO reg
+ * gma_i2c_create - instantiate an Intel i2c bus using the specified GPIO reg
* @dev: DRM device
- * @output: driver specific output device
* @reg: GPIO reg to use
* @name: name for this bus
*
@@ -113,21 +102,21 @@ static void set_data(void *data, int state_high)
* %GPIOH
* see PRM for details on how these different busses are used.
*/
-struct psb_intel_i2c_chan *psb_intel_i2c_create(struct drm_device *dev,
- const u32 reg, const char *name)
+struct gma_i2c_chan *gma_i2c_create(struct drm_device *dev, const u32 reg,
+ const char *name)
{
- struct psb_intel_i2c_chan *chan;
+ struct gma_i2c_chan *chan;
- chan = kzalloc(sizeof(struct psb_intel_i2c_chan), GFP_KERNEL);
+ chan = kzalloc(sizeof(struct gma_i2c_chan), GFP_KERNEL);
if (!chan)
goto out_free;
chan->drm_dev = dev;
chan->reg = reg;
- snprintf(chan->adapter.name, I2C_NAME_SIZE, "intel drm %s", name);
- chan->adapter.owner = THIS_MODULE;
- chan->adapter.algo_data = &chan->algo;
- chan->adapter.dev.parent = &dev->pdev->dev;
+ snprintf(chan->base.name, I2C_NAME_SIZE, "intel drm %s", name);
+ chan->base.owner = THIS_MODULE;
+ chan->base.algo_data = &chan->algo;
+ chan->base.dev.parent = dev->dev;
chan->algo.setsda = set_data;
chan->algo.setscl = set_clock;
chan->algo.getsda = get_data;
@@ -136,9 +125,9 @@ struct psb_intel_i2c_chan *psb_intel_i2c_create(struct drm_device *dev,
chan->algo.timeout = usecs_to_jiffies(2200);
chan->algo.data = chan;
- i2c_set_adapdata(&chan->adapter, chan);
+ i2c_set_adapdata(&chan->base, chan);
- if (i2c_bit_add_bus(&chan->adapter))
+ if (i2c_bit_add_bus(&chan->base))
goto out_free;
/* JJJ: raise SCL and SDA? */
@@ -154,16 +143,16 @@ out_free:
}
/**
- * psb_intel_i2c_destroy - unregister and free i2c bus resources
- * @output: channel to free
+ * gma_i2c_destroy - unregister and free i2c bus resources
+ * @chan: channel to free
*
* Unregister the adapter from the i2c layer, then free the structure.
*/
-void psb_intel_i2c_destroy(struct psb_intel_i2c_chan *chan)
+void gma_i2c_destroy(struct gma_i2c_chan *chan)
{
if (!chan)
return;
- i2c_del_adapter(&chan->adapter);
+ i2c_del_adapter(&chan->base);
kfree(chan);
}