[PATCH net-next v5 7/7] ptp: ocp: Add Time Card V9 I2C peripheral topology
From: Ahmad Byagowi
Date: Fri Aug 14 2026 - 19:16:23 EST
Time Card V9 boards use the same mux infrastructure with a BME280,
a BNO055, and an IS32FL3207 at a different address.
Describe six RGB groups. The first two expose the GNSS1 and GNSS2
status LEDs on outputs 0 through 5; the remaining four expose the SMA
indicator LEDs on outputs 6 through 17.
Select the profile only when the fixed-width board ID exactly matches
TIMECARD-V9 with zero or erased-byte padding. Older revisions share the
detectable I2C devices but not the V9 LED wiring.
Signed-off-by: Ahmad Byagowi <ahmadexp@xxxxxxxxx>
---
drivers/ptp/ptp_ocp.c | 87 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 87 insertions(+)
diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 5ae50ad83bda..5100278f164d 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -643,6 +643,73 @@ static const struct ptp_ocp_i2c_profile ptp_ocp_r4006_profile = {
.led_max_microamp = 8150,
};
+static const struct ptp_ocp_i2c_device ptp_ocp_v9_sensors[] = {
+ { "pressure@76", "bosch,bme280", "bme280", 1, 0x76 },
+ { "imu@29", "bosch,bno055", "bno055", 1, 0x29 },
+};
+
+static const struct ptp_ocp_led ptp_ocp_v9_leds[] = {
+ {
+ .node_name = "multi-led@0",
+ .function = LED_FUNCTION_STATUS,
+ .function_enumerator = 1,
+ .has_function_enumerator = true,
+ .channel = { 0, 1, 2 },
+ },
+ {
+ .node_name = "multi-led@3",
+ .function = LED_FUNCTION_STATUS,
+ .function_enumerator = 2,
+ .has_function_enumerator = true,
+ .channel = { 3, 4, 5 },
+ },
+ {
+ .node_name = "multi-led@6",
+ .function = LED_FUNCTION_INDICATOR,
+ .function_enumerator = 1,
+ .has_function_enumerator = true,
+ .channel = { 6, 7, 8 },
+ },
+ {
+ .node_name = "multi-led@9",
+ .function = LED_FUNCTION_INDICATOR,
+ .function_enumerator = 2,
+ .has_function_enumerator = true,
+ .channel = { 9, 10, 11 },
+ },
+ {
+ .node_name = "multi-led@c",
+ .function = LED_FUNCTION_INDICATOR,
+ .function_enumerator = 3,
+ .has_function_enumerator = true,
+ .channel = { 12, 13, 14 },
+ },
+ {
+ .node_name = "multi-led@f",
+ .function = LED_FUNCTION_INDICATOR,
+ .function_enumerator = 4,
+ .has_function_enumerator = true,
+ .channel = { 15, 16, 17 },
+ },
+};
+
+static_assert(ARRAY_SIZE(ptp_ocp_v9_sensors) <=
+ OCP_I2C_MAX_SENSOR_COUNT);
+static_assert(ARRAY_SIZE(ptp_ocp_v9_leds) <= OCP_I2C_MAX_LED_COUNT);
+
+static const struct ptp_ocp_i2c_profile ptp_ocp_v9_profile = {
+ .name = "v9",
+ .sensors = ptp_ocp_v9_sensors,
+ .sensor_count = ARRAY_SIZE(ptp_ocp_v9_sensors),
+ .leds = ptp_ocp_v9_leds,
+ .led_count = ARRAY_SIZE(ptp_ocp_v9_leds),
+ .led_node_name = "led-controller@37",
+ .led_mux_channel = 1,
+ .led_address = 0x37,
+ .led_riset_ohms = 4700,
+ .led_max_microamp = 8100,
+};
+
#define bp_assign_entry(bp, res, val) ({ \
uintptr_t addr = (uintptr_t)(bp) + (res)->bp_offset; \
*(typeof(val) *)addr = val; \
@@ -2243,6 +2310,22 @@ ptp_ocp_i2c_supported(struct ptp_ocp *bp)
bp->pdev->device == PCI_DEVICE_ID_CELESTICA_TIMECARD);
}
+static bool
+ptp_ocp_board_id_matches(const u8 *board_id, const char *id)
+{
+ size_t len = strlen(id);
+ unsigned int i;
+
+ if (len > OCP_BOARD_ID_LEN || memcmp(board_id, id, len))
+ return false;
+
+ for (i = len; i < OCP_BOARD_ID_LEN; i++)
+ if (board_id[i] != 0 && board_id[i] != 0xff)
+ return false;
+
+ return true;
+}
+
static const struct ptp_ocp_i2c_profile *
ptp_ocp_i2c_select_profile(struct ptp_ocp *bp)
{
@@ -2254,6 +2337,10 @@ ptp_ocp_i2c_select_profile(struct ptp_ocp *bp)
if (!memcmp(bp->board_id, "R4006", 5))
return &ptp_ocp_r4006_profile;
+ /* Older revisions share V9's I2C devices but not its LED wiring. */
+ if (ptp_ocp_board_id_matches(bp->board_id, "TIMECARD-V9"))
+ return &ptp_ocp_v9_profile;
+
return NULL;
}
--
2.50.1 (Apple Git-155)