* [PATCH] Add support for definition of register maps in DT in ADV7604
@ 2014-08-27 12:53 jean-michel.hautbois
2014-08-27 13:03 ` Hans Verkuil
0 siblings, 1 reply; 4+ messages in thread
From: jean-michel.hautbois @ 2014-08-27 12:53 UTC (permalink / raw)
To: linux-media; +Cc: hverkuil, Jean-Michel Hautbois
From: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
This patch adds support for DT parsing of register maps adresses.
This allows multiple adv76xx devices on the same bus.
Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
---
.../devicetree/bindings/media/i2c/adv7604.txt | 12 ++++
drivers/media/i2c/adv7604.c | 71 ++++++++++++++++++----
2 files changed, 71 insertions(+), 12 deletions(-)
diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index c27cede..33881fb 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -32,6 +32,18 @@ The digital output port node must contain at least one endpoint.
Optional Properties:
- reset-gpios: Reference to the GPIO connected to the device's reset pin.
+ - adv7604-page-avlink: Programmed address for avlink register map
+ - adv7604-page-cec: Programmed address for cec register map
+ - adv7604-page-infoframe: Programmed address for infoframe register map
+ - adv7604-page-esdp: Programmed address for esdp register map
+ - adv7604-page-dpp: Programmed address for dpp register map
+ - adv7604-page-afe: Programmed address for afe register map
+ - adv7604-page-rep: Programmed address for rep register map
+ - adv7604-page-edid: Programmed address for edid register map
+ - adv7604-page-hdmi: Programmed address for hdmi register map
+ - adv7604-page-test: Programmed address for test register map
+ - adv7604-page-cp: Programmed address for cp register map
+ - adv7604-page-vdp: Programmed address for vdp register map
Optional Endpoint Properties:
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index d4fa213..89a7034 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2718,18 +2718,65 @@ static int adv7604_parse_dt(struct adv7604_state *state)
state->pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED;
/* Use the default I2C addresses. */
- state->pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42;
- state->pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40;
- state->pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME] = 0x3e;
- state->pdata.i2c_addresses[ADV7604_PAGE_ESDP] = 0x38;
- state->pdata.i2c_addresses[ADV7604_PAGE_DPP] = 0x3c;
- state->pdata.i2c_addresses[ADV7604_PAGE_AFE] = 0x26;
- state->pdata.i2c_addresses[ADV7604_PAGE_REP] = 0x32;
- state->pdata.i2c_addresses[ADV7604_PAGE_EDID] = 0x36;
- state->pdata.i2c_addresses[ADV7604_PAGE_HDMI] = 0x34;
- state->pdata.i2c_addresses[ADV7604_PAGE_TEST] = 0x30;
- state->pdata.i2c_addresses[ADV7604_PAGE_CP] = 0x22;
- state->pdata.i2c_addresses[ADV7604_PAGE_VDP] = 0x24;
+ of_property_read_u32(np, "adv7604-page-avlink",
+ &state->pdata.i2c_addresses[ADV7604_PAGE_AVLINK]);
+ if (!state->pdata.i2c_addresses[ADV7604_PAGE_AVLINK])
+ state->pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42;
+
+ of_property_read_u32(np, "adv7604-page-cec",
+ &state->pdata.i2c_addresses[ADV7604_PAGE_CEC]);
+ if (!state->pdata.i2c_addresses[ADV7604_PAGE_CEC])
+ state->pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40;
+
+ of_property_read_u32(np, "adv7604-page-infoframe",
+ &state->pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME]);
+ if (!state->pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME])
+ state->pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME] = 0x3e;
+
+ of_property_read_u32(np, "adv7604-page-esdp",
+ &state->pdata.i2c_addresses[ADV7604_PAGE_ESDP]);
+ if (!state->pdata.i2c_addresses[ADV7604_PAGE_ESDP])
+ state->pdata.i2c_addresses[ADV7604_PAGE_ESDP] = 0x38;
+
+ of_property_read_u32(np, "adv7604-page-dpp",
+ &state->pdata.i2c_addresses[ADV7604_PAGE_DPP]);
+ if (!state->pdata.i2c_addresses[ADV7604_PAGE_DPP])
+ state->pdata.i2c_addresses[ADV7604_PAGE_DPP] = 0x3c;
+
+ of_property_read_u32(np, "adv7604-page-afe",
+ &state->pdata.i2c_addresses[ADV7604_PAGE_AFE]);
+ if (!state->pdata.i2c_addresses[ADV7604_PAGE_AFE])
+ state->pdata.i2c_addresses[ADV7604_PAGE_AFE] = 0x26;
+
+ of_property_read_u32(np, "adv7604-page-rep",
+ &state->pdata.i2c_addresses[ADV7604_PAGE_REP]);
+ if (!state->pdata.i2c_addresses[ADV7604_PAGE_REP])
+ state->pdata.i2c_addresses[ADV7604_PAGE_REP] = 0x32;
+
+ of_property_read_u32(np, "adv7604-page-edid",
+ &state->pdata.i2c_addresses[ADV7604_PAGE_EDID]);
+ if (!state->pdata.i2c_addresses[ADV7604_PAGE_EDID])
+ state->pdata.i2c_addresses[ADV7604_PAGE_EDID] = 0x36;
+
+ of_property_read_u32(np, "adv7604-page-hdmi",
+ &state->pdata.i2c_addresses[ADV7604_PAGE_HDMI]);
+ if (!state->pdata.i2c_addresses[ADV7604_PAGE_HDMI])
+ state->pdata.i2c_addresses[ADV7604_PAGE_HDMI] = 0x34;
+
+ of_property_read_u32(np, "adv7604-page-test",
+ &state->pdata.i2c_addresses[ADV7604_PAGE_TEST]);
+ if (!state->pdata.i2c_addresses[ADV7604_PAGE_TEST])
+ state->pdata.i2c_addresses[ADV7604_PAGE_TEST] = 0x30;
+
+ of_property_read_u32(np, "adv7604-page-cp",
+ &state->pdata.i2c_addresses[ADV7604_PAGE_CP]);
+ if (!state->pdata.i2c_addresses[ADV7604_PAGE_CP])
+ state->pdata.i2c_addresses[ADV7604_PAGE_CP] = 0x22;
+
+ of_property_read_u32(np, "adv7604-page-vdp",
+ &state->pdata.i2c_addresses[ADV7604_PAGE_VDP]);
+ if (!state->pdata.i2c_addresses[ADV7604_PAGE_VDP])
+ state->pdata.i2c_addresses[ADV7604_PAGE_VDP] = 0x24;
/* Hardcode the remaining platform data fields. */
state->pdata.disable_pwrdnb = 0;
--
2.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Add support for definition of register maps in DT in ADV7604
2014-08-27 12:53 [PATCH] Add support for definition of register maps in DT in ADV7604 jean-michel.hautbois
@ 2014-08-27 13:03 ` Hans Verkuil
2014-08-27 13:13 ` Jean-Michel Hautbois
2014-08-27 14:05 ` Lars-Peter Clausen
0 siblings, 2 replies; 4+ messages in thread
From: Hans Verkuil @ 2014-08-27 13:03 UTC (permalink / raw)
To: jean-michel.hautbois, linux-media
On 08/27/14 14:53, jean-michel.hautbois@vodalys.com wrote:
> From: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
>
> This patch adds support for DT parsing of register maps adresses.
> This allows multiple adv76xx devices on the same bus.
>
> Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
> ---
> .../devicetree/bindings/media/i2c/adv7604.txt | 12 ++++
> drivers/media/i2c/adv7604.c | 71 ++++++++++++++++++----
> 2 files changed, 71 insertions(+), 12 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> index c27cede..33881fb 100644
> --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> @@ -32,6 +32,18 @@ The digital output port node must contain at least one endpoint.
> Optional Properties:
>
> - reset-gpios: Reference to the GPIO connected to the device's reset pin.
> + - adv7604-page-avlink: Programmed address for avlink register map
> + - adv7604-page-cec: Programmed address for cec register map
> + - adv7604-page-infoframe: Programmed address for infoframe register map
> + - adv7604-page-esdp: Programmed address for esdp register map
> + - adv7604-page-dpp: Programmed address for dpp register map
> + - adv7604-page-afe: Programmed address for afe register map
> + - adv7604-page-rep: Programmed address for rep register map
> + - adv7604-page-edid: Programmed address for edid register map
> + - adv7604-page-hdmi: Programmed address for hdmi register map
> + - adv7604-page-test: Programmed address for test register map
> + - adv7604-page-cp: Programmed address for cp register map
> + - adv7604-page-vdp: Programmed address for vdp register map
Might adv7604-addr-avlink be a better name? Other than that it looks good
to me.
Hans
>
> Optional Endpoint Properties:
>
> diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
> index d4fa213..89a7034 100644
> --- a/drivers/media/i2c/adv7604.c
> +++ b/drivers/media/i2c/adv7604.c
> @@ -2718,18 +2718,65 @@ static int adv7604_parse_dt(struct adv7604_state *state)
> state->pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED;
>
> /* Use the default I2C addresses. */
> - state->pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42;
> - state->pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40;
> - state->pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME] = 0x3e;
> - state->pdata.i2c_addresses[ADV7604_PAGE_ESDP] = 0x38;
> - state->pdata.i2c_addresses[ADV7604_PAGE_DPP] = 0x3c;
> - state->pdata.i2c_addresses[ADV7604_PAGE_AFE] = 0x26;
> - state->pdata.i2c_addresses[ADV7604_PAGE_REP] = 0x32;
> - state->pdata.i2c_addresses[ADV7604_PAGE_EDID] = 0x36;
> - state->pdata.i2c_addresses[ADV7604_PAGE_HDMI] = 0x34;
> - state->pdata.i2c_addresses[ADV7604_PAGE_TEST] = 0x30;
> - state->pdata.i2c_addresses[ADV7604_PAGE_CP] = 0x22;
> - state->pdata.i2c_addresses[ADV7604_PAGE_VDP] = 0x24;
> + of_property_read_u32(np, "adv7604-page-avlink",
> + &state->pdata.i2c_addresses[ADV7604_PAGE_AVLINK]);
> + if (!state->pdata.i2c_addresses[ADV7604_PAGE_AVLINK])
> + state->pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42;
> +
> + of_property_read_u32(np, "adv7604-page-cec",
> + &state->pdata.i2c_addresses[ADV7604_PAGE_CEC]);
> + if (!state->pdata.i2c_addresses[ADV7604_PAGE_CEC])
> + state->pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40;
> +
> + of_property_read_u32(np, "adv7604-page-infoframe",
> + &state->pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME]);
> + if (!state->pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME])
> + state->pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME] = 0x3e;
> +
> + of_property_read_u32(np, "adv7604-page-esdp",
> + &state->pdata.i2c_addresses[ADV7604_PAGE_ESDP]);
> + if (!state->pdata.i2c_addresses[ADV7604_PAGE_ESDP])
> + state->pdata.i2c_addresses[ADV7604_PAGE_ESDP] = 0x38;
> +
> + of_property_read_u32(np, "adv7604-page-dpp",
> + &state->pdata.i2c_addresses[ADV7604_PAGE_DPP]);
> + if (!state->pdata.i2c_addresses[ADV7604_PAGE_DPP])
> + state->pdata.i2c_addresses[ADV7604_PAGE_DPP] = 0x3c;
> +
> + of_property_read_u32(np, "adv7604-page-afe",
> + &state->pdata.i2c_addresses[ADV7604_PAGE_AFE]);
> + if (!state->pdata.i2c_addresses[ADV7604_PAGE_AFE])
> + state->pdata.i2c_addresses[ADV7604_PAGE_AFE] = 0x26;
> +
> + of_property_read_u32(np, "adv7604-page-rep",
> + &state->pdata.i2c_addresses[ADV7604_PAGE_REP]);
> + if (!state->pdata.i2c_addresses[ADV7604_PAGE_REP])
> + state->pdata.i2c_addresses[ADV7604_PAGE_REP] = 0x32;
> +
> + of_property_read_u32(np, "adv7604-page-edid",
> + &state->pdata.i2c_addresses[ADV7604_PAGE_EDID]);
> + if (!state->pdata.i2c_addresses[ADV7604_PAGE_EDID])
> + state->pdata.i2c_addresses[ADV7604_PAGE_EDID] = 0x36;
> +
> + of_property_read_u32(np, "adv7604-page-hdmi",
> + &state->pdata.i2c_addresses[ADV7604_PAGE_HDMI]);
> + if (!state->pdata.i2c_addresses[ADV7604_PAGE_HDMI])
> + state->pdata.i2c_addresses[ADV7604_PAGE_HDMI] = 0x34;
> +
> + of_property_read_u32(np, "adv7604-page-test",
> + &state->pdata.i2c_addresses[ADV7604_PAGE_TEST]);
> + if (!state->pdata.i2c_addresses[ADV7604_PAGE_TEST])
> + state->pdata.i2c_addresses[ADV7604_PAGE_TEST] = 0x30;
> +
> + of_property_read_u32(np, "adv7604-page-cp",
> + &state->pdata.i2c_addresses[ADV7604_PAGE_CP]);
> + if (!state->pdata.i2c_addresses[ADV7604_PAGE_CP])
> + state->pdata.i2c_addresses[ADV7604_PAGE_CP] = 0x22;
> +
> + of_property_read_u32(np, "adv7604-page-vdp",
> + &state->pdata.i2c_addresses[ADV7604_PAGE_VDP]);
> + if (!state->pdata.i2c_addresses[ADV7604_PAGE_VDP])
> + state->pdata.i2c_addresses[ADV7604_PAGE_VDP] = 0x24;
>
> /* Hardcode the remaining platform data fields. */
> state->pdata.disable_pwrdnb = 0;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add support for definition of register maps in DT in ADV7604
2014-08-27 13:03 ` Hans Verkuil
@ 2014-08-27 13:13 ` Jean-Michel Hautbois
2014-08-27 14:05 ` Lars-Peter Clausen
1 sibling, 0 replies; 4+ messages in thread
From: Jean-Michel Hautbois @ 2014-08-27 13:13 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media
2014-08-27 15:03 GMT+02:00 Hans Verkuil <hverkuil@xs4all.nl>:
> On 08/27/14 14:53, jean-michel.hautbois@vodalys.com wrote:
>> From: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
>>
>> This patch adds support for DT parsing of register maps adresses.
>> This allows multiple adv76xx devices on the same bus.
>>
>> Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
>> ---
>> .../devicetree/bindings/media/i2c/adv7604.txt | 12 ++++
>> drivers/media/i2c/adv7604.c | 71 ++++++++++++++++++----
>> 2 files changed, 71 insertions(+), 12 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
>> index c27cede..33881fb 100644
>> --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
>> +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
>> @@ -32,6 +32,18 @@ The digital output port node must contain at least one endpoint.
>> Optional Properties:
>>
>> - reset-gpios: Reference to the GPIO connected to the device's reset pin.
>> + - adv7604-page-avlink: Programmed address for avlink register map
>> + - adv7604-page-cec: Programmed address for cec register map
>> + - adv7604-page-infoframe: Programmed address for infoframe register map
>> + - adv7604-page-esdp: Programmed address for esdp register map
>> + - adv7604-page-dpp: Programmed address for dpp register map
>> + - adv7604-page-afe: Programmed address for afe register map
>> + - adv7604-page-rep: Programmed address for rep register map
>> + - adv7604-page-edid: Programmed address for edid register map
>> + - adv7604-page-hdmi: Programmed address for hdmi register map
>> + - adv7604-page-test: Programmed address for test register map
>> + - adv7604-page-cp: Programmed address for cp register map
>> + - adv7604-page-vdp: Programmed address for vdp register map
>
> Might adv7604-addr-avlink be a better name? Other than that it looks good
> to me.
>
> Hans
>
I can replace all -page- by -addr- if it seems better... I used page
as this is also the name defined in the source code but you are
probably right, it is an address, not a page... :)
JM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add support for definition of register maps in DT in ADV7604
2014-08-27 13:03 ` Hans Verkuil
2014-08-27 13:13 ` Jean-Michel Hautbois
@ 2014-08-27 14:05 ` Lars-Peter Clausen
1 sibling, 0 replies; 4+ messages in thread
From: Lars-Peter Clausen @ 2014-08-27 14:05 UTC (permalink / raw)
To: Hans Verkuil
Cc: jean-michel.hautbois, linux-media, Wolfram Sang,
devicetree@vger.kernel.org
On 08/27/2014 03:03 PM, Hans Verkuil wrote:
> On 08/27/14 14:53, jean-michel.hautbois@vodalys.com wrote:
>> From: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
>>
>> This patch adds support for DT parsing of register maps adresses.
>> This allows multiple adv76xx devices on the same bus.
>>
>> Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
>> ---
>> .../devicetree/bindings/media/i2c/adv7604.txt | 12 ++++
>> drivers/media/i2c/adv7604.c | 71 ++++++++++++++++++----
>> 2 files changed, 71 insertions(+), 12 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
>> index c27cede..33881fb 100644
>> --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
>> +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
>> @@ -32,6 +32,18 @@ The digital output port node must contain at least one endpoint.
>> Optional Properties:
>>
>> - reset-gpios: Reference to the GPIO connected to the device's reset pin.
>> + - adv7604-page-avlink: Programmed address for avlink register map
>> + - adv7604-page-cec: Programmed address for cec register map
>> + - adv7604-page-infoframe: Programmed address for infoframe register map
>> + - adv7604-page-esdp: Programmed address for esdp register map
>> + - adv7604-page-dpp: Programmed address for dpp register map
>> + - adv7604-page-afe: Programmed address for afe register map
>> + - adv7604-page-rep: Programmed address for rep register map
>> + - adv7604-page-edid: Programmed address for edid register map
>> + - adv7604-page-hdmi: Programmed address for hdmi register map
>> + - adv7604-page-test: Programmed address for test register map
>> + - adv7604-page-cp: Programmed address for cp register map
>> + - adv7604-page-vdp: Programmed address for vdp register map
>
> Might adv7604-addr-avlink be a better name? Other than that it looks good
> to me.
Those properties need at least a vendor prefix. But to be honest I'd rather see
generic support for multiple addresses in the I2C core. This is not a feature
that is specific to this particular device. And for example similar things work
already fine for other buses like for example MMIO devices.
E.g. something like
reg = <0x12 0x34 0x56 0x78 ...>
reg-names = "main", "avlink", "cec", "infoframe", ...
Ideally accessing those other addresses will be hidden in the I2C core by a
helper function that allows you to create a dummy device for a particular
sub-address.
- Lars
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-08-27 14:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-27 12:53 [PATCH] Add support for definition of register maps in DT in ADV7604 jean-michel.hautbois
2014-08-27 13:03 ` Hans Verkuil
2014-08-27 13:13 ` Jean-Michel Hautbois
2014-08-27 14:05 ` Lars-Peter Clausen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).