Commit 0c3f3a83 authored by Easwar Hariharan's avatar Easwar Hariharan Committed by Thomas Zimmermann

drm/gma500: Make I2C terminology more inclusive

I2C v7, SMBus 3.2, and I3C 1.1.1 specifications have replaced "master/slave"
with more appropriate terms. Inspired by Wolfram's series to fix drivers/i2c/,
fix the terminology for users of I2C_ALGOBIT bitbanging interface, now that
the approved verbiage exists in the specification.
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: default avatarEaswar Hariharan <eahariha@linux.microsoft.com>
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20240711052734.1273652-3-eahariha@linux.microsoft.com
parent 61671d85
...@@ -565,7 +565,7 @@ void cdv_intel_lvds_init(struct drm_device *dev, ...@@ -565,7 +565,7 @@ void cdv_intel_lvds_init(struct drm_device *dev,
dev->dev, "I2C bus registration failed.\n"); dev->dev, "I2C bus registration failed.\n");
goto err_encoder_cleanup; goto err_encoder_cleanup;
} }
gma_encoder->i2c_bus->slave_addr = 0x2C; gma_encoder->i2c_bus->target_addr = 0x2C;
dev_priv->lvds_i2c_bus = gma_encoder->i2c_bus; dev_priv->lvds_i2c_bus = gma_encoder->i2c_bus;
/* /*
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
#include "psb_intel_drv.h" #include "psb_intel_drv.h"
#include "psb_intel_reg.h" #include "psb_intel_reg.h"
#define SLAVE_ADDR1 0x70 #define TARGET_ADDR1 0x70
#define SLAVE_ADDR2 0x72 #define TARGET_ADDR2 0x72
static void *find_section(struct bdb_header *bdb, int section_id) static void *find_section(struct bdb_header *bdb, int section_id)
{ {
...@@ -357,10 +357,10 @@ parse_sdvo_device_mapping(struct drm_psb_private *dev_priv, ...@@ -357,10 +357,10 @@ parse_sdvo_device_mapping(struct drm_psb_private *dev_priv,
/* skip the device block if device type is invalid */ /* skip the device block if device type is invalid */
continue; continue;
} }
if (p_child->slave_addr != SLAVE_ADDR1 && if (p_child->target_addr != TARGET_ADDR1 &&
p_child->slave_addr != SLAVE_ADDR2) { p_child->target_addr != TARGET_ADDR2) {
/* /*
* If the slave address is neither 0x70 nor 0x72, * If the target address is neither 0x70 nor 0x72,
* it is not a SDVO device. Skip it. * it is not a SDVO device. Skip it.
*/ */
continue; continue;
...@@ -371,22 +371,22 @@ parse_sdvo_device_mapping(struct drm_psb_private *dev_priv, ...@@ -371,22 +371,22 @@ parse_sdvo_device_mapping(struct drm_psb_private *dev_priv,
DRM_DEBUG_KMS("Incorrect SDVO port. Skip it\n"); DRM_DEBUG_KMS("Incorrect SDVO port. Skip it\n");
continue; continue;
} }
DRM_DEBUG_KMS("the SDVO device with slave addr %2x is found on" DRM_DEBUG_KMS("the SDVO device with target addr %2x is found on"
" %s port\n", " %s port\n",
p_child->slave_addr, p_child->target_addr,
(p_child->dvo_port == DEVICE_PORT_DVOB) ? (p_child->dvo_port == DEVICE_PORT_DVOB) ?
"SDVOB" : "SDVOC"); "SDVOB" : "SDVOC");
p_mapping = &(dev_priv->sdvo_mappings[p_child->dvo_port - 1]); p_mapping = &(dev_priv->sdvo_mappings[p_child->dvo_port - 1]);
if (!p_mapping->initialized) { if (!p_mapping->initialized) {
p_mapping->dvo_port = p_child->dvo_port; p_mapping->dvo_port = p_child->dvo_port;
p_mapping->slave_addr = p_child->slave_addr; p_mapping->target_addr = p_child->target_addr;
p_mapping->dvo_wiring = p_child->dvo_wiring; p_mapping->dvo_wiring = p_child->dvo_wiring;
p_mapping->ddc_pin = p_child->ddc_pin; p_mapping->ddc_pin = p_child->ddc_pin;
p_mapping->i2c_pin = p_child->i2c_pin; p_mapping->i2c_pin = p_child->i2c_pin;
p_mapping->initialized = 1; p_mapping->initialized = 1;
DRM_DEBUG_KMS("SDVO device: dvo=%x, addr=%x, wiring=%d, ddc_pin=%d, i2c_pin=%d\n", DRM_DEBUG_KMS("SDVO device: dvo=%x, addr=%x, wiring=%d, ddc_pin=%d, i2c_pin=%d\n",
p_mapping->dvo_port, p_mapping->dvo_port,
p_mapping->slave_addr, p_mapping->target_addr,
p_mapping->dvo_wiring, p_mapping->dvo_wiring,
p_mapping->ddc_pin, p_mapping->ddc_pin,
p_mapping->i2c_pin); p_mapping->i2c_pin);
...@@ -394,10 +394,10 @@ parse_sdvo_device_mapping(struct drm_psb_private *dev_priv, ...@@ -394,10 +394,10 @@ parse_sdvo_device_mapping(struct drm_psb_private *dev_priv,
DRM_DEBUG_KMS("Maybe one SDVO port is shared by " DRM_DEBUG_KMS("Maybe one SDVO port is shared by "
"two SDVO device.\n"); "two SDVO device.\n");
} }
if (p_child->slave2_addr) { if (p_child->target2_addr) {
/* Maybe this is a SDVO device with multiple inputs */ /* Maybe this is a SDVO device with multiple inputs */
/* And the mapping info is not added */ /* And the mapping info is not added */
DRM_DEBUG_KMS("there exists the slave2_addr. Maybe this" DRM_DEBUG_KMS("there exists the target2_addr. Maybe this"
" is a SDVO device with multiple inputs.\n"); " is a SDVO device with multiple inputs.\n");
} }
count++; count++;
......
...@@ -186,13 +186,13 @@ struct child_device_config { ...@@ -186,13 +186,13 @@ struct child_device_config {
u16 addin_offset; u16 addin_offset;
u8 dvo_port; /* See Device_PORT_* above */ u8 dvo_port; /* See Device_PORT_* above */
u8 i2c_pin; u8 i2c_pin;
u8 slave_addr; u8 target_addr;
u8 ddc_pin; u8 ddc_pin;
u16 edid_ptr; u16 edid_ptr;
u8 dvo_cfg; /* See DEVICE_CFG_* above */ u8 dvo_cfg; /* See DEVICE_CFG_* above */
u8 dvo2_port; u8 dvo2_port;
u8 i2c2_pin; u8 i2c2_pin;
u8 slave2_addr; u8 target2_addr;
u8 ddc2_pin; u8 ddc2_pin;
u8 capabilities; u8 capabilities;
u8 dvo_wiring;/* See DEVICE_WIRE_* above */ u8 dvo_wiring;/* See DEVICE_WIRE_* above */
......
...@@ -333,7 +333,7 @@ gmbus_xfer(struct i2c_adapter *adapter, ...@@ -333,7 +333,7 @@ gmbus_xfer(struct i2c_adapter *adapter,
clear_err: clear_err:
/* Toggle the Software Clear Interrupt bit. This has the effect /* Toggle the Software Clear Interrupt bit. This has the effect
* of resetting the GMBUS controller and so clearing the * of resetting the GMBUS controller and so clearing the
* BUS_ERROR raised by the slave's NAK. * BUS_ERROR raised by the target's NAK.
*/ */
GMBUS_REG_WRITE(GMBUS1 + reg_offset, GMBUS_SW_CLR_INT); GMBUS_REG_WRITE(GMBUS1 + reg_offset, GMBUS_SW_CLR_INT);
GMBUS_REG_WRITE(GMBUS1 + reg_offset, 0); GMBUS_REG_WRITE(GMBUS1 + reg_offset, 0);
......
...@@ -202,7 +202,7 @@ struct psb_intel_opregion { ...@@ -202,7 +202,7 @@ struct psb_intel_opregion {
struct sdvo_device_mapping { struct sdvo_device_mapping {
u8 initialized; u8 initialized;
u8 dvo_port; u8 dvo_port;
u8 slave_addr; u8 target_addr;
u8 dvo_wiring; u8 dvo_wiring;
u8 i2c_pin; u8 i2c_pin;
u8 i2c_speed; u8 i2c_speed;
......
...@@ -80,7 +80,7 @@ struct psb_intel_mode_device { ...@@ -80,7 +80,7 @@ struct psb_intel_mode_device {
struct gma_i2c_chan { struct gma_i2c_chan {
struct i2c_adapter base; struct i2c_adapter base;
struct i2c_algo_bit_data algo; struct i2c_algo_bit_data algo;
u8 slave_addr; u8 target_addr;
/* for getting at dev. private (mmio etc.) */ /* for getting at dev. private (mmio etc.) */
struct drm_device *drm_dev; struct drm_device *drm_dev;
......
...@@ -97,7 +97,7 @@ static int psb_lvds_i2c_set_brightness(struct drm_device *dev, ...@@ -97,7 +97,7 @@ static int psb_lvds_i2c_set_brightness(struct drm_device *dev,
struct i2c_msg msgs[] = { struct i2c_msg msgs[] = {
{ {
.addr = lvds_i2c_bus->slave_addr, .addr = lvds_i2c_bus->target_addr,
.flags = 0, .flags = 0,
.len = 2, .len = 2,
.buf = out_buf, .buf = out_buf,
...@@ -707,7 +707,7 @@ void psb_intel_lvds_init(struct drm_device *dev, ...@@ -707,7 +707,7 @@ void psb_intel_lvds_init(struct drm_device *dev,
dev->dev, "I2C bus registration failed.\n"); dev->dev, "I2C bus registration failed.\n");
goto err_encoder_cleanup; goto err_encoder_cleanup;
} }
lvds_priv->i2c_bus->slave_addr = 0x2C; lvds_priv->i2c_bus->target_addr = 0x2C;
dev_priv->lvds_i2c_bus = lvds_priv->i2c_bus; dev_priv->lvds_i2c_bus = lvds_priv->i2c_bus;
/* /*
......
...@@ -70,7 +70,7 @@ struct psb_intel_sdvo { ...@@ -70,7 +70,7 @@ struct psb_intel_sdvo {
struct gma_encoder base; struct gma_encoder base;
struct i2c_adapter *i2c; struct i2c_adapter *i2c;
u8 slave_addr; u8 target_addr;
struct i2c_adapter ddc; struct i2c_adapter ddc;
...@@ -259,13 +259,13 @@ static bool psb_intel_sdvo_read_byte(struct psb_intel_sdvo *psb_intel_sdvo, u8 a ...@@ -259,13 +259,13 @@ static bool psb_intel_sdvo_read_byte(struct psb_intel_sdvo *psb_intel_sdvo, u8 a
{ {
struct i2c_msg msgs[] = { struct i2c_msg msgs[] = {
{ {
.addr = psb_intel_sdvo->slave_addr, .addr = psb_intel_sdvo->target_addr,
.flags = 0, .flags = 0,
.len = 1, .len = 1,
.buf = &addr, .buf = &addr,
}, },
{ {
.addr = psb_intel_sdvo->slave_addr, .addr = psb_intel_sdvo->target_addr,
.flags = I2C_M_RD, .flags = I2C_M_RD,
.len = 1, .len = 1,
.buf = ch, .buf = ch,
...@@ -463,14 +463,14 @@ static bool psb_intel_sdvo_write_cmd(struct psb_intel_sdvo *psb_intel_sdvo, u8 c ...@@ -463,14 +463,14 @@ static bool psb_intel_sdvo_write_cmd(struct psb_intel_sdvo *psb_intel_sdvo, u8 c
psb_intel_sdvo_debug_write(psb_intel_sdvo, cmd, args, args_len); psb_intel_sdvo_debug_write(psb_intel_sdvo, cmd, args, args_len);
for (i = 0; i < args_len; i++) { for (i = 0; i < args_len; i++) {
msgs[i].addr = psb_intel_sdvo->slave_addr; msgs[i].addr = psb_intel_sdvo->target_addr;
msgs[i].flags = 0; msgs[i].flags = 0;
msgs[i].len = 2; msgs[i].len = 2;
msgs[i].buf = buf + 2 *i; msgs[i].buf = buf + 2 *i;
buf[2*i + 0] = SDVO_I2C_ARG_0 - i; buf[2*i + 0] = SDVO_I2C_ARG_0 - i;
buf[2*i + 1] = ((u8*)args)[i]; buf[2*i + 1] = ((u8*)args)[i];
} }
msgs[i].addr = psb_intel_sdvo->slave_addr; msgs[i].addr = psb_intel_sdvo->target_addr;
msgs[i].flags = 0; msgs[i].flags = 0;
msgs[i].len = 2; msgs[i].len = 2;
msgs[i].buf = buf + 2*i; msgs[i].buf = buf + 2*i;
...@@ -479,12 +479,12 @@ static bool psb_intel_sdvo_write_cmd(struct psb_intel_sdvo *psb_intel_sdvo, u8 c ...@@ -479,12 +479,12 @@ static bool psb_intel_sdvo_write_cmd(struct psb_intel_sdvo *psb_intel_sdvo, u8 c
/* the following two are to read the response */ /* the following two are to read the response */
status = SDVO_I2C_CMD_STATUS; status = SDVO_I2C_CMD_STATUS;
msgs[i+1].addr = psb_intel_sdvo->slave_addr; msgs[i+1].addr = psb_intel_sdvo->target_addr;
msgs[i+1].flags = 0; msgs[i+1].flags = 0;
msgs[i+1].len = 1; msgs[i+1].len = 1;
msgs[i+1].buf = &status; msgs[i+1].buf = &status;
msgs[i+2].addr = psb_intel_sdvo->slave_addr; msgs[i+2].addr = psb_intel_sdvo->target_addr;
msgs[i+2].flags = I2C_M_RD; msgs[i+2].flags = I2C_M_RD;
msgs[i+2].len = 1; msgs[i+2].len = 1;
msgs[i+2].buf = &status; msgs[i+2].buf = &status;
...@@ -1899,7 +1899,7 @@ psb_intel_sdvo_is_hdmi_connector(struct psb_intel_sdvo *psb_intel_sdvo, int devi ...@@ -1899,7 +1899,7 @@ psb_intel_sdvo_is_hdmi_connector(struct psb_intel_sdvo *psb_intel_sdvo, int devi
} }
static u8 static u8
psb_intel_sdvo_get_slave_addr(struct drm_device *dev, int sdvo_reg) psb_intel_sdvo_get_target_addr(struct drm_device *dev, int sdvo_reg)
{ {
struct drm_psb_private *dev_priv = to_drm_psb_private(dev); struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
struct sdvo_device_mapping *my_mapping, *other_mapping; struct sdvo_device_mapping *my_mapping, *other_mapping;
...@@ -1913,14 +1913,14 @@ psb_intel_sdvo_get_slave_addr(struct drm_device *dev, int sdvo_reg) ...@@ -1913,14 +1913,14 @@ psb_intel_sdvo_get_slave_addr(struct drm_device *dev, int sdvo_reg)
} }
/* If the BIOS described our SDVO device, take advantage of it. */ /* If the BIOS described our SDVO device, take advantage of it. */
if (my_mapping->slave_addr) if (my_mapping->target_addr)
return my_mapping->slave_addr; return my_mapping->target_addr;
/* If the BIOS only described a different SDVO device, use the /* If the BIOS only described a different SDVO device, use the
* address that it isn't using. * address that it isn't using.
*/ */
if (other_mapping->slave_addr) { if (other_mapping->target_addr) {
if (other_mapping->slave_addr == 0x70) if (other_mapping->target_addr == 0x70)
return 0x72; return 0x72;
else else
return 0x70; return 0x70;
...@@ -2446,7 +2446,7 @@ bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg) ...@@ -2446,7 +2446,7 @@ bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
return false; return false;
psb_intel_sdvo->sdvo_reg = sdvo_reg; psb_intel_sdvo->sdvo_reg = sdvo_reg;
psb_intel_sdvo->slave_addr = psb_intel_sdvo_get_slave_addr(dev, sdvo_reg) >> 1; psb_intel_sdvo->target_addr = psb_intel_sdvo_get_target_addr(dev, sdvo_reg) >> 1;
psb_intel_sdvo_select_i2c_bus(dev_priv, psb_intel_sdvo, sdvo_reg); psb_intel_sdvo_select_i2c_bus(dev_priv, psb_intel_sdvo, sdvo_reg);
if (!psb_intel_sdvo_init_ddc_proxy(psb_intel_sdvo, dev)) { if (!psb_intel_sdvo_init_ddc_proxy(psb_intel_sdvo, dev)) {
kfree(psb_intel_sdvo); kfree(psb_intel_sdvo);
......
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