Commit 04477e5e authored by Patrik Jakobsson's avatar Patrik Jakobsson

drm/gma500: Use gma_ prefix for our i2c abstraction

psb_intel_i2c_chan is used by all chips so use the correct prefix.
Signed-off-by: default avatarPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220601092311.22648-2-patrik.r.jakobsson@gmail.com
parent 01ece651
...@@ -194,7 +194,7 @@ static void cdv_intel_crt_destroy(struct drm_connector *connector) ...@@ -194,7 +194,7 @@ static void cdv_intel_crt_destroy(struct drm_connector *connector)
struct gma_connector *gma_connector = to_gma_connector(connector); struct gma_connector *gma_connector = to_gma_connector(connector);
struct gma_encoder *gma_encoder = gma_attached_encoder(connector); struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_i2c_destroy(gma_encoder->ddc_bus); gma_i2c_destroy(gma_encoder->ddc_bus);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(gma_connector); kfree(gma_connector);
} }
...@@ -267,7 +267,7 @@ void cdv_intel_crt_init(struct drm_device *dev, ...@@ -267,7 +267,7 @@ void cdv_intel_crt_init(struct drm_device *dev,
gma_connector_attach_encoder(gma_connector, gma_encoder); gma_connector_attach_encoder(gma_connector, gma_encoder);
/* Set up the DDC bus. */ /* Set up the DDC bus. */
gma_encoder->ddc_bus = psb_intel_i2c_create(dev, GPIOA, "CRTDDC_A"); gma_encoder->ddc_bus = gma_i2c_create(dev, GPIOA, "CRTDDC_A");
if (!gma_encoder->ddc_bus) { if (!gma_encoder->ddc_bus) {
dev_printk(KERN_ERR, dev->dev, "DDC bus registration failed.\n"); dev_printk(KERN_ERR, dev->dev, "DDC bus registration failed.\n");
goto failed_ddc; goto failed_ddc;
......
...@@ -245,7 +245,7 @@ static void cdv_hdmi_destroy(struct drm_connector *connector) ...@@ -245,7 +245,7 @@ static void cdv_hdmi_destroy(struct drm_connector *connector)
struct gma_connector *gma_connector = to_gma_connector(connector); struct gma_connector *gma_connector = to_gma_connector(connector);
struct gma_encoder *gma_encoder = gma_attached_encoder(connector); struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_i2c_destroy(gma_encoder->i2c_bus); gma_i2c_destroy(gma_encoder->i2c_bus);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(gma_connector); kfree(gma_connector);
} }
...@@ -342,8 +342,8 @@ void cdv_hdmi_init(struct drm_device *dev, ...@@ -342,8 +342,8 @@ void cdv_hdmi_init(struct drm_device *dev,
break; break;
} }
gma_encoder->i2c_bus = psb_intel_i2c_create(dev, gma_encoder->i2c_bus = gma_i2c_create(dev, ddc_bus,
ddc_bus, (reg == SDVOB) ? "HDMIB" : "HDMIC"); (reg == SDVOB) ? "HDMIB" : "HDMIC");
if (!gma_encoder->i2c_bus) { if (!gma_encoder->i2c_bus) {
dev_err(dev->dev, "No ddc adapter available!\n"); dev_err(dev->dev, "No ddc adapter available!\n");
......
...@@ -329,7 +329,7 @@ static void cdv_intel_lvds_destroy(struct drm_connector *connector) ...@@ -329,7 +329,7 @@ static void cdv_intel_lvds_destroy(struct drm_connector *connector)
struct gma_connector *gma_connector = to_gma_connector(connector); struct gma_connector *gma_connector = to_gma_connector(connector);
struct gma_encoder *gma_encoder = gma_attached_encoder(connector); struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_i2c_destroy(gma_encoder->i2c_bus); gma_i2c_destroy(gma_encoder->i2c_bus);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(gma_connector); kfree(gma_connector);
} }
...@@ -550,9 +550,7 @@ void cdv_intel_lvds_init(struct drm_device *dev, ...@@ -550,9 +550,7 @@ void cdv_intel_lvds_init(struct drm_device *dev,
* Set up I2C bus * Set up I2C bus
* FIXME: distroy i2c_bus when exit * FIXME: distroy i2c_bus when exit
*/ */
gma_encoder->i2c_bus = psb_intel_i2c_create(dev, gma_encoder->i2c_bus = gma_i2c_create(dev, GPIOB, "LVDSBLC_B");
GPIOB,
"LVDSBLC_B");
if (!gma_encoder->i2c_bus) { if (!gma_encoder->i2c_bus) {
dev_printk(KERN_ERR, dev_printk(KERN_ERR,
dev->dev, "I2C bus registration failed.\n"); dev->dev, "I2C bus registration failed.\n");
...@@ -572,9 +570,7 @@ void cdv_intel_lvds_init(struct drm_device *dev, ...@@ -572,9 +570,7 @@ void cdv_intel_lvds_init(struct drm_device *dev,
*/ */
/* Set up the DDC bus. */ /* Set up the DDC bus. */
gma_encoder->ddc_bus = psb_intel_i2c_create(dev, gma_encoder->ddc_bus = gma_i2c_create(dev, GPIOC, "LVDSDDC_C");
GPIOC,
"LVDSDDC_C");
if (!gma_encoder->ddc_bus) { if (!gma_encoder->ddc_bus) {
dev_printk(KERN_ERR, dev->dev, dev_printk(KERN_ERR, dev->dev,
"DDC bus registration " "failed.\n"); "DDC bus registration " "failed.\n");
...@@ -652,10 +648,10 @@ void cdv_intel_lvds_init(struct drm_device *dev, ...@@ -652,10 +648,10 @@ void cdv_intel_lvds_init(struct drm_device *dev,
failed_find: failed_find:
mutex_unlock(&dev->mode_config.mutex); mutex_unlock(&dev->mode_config.mutex);
pr_err("Failed find\n"); pr_err("Failed find\n");
psb_intel_i2c_destroy(gma_encoder->ddc_bus); gma_i2c_destroy(gma_encoder->ddc_bus);
failed_ddc: failed_ddc:
pr_err("Failed DDC\n"); pr_err("Failed DDC\n");
psb_intel_i2c_destroy(gma_encoder->i2c_bus); gma_i2c_destroy(gma_encoder->i2c_bus);
failed_blc_i2c: failed_blc_i2c:
pr_err("Failed BLC\n"); pr_err("Failed BLC\n");
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
static int get_clock(void *data) 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; struct drm_device *dev = chan->drm_dev;
u32 val; u32 val;
...@@ -32,7 +32,7 @@ static int get_clock(void *data) ...@@ -32,7 +32,7 @@ static int get_clock(void *data)
static int get_data(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; struct drm_device *dev = chan->drm_dev;
u32 val; u32 val;
...@@ -42,7 +42,7 @@ static int get_data(void *data) ...@@ -42,7 +42,7 @@ static int get_data(void *data)
static void set_clock(void *data, int state_high) 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; struct drm_device *dev = chan->drm_dev;
u32 reserved = 0, clock_bits; u32 reserved = 0, clock_bits;
...@@ -62,7 +62,7 @@ static void set_clock(void *data, int state_high) ...@@ -62,7 +62,7 @@ static void set_clock(void *data, int state_high)
static void set_data(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; struct drm_device *dev = chan->drm_dev;
u32 reserved = 0, data_bits; u32 reserved = 0, data_bits;
...@@ -83,7 +83,7 @@ static void set_data(void *data, int state_high) ...@@ -83,7 +83,7 @@ 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 * @dev: DRM device
* @reg: GPIO reg to use * @reg: GPIO reg to use
* @name: name for this bus * @name: name for this bus
...@@ -102,12 +102,12 @@ static void set_data(void *data, int state_high) ...@@ -102,12 +102,12 @@ static void set_data(void *data, int state_high)
* %GPIOH * %GPIOH
* see PRM for details on how these different busses are used. * see PRM for details on how these different busses are used.
*/ */
struct psb_intel_i2c_chan *psb_intel_i2c_create(struct drm_device *dev, struct gma_i2c_chan *gma_i2c_create(struct drm_device *dev, const u32 reg,
const u32 reg, const char *name) 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) if (!chan)
goto out_free; goto out_free;
...@@ -143,12 +143,12 @@ struct psb_intel_i2c_chan *psb_intel_i2c_create(struct drm_device *dev, ...@@ -143,12 +143,12 @@ struct psb_intel_i2c_chan *psb_intel_i2c_create(struct drm_device *dev,
} }
/** /**
* psb_intel_i2c_destroy - unregister and free i2c bus resources * gma_i2c_destroy - unregister and free i2c bus resources
* @chan: channel to free * @chan: channel to free
* *
* Unregister the adapter from the i2c layer, then free the structure. * 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) if (!chan)
return; return;
......
...@@ -408,7 +408,7 @@ void oaktrail_lvds_init(struct drm_device *dev, ...@@ -408,7 +408,7 @@ void oaktrail_lvds_init(struct drm_device *dev,
dev_dbg(dev->dev, "No LVDS modes found, disabling.\n"); dev_dbg(dev->dev, "No LVDS modes found, disabling.\n");
if (gma_encoder->ddc_bus) { if (gma_encoder->ddc_bus) {
psb_intel_i2c_destroy(gma_encoder->ddc_bus); gma_i2c_destroy(gma_encoder->ddc_bus);
gma_encoder->ddc_bus = NULL; gma_encoder->ddc_bus = NULL;
} }
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
static int get_clock(void *data) static int get_clock(void *data)
{ {
struct psb_intel_i2c_chan *chan = data; struct gma_i2c_chan *chan = data;
u32 val; u32 val;
val = LPC_READ_REG(chan, RGIO); val = LPC_READ_REG(chan, RGIO);
...@@ -79,7 +79,7 @@ static int get_clock(void *data) ...@@ -79,7 +79,7 @@ static int get_clock(void *data)
static int get_data(void *data) static int get_data(void *data)
{ {
struct psb_intel_i2c_chan *chan = data; struct gma_i2c_chan *chan = data;
u32 val; u32 val;
val = LPC_READ_REG(chan, RGIO); val = LPC_READ_REG(chan, RGIO);
...@@ -93,7 +93,7 @@ static int get_data(void *data) ...@@ -93,7 +93,7 @@ static int get_data(void *data)
static void set_clock(void *data, int state_high) static void set_clock(void *data, int state_high)
{ {
struct psb_intel_i2c_chan *chan = data; struct gma_i2c_chan *chan = data;
u32 val; u32 val;
if (state_high) { if (state_high) {
...@@ -112,7 +112,7 @@ static void set_clock(void *data, int state_high) ...@@ -112,7 +112,7 @@ static void set_clock(void *data, int state_high)
static void set_data(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;
u32 val; u32 val;
if (state_high) { if (state_high) {
...@@ -134,9 +134,9 @@ void oaktrail_lvds_i2c_init(struct drm_encoder *encoder) ...@@ -134,9 +134,9 @@ void oaktrail_lvds_i2c_init(struct drm_encoder *encoder)
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct gma_encoder *gma_encoder = to_gma_encoder(encoder); struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
struct drm_psb_private *dev_priv = to_drm_psb_private(dev); struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
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) if (!chan)
return; return;
......
...@@ -469,7 +469,7 @@ struct drm_psb_private { ...@@ -469,7 +469,7 @@ struct drm_psb_private {
struct drm_display_mode *sdvo_lvds_vbt_mode; struct drm_display_mode *sdvo_lvds_vbt_mode;
struct bdb_lvds_backlight *lvds_bl; /* LVDS backlight info from VBT */ struct bdb_lvds_backlight *lvds_bl; /* LVDS backlight info from VBT */
struct psb_intel_i2c_chan *lvds_i2c_bus; /* FIXME: Remove this? */ struct gma_i2c_chan *lvds_i2c_bus; /* FIXME: Remove this? */
/* Feature bits from the VBIOS */ /* Feature bits from the VBIOS */
unsigned int int_tv_support:1; unsigned int int_tv_support:1;
......
...@@ -78,7 +78,7 @@ struct psb_intel_mode_device { ...@@ -78,7 +78,7 @@ struct psb_intel_mode_device {
uint32_t saveBLC_PWM_CTL; uint32_t saveBLC_PWM_CTL;
}; };
struct psb_intel_i2c_chan { struct gma_i2c_chan {
/* for getting at dev. private (mmio etc.) */ /* for getting at dev. private (mmio etc.) */
struct drm_device *drm_dev; struct drm_device *drm_dev;
u32 reg; /* GPIO reg */ u32 reg; /* GPIO reg */
...@@ -103,8 +103,8 @@ struct gma_encoder { ...@@ -103,8 +103,8 @@ struct gma_encoder {
/* FIXME: Either make SDVO and LVDS store it's i2c here or give CDV it's /* FIXME: Either make SDVO and LVDS store it's i2c here or give CDV it's
own set of output privates */ own set of output privates */
struct psb_intel_i2c_chan *i2c_bus; struct gma_i2c_chan *i2c_bus;
struct psb_intel_i2c_chan *ddc_bus; struct gma_i2c_chan *ddc_bus;
}; };
struct gma_connector { struct gma_connector {
...@@ -176,9 +176,9 @@ struct gma_crtc { ...@@ -176,9 +176,9 @@ struct gma_crtc {
#define to_psb_intel_framebuffer(x) \ #define to_psb_intel_framebuffer(x) \
container_of(x, struct psb_intel_framebuffer, base) container_of(x, struct psb_intel_framebuffer, base)
struct psb_intel_i2c_chan *psb_intel_i2c_create(struct drm_device *dev, struct gma_i2c_chan *gma_i2c_create(struct drm_device *dev, const u32 reg,
const u32 reg, const char *name); const char *name);
void psb_intel_i2c_destroy(struct psb_intel_i2c_chan *chan); void gma_i2c_destroy(struct gma_i2c_chan *chan);
int psb_intel_ddc_get_modes(struct drm_connector *connector, int psb_intel_ddc_get_modes(struct drm_connector *connector,
struct i2c_adapter *adapter); struct i2c_adapter *adapter);
extern bool psb_intel_ddc_probe(struct i2c_adapter *adapter); extern bool psb_intel_ddc_probe(struct i2c_adapter *adapter);
......
...@@ -49,8 +49,8 @@ struct psb_intel_lvds_priv { ...@@ -49,8 +49,8 @@ struct psb_intel_lvds_priv {
uint32_t savePFIT_PGM_RATIOS; uint32_t savePFIT_PGM_RATIOS;
uint32_t saveBLC_PWM_CTL; uint32_t saveBLC_PWM_CTL;
struct psb_intel_i2c_chan *i2c_bus; struct gma_i2c_chan *i2c_bus;
struct psb_intel_i2c_chan *ddc_bus; struct gma_i2c_chan *ddc_bus;
}; };
...@@ -90,7 +90,7 @@ static int psb_lvds_i2c_set_brightness(struct drm_device *dev, ...@@ -90,7 +90,7 @@ static int psb_lvds_i2c_set_brightness(struct drm_device *dev,
{ {
struct drm_psb_private *dev_priv = to_drm_psb_private(dev); struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
struct psb_intel_i2c_chan *lvds_i2c_bus = dev_priv->lvds_i2c_bus; struct gma_i2c_chan *lvds_i2c_bus = dev_priv->lvds_i2c_bus;
u8 out_buf[2]; u8 out_buf[2];
unsigned int blc_i2c_brightness; unsigned int blc_i2c_brightness;
...@@ -525,7 +525,7 @@ void psb_intel_lvds_destroy(struct drm_connector *connector) ...@@ -525,7 +525,7 @@ void psb_intel_lvds_destroy(struct drm_connector *connector)
struct gma_encoder *gma_encoder = gma_attached_encoder(connector); struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
struct psb_intel_lvds_priv *lvds_priv = gma_encoder->dev_priv; struct psb_intel_lvds_priv *lvds_priv = gma_encoder->dev_priv;
psb_intel_i2c_destroy(lvds_priv->ddc_bus); gma_i2c_destroy(lvds_priv->ddc_bus);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(gma_connector); kfree(gma_connector);
} }
...@@ -695,7 +695,7 @@ void psb_intel_lvds_init(struct drm_device *dev, ...@@ -695,7 +695,7 @@ void psb_intel_lvds_init(struct drm_device *dev,
* Set up I2C bus * Set up I2C bus
* FIXME: distroy i2c_bus when exit * FIXME: distroy i2c_bus when exit
*/ */
lvds_priv->i2c_bus = psb_intel_i2c_create(dev, GPIOB, "LVDSBLC_B"); lvds_priv->i2c_bus = gma_i2c_create(dev, GPIOB, "LVDSBLC_B");
if (!lvds_priv->i2c_bus) { if (!lvds_priv->i2c_bus) {
dev_printk(KERN_ERR, dev_printk(KERN_ERR,
dev->dev, "I2C bus registration failed.\n"); dev->dev, "I2C bus registration failed.\n");
...@@ -715,7 +715,7 @@ void psb_intel_lvds_init(struct drm_device *dev, ...@@ -715,7 +715,7 @@ void psb_intel_lvds_init(struct drm_device *dev,
*/ */
/* Set up the DDC bus. */ /* Set up the DDC bus. */
lvds_priv->ddc_bus = psb_intel_i2c_create(dev, GPIOC, "LVDSDDC_C"); lvds_priv->ddc_bus = gma_i2c_create(dev, GPIOC, "LVDSDDC_C");
if (!lvds_priv->ddc_bus) { if (!lvds_priv->ddc_bus) {
dev_printk(KERN_ERR, dev->dev, dev_printk(KERN_ERR, dev->dev,
"DDC bus registration " "failed.\n"); "DDC bus registration " "failed.\n");
...@@ -786,9 +786,9 @@ void psb_intel_lvds_init(struct drm_device *dev, ...@@ -786,9 +786,9 @@ void psb_intel_lvds_init(struct drm_device *dev,
failed_find: failed_find:
mutex_unlock(&dev->mode_config.mutex); mutex_unlock(&dev->mode_config.mutex);
psb_intel_i2c_destroy(lvds_priv->ddc_bus); gma_i2c_destroy(lvds_priv->ddc_bus);
failed_ddc: failed_ddc:
psb_intel_i2c_destroy(lvds_priv->i2c_bus); gma_i2c_destroy(lvds_priv->i2c_bus);
failed_blc_i2c: failed_blc_i2c:
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment