diff options
author | Robert Chiras <robert.chiras@nxp.com> | 2018-03-02 11:31:50 +0200 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 12:41:33 +0300 |
commit | 45a6b1ea84623cb6cf7aaaa17a637fb8f177b183 (patch) | |
tree | 289ca0273fe75609a090bc95814a9c33b1ca93c2 | |
parent | 3a05d92af11249eb570dd6e4fb81a66b889b7991 (diff) |
MLK-17650-1: drm/bridge: adv7511: Add support for programmable i2c addresses
The DSI-HDMI converter, ADV7535, driver uses four i2c memory maps: MAIN,
DSI-CEC, EDID and PACKET.
While the MAIN address is hard-coded in the ROM chip, the other three
can be programmed into the MAIN memory map.
Currently, the three memory maps addresses, that can be programmed, are
hard-coded into the code.
In order to avoid conflicts with other i2c clients on the bus, update
the driver to use configurable addresses specified in DTS file.
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
-rw-r--r-- | Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/bridge/adv7511/adv7511.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 24 | ||||
-rw-r--r-- | drivers/gpu/drm/bridge/adv7511/adv7533.c | 6 |
4 files changed, 36 insertions, 4 deletions
diff --git a/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt b/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt index 0e6124435bc1..0064ff610ade 100644 --- a/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt +++ b/Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt @@ -59,6 +59,12 @@ Optional properties: data lanes, rather than generate its own timings for HDMI output. - adi,dsi-channel: Only for ADV7533 and ADV7535. DSI channel number to be used when communicating with the DSI peripheral. It should be one of 0, 1, 2 or 3. +- adi,addr-cec: Only for ADV7533 and ADV7535. The I2C DSI-CEC register map + address to be programmed into the MAIN register map. +- adi,addr-edid: Only for ADV7533 and ADV7535. The I2C EDID register map + to be programmed into the MAIN register map. +- adi,addr-pkt: Only for ADV7533 and ADV7535. The I2C PACKET register map + to be programmed into the MAIN register map. Required nodes: diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h index 7e210cb5959e..bc39d4005faf 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h @@ -302,6 +302,10 @@ struct adv7511 { struct i2c_client *i2c_edid; struct i2c_client *i2c_cec; + u32 addr_cec; + u32 addr_edid; + u32 addr_pkt; + struct regmap *regmap; struct regmap *regmap_cec; enum drm_connector_status status; diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 6539c277eadc..13118e40ca83 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -976,6 +976,8 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id) #endif unsigned int main_i2c_addr = i2c->addr << 1; unsigned int edid_i2c_addr = main_i2c_addr + 4; + unsigned int cec_i2c_addr = main_i2c_addr - 2; + unsigned int pkt_i2c_addr = main_i2c_addr - 0xa; unsigned int val; int ret; @@ -1003,6 +1005,21 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id) if (ret) return ret; + if (adv7511->addr_cec != 0) + cec_i2c_addr = adv7511->addr_cec << 1; + else + adv7511->addr_cec = cec_i2c_addr >> 1; + + if (adv7511->addr_edid != 0) + edid_i2c_addr = adv7511->addr_edid << 1; + else + adv7511->addr_edid = edid_i2c_addr >> 1; + + if (adv7511->addr_pkt != 0) + pkt_i2c_addr = adv7511->addr_pkt << 1; + else + adv7511->addr_pkt = pkt_i2c_addr >> 1; + /* * The power down GPIO is optional. If present, toggle it from active to * inactive to wake up the encoder. @@ -1036,11 +1053,12 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id) if (ret) return ret; - regmap_write(adv7511->regmap, ADV7511_REG_EDID_I2C_ADDR, edid_i2c_addr); + regmap_write(adv7511->regmap, ADV7511_REG_EDID_I2C_ADDR, + edid_i2c_addr); regmap_write(adv7511->regmap, ADV7511_REG_PACKET_I2C_ADDR, - main_i2c_addr - 0xa); + pkt_i2c_addr); regmap_write(adv7511->regmap, ADV7511_REG_CEC_I2C_ADDR, - main_i2c_addr - 2); + cec_i2c_addr); adv7511_packet_disable(adv7511, 0xffff); diff --git a/drivers/gpu/drm/bridge/adv7511/adv7533.c b/drivers/gpu/drm/bridge/adv7511/adv7533.c index 824d6deb4d0f..62e112ad7aa9 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7533.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7533.c @@ -154,7 +154,7 @@ int adv7533_init_cec(struct adv7511 *adv) int ret; adv->i2c_cec = i2c_new_dummy(adv->i2c_main->adapter, - adv->i2c_main->addr - 1); + adv->addr_cec); if (!adv->i2c_cec) return -ENOMEM; @@ -266,6 +266,10 @@ int adv7533_parse_dt(struct device_node *np, struct adv7511 *adv) adv->use_timing_gen = !of_property_read_bool(np, "adi,disable-timing-generator"); + of_property_read_u32(np, "adi,addr-cec", &adv->addr_cec); + of_property_read_u32(np, "adi,addr-edid", &adv->addr_edid); + of_property_read_u32(np, "adi,addr-pkt", &adv->addr_pkt); + /* TODO: Check if these need to be parsed by DT or not */ adv->rgb = true; adv->embedded_sync = false; |