Skip to content

Commit a09c767

Browse files
remove clients from sddf pinctrl
Signed-off-by: Bill Nguyen <[email protected]>
1 parent 2207aaa commit a09c767

File tree

5 files changed

+4
-83
lines changed

5 files changed

+4
-83
lines changed

src/c/c.zig

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -705,20 +705,6 @@ export fn sdfgen_sddf_pinctrl_destroy(system: *align(8) anyopaque) void {
705705
allocator.destroy(pinctrl);
706706
}
707707

708-
export fn sdfgen_sddf_pinctrl_add_client(system: *align(8) anyopaque, client: *align(8) anyopaque) bindings.sdfgen_sddf_status_t {
709-
const pinctrl: *sddf.Pinctrl = @ptrCast(system);
710-
pinctrl.addClient(@ptrCast(client)) catch |e| {
711-
switch (e) {
712-
sddf.Pinctrl.Error.DuplicateClient => return 1,
713-
sddf.Pinctrl.Error.InvalidClient => return 2,
714-
// Should never happen when adding a client
715-
sddf.Pinctrl.Error.NotConnected => @panic("internal error"),
716-
}
717-
};
718-
719-
return 0;
720-
}
721-
722708
export fn sdfgen_sddf_pinctrl_connect(system: *align(8) anyopaque) bool {
723709
const pinctrl: *sddf.Pinctrl = @ptrCast(system);
724710
pinctrl.connect() catch return false;

src/c/sdfgen.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ bool sdfgen_sddf_gpu_serialise_config(void *system, char *output_dir);
132132

133133
void *sdfgen_sddf_pinctrl(void *sdf, void *device, void *driver);
134134
void sdfgen_sddf_pinctrl_destroy(void *system);
135-
sdfgen_sddf_status_t sdfgen_sddf_pinctrl_add_client(void *system, void *client);
136135
bool sdfgen_sddf_pinctrl_connect(void *system);
137136
bool sdfgen_sddf_pinctrl_serialise_config(void *system, char *output_dir);
138137

src/data.zig

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -339,15 +339,6 @@ pub const Resources = struct {
339339
};
340340
};
341341

342-
pub const Pinctrl = struct {
343-
const MAGIC: [5]u8 = MAGIC_START ++ .{0x8};
344-
345-
pub const Client = extern struct {
346-
magic: [5]u8 = MAGIC,
347-
driver_id: u8,
348-
};
349-
};
350-
351342
pub const Fs = extern struct {
352343
const MAGIC: [8]u8 = LIONS_MAGIC_START ++ .{0x1};
353344

src/python/module.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ class SddfStatus(IntEnum):
146146
libsdfgen.sdfgen_sddf_pinctrl_destroy.restype = None
147147
libsdfgen.sdfgen_sddf_pinctrl_destroy.argtypes = [c_void_p]
148148

149-
libsdfgen.sdfgen_sddf_pinctrl_add_client.restype = c_uint32
150-
libsdfgen.sdfgen_sddf_pinctrl_add_client.argtypes = [c_void_p, c_void_p]
151-
152149
libsdfgen.sdfgen_sddf_pinctrl_connect.restype = c_bool
153150
libsdfgen.sdfgen_sddf_pinctrl_connect.argtypes = [c_void_p]
154151
libsdfgen.sdfgen_sddf_pinctrl_serialise_config.restype = c_bool
@@ -1029,17 +1026,6 @@ def __init__(
10291026

10301027
self._obj: c_void_p = libsdfgen.sdfgen_sddf_pinctrl(sdf._obj, device_obj, driver._obj)
10311028

1032-
def add_client(self, client: SystemDescription.ProtectionDomain):
1033-
ret = libsdfgen.sdfgen_sddf_pinctrl_add_client(self._obj, client._obj)
1034-
if ret == SddfStatus.OK:
1035-
return
1036-
elif ret == SddfStatus.DUPLICATE_CLIENT:
1037-
raise Exception(f"duplicate client given '{client}'")
1038-
elif ret == SddfStatus.INVALID_CLIENT:
1039-
raise Exception(f"invalid client given '{client}'")
1040-
else:
1041-
raise Exception(f"internal error: {ret}")
1042-
10431029
def connect(self) -> bool:
10441030
return libsdfgen.sdfgen_sddf_pinctrl_connect(self._obj)
10451031

src/sddf.zig

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,11 +1633,8 @@ pub const Pinctrl = struct {
16331633
/// Device Tree node for the pinctrl device
16341634
device: *dtb.Node,
16351635
device_res: ConfigResources.Device,
1636-
/// Client PDs serviced by the pinctrl driver
1637-
clients: std.ArrayList(*Pd),
1638-
client_configs: std.ArrayList(ConfigResources.Pinctrl.Client),
1639-
connected: bool = false,
16401636
serialised: bool = false,
1637+
connected: bool = false,
16411638

16421639
pub const Error = SystemError;
16431640

@@ -1652,53 +1649,20 @@ pub const Pinctrl = struct {
16521649
.driver = driver,
16531650
.device = device,
16541651
.device_res = std.mem.zeroInit(ConfigResources.Device, .{}),
1655-
.clients = std.ArrayList(*Pd).init(allocator),
1656-
.client_configs = std.ArrayList(ConfigResources.Pinctrl.Client).init(allocator),
16571652
};
16581653
}
16591654

16601655
pub fn deinit(system: *Pinctrl) void {
1661-
system.clients.deinit();
1662-
system.client_configs.deinit();
1663-
}
1664-
1665-
pub fn addClient(system: *Pinctrl, client: *Pd) Error!void {
1666-
// Check that the client does not already exist
1667-
for (system.clients.items) |existing_client| {
1668-
if (std.mem.eql(u8, existing_client.name, client.name)) {
1669-
return Error.DuplicateClient;
1670-
}
1671-
}
1672-
if (std.mem.eql(u8, client.name, system.driver.name)) {
1673-
log.err("invalid pinctrl client, same name as driver '{s}", .{client.name});
1674-
return Error.InvalidClient;
1675-
}
1676-
const client_priority = if (client.priority) |priority| priority else Pd.DEFAULT_PRIORITY;
1677-
const driver_priority = if (system.driver.priority) |priority| priority else Pd.DEFAULT_PRIORITY;
1678-
if (client_priority >= driver_priority) {
1679-
log.err("invalid pinctrl client '{s}', driver '{s}' must have greater priority than client", .{ client.name, system.driver.name });
1680-
return Error.InvalidClient;
1681-
}
1682-
system.clients.append(client) catch @panic("Could not add client to Pinctrl");
1683-
system.client_configs.append(std.mem.zeroInit(ConfigResources.Pinctrl.Client, .{})) catch @panic("Could not add client to Timer");
1656+
// In the future when we add clients we would need to free associated resources here
1657+
_ = system;
1658+
return;
16841659
}
16851660

16861661
pub fn connect(system: *Pinctrl) !void {
16871662
// The driver must be passive
16881663
assert(system.driver.passive.?);
16891664

16901665
try createDriver(system.sdf, system.driver, system.device, .pinctrl, &system.device_res);
1691-
for (system.clients.items, 0..) |client, i| {
1692-
const ch = Channel.create(system.driver, client, .{
1693-
// Client needs to be able to PPC into driver
1694-
.pp = .b,
1695-
// Client does not need to notify driver
1696-
.pd_b_notify = false,
1697-
}) catch unreachable;
1698-
system.sdf.addChannel(ch);
1699-
system.client_configs.items[i].driver_id = ch.pd_b_id;
1700-
}
1701-
17021666
system.connected = true;
17031667
}
17041668

@@ -1710,11 +1674,6 @@ pub const Pinctrl = struct {
17101674
const device_res_data_name = fmt(allocator, "{s}_device_resources", .{system.driver.name});
17111675
try data.serialize(allocator, system.device_res, prefix, device_res_data_name);
17121676

1713-
for (system.clients.items, 0..) |client, i| {
1714-
const data_name = fmt(allocator, "pinctrl_client_{s}", .{client.name});
1715-
try data.serialize(allocator, system.client_configs.items[i], prefix, data_name);
1716-
}
1717-
17181677
system.serialised = true;
17191678
}
17201679
};

0 commit comments

Comments
 (0)